Julien Gautier c30b663c51
CI / commits (pull_request) Successful in 2m35s
CI / scan (pull_request) Successful in 2m46s
CI / check (pull_request) Successful in 3m10s
CI / a11y (pull_request) Successful in 1m29s
CI / perf (pull_request) Successful in 6m17s
feat(portal-bff): admin module + role guard + /api/admin/me self-test
Lays the foundation for the `/api/admin/*` surface per ADR-0020.
This PR ships the guard, the `@RequireAdmin()` decorator, and a
self-test endpoint — no business routes yet.

- `AdminRoleGuard` (apps/portal-bff/src/admin/admin-role.guard.ts):
  - No session → 401 (no audit; unauthenticated probes are noise).
  - Session but `roles` lacks `admin` → 403 + `admin.access_denied`
    audit row capturing actor hash, attempted route, and roles held.
  - Session with `admin` → pass through.
  - Audit-write failures propagate (no audit ⇒ no action,
    consistent with the existing call sites in AuthController).

- `@RequireAdmin()` decorator wraps `@UseGuards(AdminRoleGuard)`
  via `applyDecorators` so future composition (e.g. with the
  upcoming `@RequireMfa()` for the admin entry route) is mechanical.

- `GET /api/admin/me` returns the public user payload + `roles` for
  ops to verify the gate is wired correctly end-to-end. The handler
  intentionally has no logic beyond the projection — the value of
  the endpoint is the guard chain it forces traffic through.

- `AuditWriter.adminAccessDenied()` typed method keeps the salt
  inside the audit module and matches the pattern of the existing
  typed events. Uses the pre-existing `denied` outcome enum value.

Surface impact:
- No new env vars, no new dependencies.
- The shared portal-shell session is the auth source for this PR.
  The distinct `__Host-portal_admin_session` cookie + admin auth
  flow land in the next PR per the chantier sequence.

Tests: +11 specs (7 guard, 2 controller, 2 typed audit method).
2026-05-14 00:43:53 +02:00

Documentation index

This is the entry point to all project documentation. It is maintained automatically: any addition, rename, or removal of a .md file under docs/ must be reflected here in the same change.

Conventions

  • Documentation is written in English.
  • One topic per file. Group related files into a folder when there are three or more.
  • Cross-reference with relative links so they keep working in GitHub, IDEs, and exported sites.
  • For architectural decisions, do not add them here — they belong in decisions/ as MADR 4.0.0 ADRs.

Sections

Daily development

  • development.md — repo layout, prerequisites, initial setup, daily commands, observability dev-loop (Jaeger UI, log ↔ trace correlation), dependency updates (Renovate), conventional commit cycle. Day-to-day reference for working on the project.

Architecture

  • architecture.md — cross-cutting Mermaid diagrams: C4 system context, C4 containers, Nx module boundaries, CI/CD pipeline. Single-decision diagrams (auth sequence, ERD, etc.) live inline in their ADR.

Onboarding & environment

Setup guides for new contributors:

Operations & runbooks

Empty — to be populated when we deploy.

Security, performance, accessibility

Empty — placeholders to be filled with rationale docs alongside their corresponding ADRs.

S
Description
No description provided
Readme 42 MiB
Languages
TypeScript 85.3%
JavaScript 5.4%
SCSS 4.3%
HTML 3.9%
Shell 0.8%
Other 0.3%