Modern Auth Lab is a progressive security project for exploring modern web authentication with PHP, vanilla JavaScript, TOTP, Passkeys/WebAuthn, controlled MFA fallback strategies, tests, coverage, mutation testing, and CI/CD.
The project is intentionally built step by step. It starts with a small framework-free foundation before adding authentication behavior.
Implemented foundation:
- Agent development rules.
- Project roadmap and security documentation.
- PHP 8.5 backend tooling with Composer.
- PHPUnit, PHPStan, and PHP CS Fixer.
- Vite frontend tooling with vanilla JavaScript.
- Vitest, V8 coverage, ESLint, and Prettier.
- Minimal PHP HTTP foundation with
public/as the web root. GET /healthdiagnostic route.- Server-side session primitives and explicit authentication session states.
- CSRF token primitives for future session-backed forms and unsafe requests.
- SQLite persistence foundation with migration tracking.
- User persistence schema, repository, password hashing, and password verification workflow.
- Minimal password login form with CSRF validation.
- Password-only full session login for the current pre-MFA milestone.
- Protected
/accountroute. - CSRF-protected logout.
- Initial session-backed login rate limiting.
- SQLite-backed basic security events.
Not implemented yet:
- CSRF middleware.
- TOTP.
- Passkeys/WebAuthn.
- Trusted devices.
- Recovery flows.
- User-facing SQLite/libSQL persistence features.
- CI/CD.
- PHP 8.5+
- Composer 2+
- Node.js 22+
- npm 10+
- SQLite PDO extension
Install backend dependencies:
composer installInstall frontend dependencies:
npm installStart the PHP development server:
composer serveHealth check:
curl http://127.0.0.1:8080/healthRun backend checks:
composer test
composer analyse
composer cs:checkCreate a local development user:
composer seed:dev-userDevelopment credentials:
Email: dev@example.com
Password: DevPassword123!
Login page:
http://127.0.0.1:8080/login
Protected account page:
http://127.0.0.1:8080/account
Start the Vite development server:
npm run devRun frontend checks:
npm run build
npm test
npm run coverage
npm run lint
npm run formatassets/ Frontend JavaScript and CSS
docs/ Roadmap, security notes, architecture notes, and decisions
public/ Public web root
src/ PHP application source
tests/ Backend and frontend tests
Security-sensitive decisions must remain server-side. Frontend code may improve user experience, but it must not decide authentication, authorization, MFA fallback eligibility, recovery state, or trusted-device policy.
Authentication will be modeled as explicit states. Partial authentication must not be treated as a full authenticated session.
Start with:
- Roadmap
- Architecture
- Security model
- Authentication flows
- Passkeys and WebAuthn
- Fallback strategy
- Security concepts
- TOTP concept note
- v0.5.0 TOTP foundation implementation notes
- Decision records
main represents the latest project version. Stable milestones are preserved with Git tags and GitHub releases.