Skip to content

Protect Driver accounts with safe password reset links - #412

Open
OziinG wants to merge 1 commit into
mainfrom
codex/driver-password-reset
Open

Protect Driver accounts with safe password reset links#412
OziinG wants to merge 1 commit into
mainfrom
codex/driver-password-reset

Conversation

@OziinG

@OziinG OziinG commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Driver operators currently have to delete and recreate an account when they forget a password, which can disable existing DSV driver and vehicle assignments. This change adds a DriverAccount-only recovery contract using administrator-issued, 30-minute one-time links while preserving every driver, route, dispatch, and vehicle relationship.

The reset token is stored only as a SHA-256 hash, older pending links are revoked, issue/validate/complete requests are limited, and public responses disclose no account identity. Completion rotates the scrypt hash and salt, clears password lockout, increments account and linked-driver token versions, revokes account and legacy driver sessions, and writes PII-redacted audit events. Login and refresh use the same account lock as reset so concurrent old credentials cannot create or revive a valid session. No SMS provider was found, so the documented contract uses ADMIN_LINK and performs no SMS delivery.

Validation:

  • Prisma generate and schema validate
  • ESLint and TypeScript typecheck
  • Full delivery-api suite: 2351 passed, 127 intentionally skipped DB profiles
  • Disposable PostgreSQL: all 106 migrations plus expiry, reissue revocation, concurrent one-time consumption, replay prevention, login lockout, login/reset race, session invalidation, audit redaction, and relationship preservation
  • Delivery API build

No production deployment or real SMS was performed.

@gitguardian

gitguardian Bot commented Sep 10, 2026

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@OziinG
OziinG force-pushed the codex/driver-password-reset branch from fded3b4 to a042feb Compare September 10, 2026 07:27
Constraint: Driver resets must preserve driver, route, and vehicle relationships and cannot use unverified identity fields.
Rejected: Name and phone reset | It does not prove control of the account.
Confidence: high
Scope-risk: moderate
Directive: Keep DriverAccount reset persistence separate from CustomerAccount invitations.
Tested: Prisma generate and validate; full lint, typecheck, tests, build; disposable PostgreSQL migration, concurrency, lockout, and session invalidation integration.
Not-tested: SMS delivery and production deployment were intentionally not run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant