Commit Graph
78 Commits
Author SHA1 Message Date
Hamza-Ayed ec467b01c6 Update: 2026-08-03 11:52:03 2026-08-03 11:52:03 +03:00
Hamza-Ayed 2b9f696372 Update: 2026-08-03 00:20:40 2026-08-03 00:20:40 +03:00
Hamza-Ayed 4620e84d34 Update: 2026-08-02 17:52:28 2026-08-02 17:52:28 +03:00
Hamza-Ayed 7a576b7327 Update: 2026-07-30 12:31:26 2026-07-30 12:31:27 +03:00
Hamza-Ayed 2bacb1b9e1 تحديث شامل للوحة التحكم وإضافة كافة الميزات للـ WebSidebar 2026-07-26 03:22:47 +03:00
Hamza-AyedandClaude Opus 5 a1c19b052d Make OTP verification independent of the encryption mode
The verification tables (token_verification*, phone_verification*) use the
phone number as a lookup key: written when the code is sent, read when it is
checked. Storing it encrypted worked only because encryptData() is
deterministic — under AES-GCM the two sides would produce different
ciphertexts and no code would ever verify, locking every user out of
registration and OTP sign-in.

otpPhoneKey() stores a keyed HMAC of the normalised number instead. No schema
change is needed since the column is textual, local and international formats
now resolve to the same key, and the value cannot be reversed without the
pepper. It falls back to the previous behaviour when no pepper is configured.

Applied to both sides of every affected flow — request/verify, and the driver
and passenger send/verify pairs — including the OTP value itself where it is
compared by equality rather than decrypted. auth/otp/verify.php already
decrypts the token before comparing, so it needed no change there.

Also adds ENCRYPTION_MODE to EncryptionHelper: encryptData() writes GCM when
set to 'gcm', CBC otherwise. Verified in both directions — rows written under
CBC stay readable after switching, and rows written under GCM stay readable
after rolling back — so the switch is reversible by an environment variable.

The admin console's own OTP is unaffected: it keys the table by the stored
ciphertext read from adminUser, identical on both sides.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 16:18:16 +03:00
Hamza-AyedandClaude Opus 5 761b957c96 Silence REQUEST_METHOD warning when bootstrap runs from the CLI
The migration and backfill scripts load bootstrap.php outside a request, where
$_SERVER['REQUEST_METHOD'] does not exist, so every CLI run printed a warning
before its output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 15:55:18 +03:00
Hamza-AyedandClaude Opus 5 6802026dbd Add blind-index search layer; fix captain detail 200-with-empty-body
Searching encrypted columns currently works only because encryptData() is
AES-CBC with a fixed IV, i.e. deterministic. That determinism is what leaks
equality and shared prefixes, and it is why moving storage to AES-GCM would
break every lookup. This separates the two concerns.

- core/Security/BlindIndex.php: HMAC-SHA256 over a normalised value, keyed by
  a secret pepper. Phone numbers have a small keyspace, so a bare SHA-256
  would be reversible by enumeration; the pepper lives in the environment, not
  the database. The scope string includes table and field so the same number
  does not produce a matching index across tables.
  Normalisation unifies local/international phone forms, lowercases emails and
  folds Arabic alef/ya/ta-marbuta and diacritics for names.
- migrations/: nullable *_bidx columns plus indexes, and the missing
  adminUser.status/approved_by/approved_at columns that admin approvals need.
- scripts/backfill_blind_index.php: restartable, batched, --dry-run capable,
  touches only index columns.
- Admin lookups by phone/email now match the index, keeping the old ciphertext
  comparison in the same query so search keeps working until the backfill runs.
  bootstrap exposes $blindIndex as null when no pepper is configured.

Also: AdminCaptain/getCaptainDetailsById.php selected driver.education, a
column absent from this schema. The PDOException was uncaught, so the client
received an empty body with HTTP 200 — the "non-JSON response" seen when
opening a captain. It now omits the column, catches the error, reports it as
JSON, and requires an admin role.

Console: opening any sidebar section refetches its data instead of showing
what was loaded when the console started.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 15:16:09 +03:00
Hamza-Ayed 695d6d7cb2 Update: 2026-07-23 21:18:25 2026-07-23 21:18:25 +03:00
Hamza-Ayed 7d646b579b Update: 2026-07-23 21:02:51 2026-07-23 21:02:51 +03:00
Hamza-Ayed 1e785061ec Fix decryptData null type error and live analytics overflow 2026-07-23 20:42:48 +03:00
Hamza-Ayed c35b350b31 Update: 2026-07-23 16:56:57 2026-07-23 16:56:58 +03:00
Hamza-Ayed b9efba3787 Update: 2026-07-22 18:32:11 2026-07-22 18:32:11 +03:00
Hamza-Ayed 55fbe22f8e Update: 2026-07-22 18:23:10 2026-07-22 18:23:10 +03:00
Hamza-Ayed 8ec0ac2942 Update: 2026-07-22 01:35:37 2026-07-22 01:35:37 +03:00
Hamza-Ayed 11d7d86b2f Update: 2026-07-22 01:06:03 2026-07-22 01:06:03 +03:00
Hamza-Ayed a4b5a2545c Update: 2026-07-22 01:04:56 2026-07-22 01:04:57 +03:00
Hamza-Ayed be14b2716e Update: 2026-07-22 01:01:26 2026-07-22 01:01:26 +03:00
Hamza-Ayed 9a73f4303d Update: 2026-07-22 00:55:45 2026-07-22 00:55:45 +03:00
Hamza-Ayed bbcefd20cf Update: 2026-07-22 00:52:19 2026-07-22 00:52:20 +03:00
Hamza-Ayed 085b180bdb feat: implement secure OTP-based payout workflow with dynamic fee calculation and improved authentication checks 2026-07-19 01:51:39 +03:00
Hamza-Ayed 034d64b6f2 Update: 2026-07-16 23:19:11 2026-07-16 23:19:11 +03:00
Hamza-Ayed 24fb56f08f Update: 2026-07-12 05:40:28 2026-07-12 05:40:28 +03:00
Hamza-Ayed 83f5bf516b feat: add Nabeh payment verification proxy and update UI components 2026-07-11 22:14:37 +03:00
Hamza-Ayed 87dc925ea7 Refactor(Auth): Complete auth folder restructuring, security patches, and Flutter endpoint updates 2026-07-09 05:22:05 +03:00
Hamza-Ayed a526dae042 Update: 2026-07-09 04:13:14 2026-07-09 04:13:14 +03:00
Hamza-Ayed 70718946f5 Update: 2026-07-09 03:41:48 2026-07-09 03:41:48 +03:00
Hamza-Ayed 21877153eb feat: harden backend security with HMAC verification, SSL validation, and documentation updates while removing legacy scripts. 2026-07-08 22:10:01 +03:00
Hamza-Ayed 4d16fbda48 Update: 2026-07-06 01:20:19 2026-07-06 01:20:19 +03:00
Hamza-Ayed ccf7dc99ee Update: 2026-07-06 01:18:35 2026-07-06 01:18:36 +03:00
Hamza-Ayed 1b67c5e8fc Update: 2026-07-06 01:01:29 2026-07-06 01:01:30 +03:00
Hamza-Ayed d00502769a Update: 2026-07-06 00:53:15 2026-07-06 00:53:15 +03:00
Hamza-Ayed 40ffcabc91 Update: 2026-07-05 18:46:09 2026-07-05 18:46:09 +03:00
Hamza-Ayed 9b0f0de1ce Update: 2026-07-05 18:16:24 2026-07-05 18:16:24 +03:00
Hamza-Ayed 2a5cd2cfbc Update: 2026-07-05 17:53:37 2026-07-05 17:53:37 +03:00
Hamza-Ayed d7f723c735 Update: 2026-07-05 17:49:26 2026-07-05 17:49:26 +03:00
Hamza-Ayed 01652eed8b Update: 2026-07-05 01:40:01 2026-07-05 01:40:02 +03:00
Hamza-Ayed 5cf809e0cb Update: 2026-07-05 00:21:29 2026-07-05 00:21:29 +03:00
Hamza-Ayed 5f2aa84101 Update: 2026-07-04 21:58:03 2026-07-04 21:58:04 +03:00
Hamza-Ayed 90fbe0ade8 Update: 2026-07-04 21:56:02 2026-07-04 21:56:02 +03:00
Hamza-Ayed ce7db27936 Update: 2026-07-04 21:38:44 2026-07-04 21:38:44 +03:00
Hamza-Ayed 8ae6a2e2da Update: 2026-07-04 15:39:18 2026-07-04 15:39:18 +03:00
Hamza-Ayed 2adf195b36 Update: 2026-07-02 05:56:57 2026-07-02 05:56:57 +03:00
Hamza-Ayed 05d047d871 Update: 2026-07-02 05:27:04 2026-07-02 05:27:05 +03:00
Hamza-Ayed d2ce4bdb16 Update: 2026-06-30 23:32:14 2026-06-30 23:32:15 +03:00
Hamza-Ayed 26ae0124c8 Update: 2026-06-30 22:43:38 2026-06-30 22:43:38 +03:00
Hamza-Ayed 1b5d6eae44 Simplify APNs payload for iOS visible notifications and fetch latest token 2026-06-30 22:13:45 +03:00
Hamza-Ayed 772f8b647d Update: 2026-06-30 22:10:05 2026-06-30 22:10:05 +03:00
Hamza-Ayed 9a296742f1 Fix APNs push type for visible notifications on iOS 2026-06-30 22:09:27 +03:00
Hamza-Ayed 116e3fad22 Fix env variable name for service account file to fix 'No access token' error 2026-06-30 22:06:57 +03:00