Add campaign launcher and app version manager; fix SQL injection in updatePackages

serviceapp/updatePackages.php built its UPDATE by interpolating the request
values straight into the SQL string, so any caller with a valid token could
execute arbitrary SQL through the version field. It now uses bound
parameters, requires an admin role, validates the version format, and writes
an audit entry.

trigger_campaign.php gains dry_run=1: it performs the same Gemini analysis
and target selection but returns before creating the promo code and before
dispatching any notification. Launching without previewing was the only
option before, and a launch writes a seven-day discount and pushes to every
passenger in the country.

Console:
- Campaign launcher with a mandatory preview. Launching stays disabled until
  the current parameters have been previewed, and re-locks if any parameter
  changes afterwards or once a launch completes.
- App version manager with the same version-format check as the server and a
  confirmation naming the old and new values.

Cache busting: assets are served straight off a bind mount with no version,
so browsers kept running the previously cached build after a deploy. Both
asset links now carry ?v=, and the build id is shown in Session & Security
and printed in the diagnostics report.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-07-25 14:41:27 +03:00
co-authored by Claude Opus 5
parent 67f55e5192
commit 4009af8dd3
4 changed files with 284 additions and 16 deletions
+5 -2
View File
@@ -12,7 +12,10 @@
<script src="https://unpkg.com/@phosphor-icons/web"></script>
<!-- Styles -->
<link rel="stylesheet" href="css/main.css">
<!-- ?v= must be bumped whenever css/main.css or js/app.js changes: the files
are served straight off a bind mount, so without it browsers keep
running the previously cached build after a deploy. -->
<link rel="stylesheet" href="css/main.css?v=2026-07-25-2">
</head>
<body>
@@ -601,6 +604,6 @@
</div>
</div>
<script src="js/app.js"></script>
<script src="js/app.js?v=2026-07-25-2"></script>
</body>
</html>