mirror of
https://github.com/azaion/annotations.git
synced 2026-06-21 18:51:06 +00:00
03f879206e
This commit captures everything produced during autodev existing-code Steps 1 (Document), 2 (Architecture Baseline Scan), and 3 (Test Spec), together with the targeted auth + CORS re-sync triggered on 2026-05-14 when codebase drift was detected at Step 4 entry. None of this work was previously committed. Step 1 (Document) — 50+ _docs/02_document/ files: problem, solution, architecture, system flows, glossary, module-layout, per-component specs (01..06), modules, deployment, diagrams, data model, FINAL report, verification log, discovery. Step 2 (Architecture Baseline) — architecture_compliance_baseline.md. Verdict PASS_WITH_WARNINGS (0 Critical, 0 High, 1 Medium, 2 Low). No High/Critical findings; auto-chained to Step 3 per existing-code flow. Step 3 (Test Spec) — _docs/02_document/tests/* (67 scenarios across blackbox, security, resilience, resource-limit, performance), plus e2e/docker-compose.test.yml, e2e/seed/run.sh, scripts/run-tests.sh, scripts/run-performance-tests.sh. Coverage 88% over the active scope (40 of 45 items covered, 6 RB-deferred, 5 documented-as-uncovered). Targeted auth + CORS re-sync — replaces the deleted in-house token issuer with a JWKS-verifier model. AuthController and TokenService removed; JwtExtensions switched from HS256 symmetric to ES256 over admin's JWKS. ConfigurationResolver and CorsConfigurationValidator added under src/Infrastructure/. ADR-002 and ADR-006 retired; SEC-01, SEC-02, SEC-03 marked Closed. One new testability risk recorded in architecture.md Open Risks Section 6 (JWKS HTTPS gating). Source changes: - src/Auth/JwtExtensions.cs (modified) — ES256, JWKS, alg pinning - src/Program.cs (modified) — DI wiring for ConfigurationResolver and CorsConfigurationValidator - src/Controllers/AuthController.cs (deleted) — no in-service issuance - src/Services/TokenService.cs (deleted) — same - src/Infrastructure/ConfigurationResolver.cs (new) - src/Infrastructure/CorsConfigurationValidator.cs (new) - .env.example (new) — required env var documentation - .gitignore (updated) Cross-repo coordination: _docs/cross-repo/flights_h1_h2_h3_change_spec captures the change-spec for downstream services that consumed the now deleted /auth endpoints. Co-authored-by: Cursor <cursoragent@cursor.com>
2.4 KiB
2.4 KiB
Module: Auth & identity
Purpose
JWT validation for API policies. Tokens are minted exclusively by the admin service (ES256-signed); annotations is a verifier only.
Components
JwtExtensions (Auth/JwtExtensions.cs)
AddJwtAuth(IConfiguration)— pullsJWT_ISSUER,JWT_AUDIENCE,JWT_JWKS_URLviaConfigurationResolver.ResolveRequiredOrThrow(fail-fast at startup if any is missing).TokenValidationParametersmirrors admin's verifier contract:ValidateIssuer = true/ValidateAudience = true/ValidateLifetime = true.ValidAlgorithms = [SecurityAlgorithms.EcdsaSha256]— pinned so an HS256-forgery using the public key as the HMAC secret cannot pass.RequireSignedTokens = true,RequireExpirationTime = true.ClockSkew = 30s.
- Signing keys are fetched from admin's
/.well-known/jwks.jsonvia aConfigurationManager<JsonWebKeySet>backed by a minimalIConfigurationRetriever<JsonWebKeySet>(admin exposes JWKS but not the full OIDC discovery document). The manager honours admin'sCache-Control: public, max-age=3600and refreshes on the default schedule. During key rotation bothkids are present in JWKS so in-flight tokens still verify. - Policies:
ANN,DATASET,ADM— each requires claimpermissionswith that code (matches suite "Required permission: ANN" and Dataset ExplorerDATASET).
Dependencies
Configuration (all required, no defaults):
JWT_ISSUER(altJwt:Issuer) — must match admin'sJwtConfig:Issuer.JWT_AUDIENCE(altJwt:Audience) — must match admin'sJwtConfig:Audience.JWT_JWKS_URL(altJwt:JwksUrl) —https://admin.azaion.com/.well-known/jwks.jsonin production.
Consumers
All [Authorize] controllers.
Removed in this cycle
Services/TokenService.cs(HS256 minting of access tokens from refresh tokens) — deleted; refresh is now the admin service's responsibility (POST /token/refresh).Controllers/AuthController.csand thePOST /auth/refreshendpoint — deleted along withTokenService. Detections (and any other client) must call admin's refresh endpoint and pass the returned access token to annotations.JWT_SECRETenv var — no longer read.
Suite doc
01_annotations.md §Annotation Sync (verifier role); suite 10_auth.md for full auth story (admin = issuer, satellite-provider / annotations / flights / ui = verifiers).