Skip to content

v3.4.0 — guided demo (--demo), PBKDF2 password hardening

Choose a tag to compare

@Abolfazlrwm Abolfazlrwm released this 22 Nov 18:58
· 16 commits to main since this release

Two heads this release: a guided demo that makes the product explain itself, and a hardening of password storage.

Added

  • Guided demo (--demo) — the binary now explains itself: one narrated, self-playing walkthrough of a full shift (book → change-a-booking → deliver → late return with penalty → manager income & monthly reports), built on the same readLine() a human types into. Dates derive from today's clock so the booking is always fresh; the fleet is fresh and in-memory, so ./data is never read or written; narration banners separate the beats. One implementation serves desktop and browser (thread sleep vs Asyncify sleep), and the demo page grows a ▶ Auto-play demo button that starts the program with the same flag. CI plays the demo on every push — which also locks the script to the menus (any drift fails the build).
  • docs/DESIGN.md — why each data structure was chosen and the complexity trade-offs behind them.

Security

  • Password storage upgraded from SHA256(salt + password) to PBKDF2-HMAC-SHA256 (RFC 2898) over 100,000 iterations, built on the repo's own SHA-256 primitive (HMAC per RFC 2104) — no new dependencies.
  • The per-user salt is now 16 raw bytes from the OS CSPRNG (std::random_device), hex encoded; the old code seeded an mt19937_64 generator from it, which is not CSPRNG output.
  • verifyPassword uses a byte-wise constant-time comparison.
  • Known-answer vectors (independently computed with Python hashlib.pbkdf2_hmac) pin the derivation in the test suite.
  • Migration note: rows in users.csv written by older versions used the single-hash format and will no longer verify; reset those passwords (they re-derive on next setPassword).

Fixed

  • CI: clang-format cleanups at the new SHA-256 call sites; the gcovr coverage job tolerates suspicious-hit quirks so coverage stays green.
  • The suite lowers the PBKDF2 iteration count through a clamped test hook (User::setIterationsForTesting) — its hundreds of login attempts no longer run at the production 100,000 iterations, taking the AddressSanitizer job from ~30 minutes back to seconds; the constant-time comparison also no longer reads past the shorter string's bytes.
  • The GitHub Pages deploy now rebuilds the embedded WebAssembly demo binary at deploy time (emsdk, make wasm) and triggers on source changes, so the live demo — including the ▶ Auto-play button — always runs the current HEAD, never a stale bundle.

Suite: 5,476 checks, 0 failures · Coverage: 92% line coverage · Try it: ./car_rental --demo — or press ▶ Auto-play on the live demo.

Full changelog: https://github.com/Abolfazlrwm/Car-Rental-System/blob/main/CHANGELOG.md