Repository navigation
feat(oauth2,audit): RFC 9126 PAR, RFC 7523 private_key_jwt, and dashboard failures_today 24h filter - #399
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e432ed616c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // RFC 7523 private_key_jwt: client public JWK Set JSON (inline jwks). | ||
| std::string jwksJson; |
There was a problem hiding this comment.
Load registered client JWKS in the PostgreSQL repository
With the production PostgreSQL backend, every private_key_jwt authentication fails with missing_client_keys, even if oauth2_clients.jwks contains a valid key set. PostgresClientRepository::getClient() never populates the new jwksJson field; the repository-wide search shows that only MemoryClientRepository populates it. Wire the migrated column through the PostgreSQL model/repository before advertising this authentication method for production.
Useful? React with 👍 / 👎.
| continueWithRedirectValidation = std::move(continueWithRedirectValidation)]( | ||
| std::optional<fulla::oauth2::model::OAuth2Client> client | ||
| ) mutable { | ||
| if (client && client->requirePushedAuthorizationRequests) |
There was a problem hiding this comment.
Load the persisted PAR requirement before enforcing it
For PostgreSQL clients configured with require_pushed_authorization_requests = TRUE, this check still permits ordinary authorization requests. PostgresClientRepository::getClient() does not read the new column, so the DTO always retains its default false; only the memory configuration loader sets this field. Populate the persisted policy in the PostgreSQL repository so production clients cannot bypass their configured PAR requirement.
Useful? React with 👍 / 👎.
| nonce = pushed.nonce; | ||
| promptParam = pushed.prompt; | ||
| maxAgeParam = pushed.maxAge; | ||
| usedPar = true; |
There was a problem hiding this comment.
Restore the pushed organization context during authorization
When a PAR request includes org_id, consuming its handle restores the other authorization parameters but never restores pushed.orgId. The existing login redirects and organization gate still read req->getParameter("org_id") (including the dispatch around line 1194), so the normal client_id plus request_uri authorization URL silently loses the organization binding. An additional front-channel org_id can also replace the pushed value. Thread the stored organization hint through those branches instead of reading it from the authorization URL.
Useful? React with 👍 / 👎.
| ); | ||
| tokenService_->setJwkManager(jwkManager_); | ||
| clientAssertionVerifier_ = std::make_shared<fulla::oauth2::protocol::ClientAssertionVerifier>(); | ||
| parService_ = std::make_shared<fulla::oauth2::protocol::ParService>(cryptoProvider); |
There was a problem hiding this comment.
Inject a shared PAR store for persistent deployments
With multiple backend replicas, a successful PAR POST on one replica produces a handle that another replica rejects as invalid_request_uri. This construction always selects MemoryParStore, even for PostgreSQL storage, and no other IParStore implementation is wired anywhere in the repository. The Helm backend deployment supports multiple replicas through backend.replicaCount, so the back-channel POST and browser authorization request need not reach the same process. Inject a shared store with atomic consumption for persistent deployments.
Useful? React with 👍 / 👎.
| issuer | ||
| ); | ||
| tokenService_->setJwkManager(jwkManager_); | ||
| clientAssertionVerifier_ = std::make_shared<fulla::oauth2::protocol::ClientAssertionVerifier>(); |
There was a problem hiding this comment.
Share assertion replay protection across backend replicas
When multiple backend replicas serve a client, the same signed client assertion can authenticate once on each replica because this default constructor creates a process-local MemoryJtiReplayCache. All token, introspection, revocation, and PAR handlers rely on this verifier for single-use JTI protection, but no shared replay-cache implementation is injected. In the multi-replica configuration supported by the Helm backend deployment, replay protection therefore does not hold across requests routed to different pods. Use a shared atomic reservation with expiry for persistent deployments.
Useful? React with 👍 / 👎.
e432ed6 to
265ee16
Compare
- Domain layer (libs/oauth2): - Add ClientAssertionVerifier (RS256/ES256, kid routing, strict iss/sub/aud/exp/nbf/iat/jti + single-use JTI replay protection). - Add ParService (RFC 9126 PAR createRequest + atomic single-use client-bound consumeRequest, PKCE S256 enforcement). - Add OAuth2Client::jwksJson and requirePushedAuthorizationRequests fields and TokenService::exchangeCodeForAuthenticatedClient (purely ADDITIVE). - Adapter, routing, schema & SDKs: - Add V047__par_and_private_key_jwt.sql migration + baseline. - Wire private_key_jwt across /oauth2/token (all grants), /oauth2/introspect, /oauth2/revoke, and /oauth2/par. - Register POST /oauth2/par route, OpenAPI spec + fingerprint baseline, route_manifest golden snapshot, and regenerated Python/Go/TS SDKs. - Wire PAR request_uri consumption and require_pushed_authorization_requests enforcement in AuthorizationEndpointController. - Advertise private_key_jwt, signing algs (RS256/ES256), and PAR metadata in DiscoveryController and respect injected plugin in scopesSupportedAsync. - Tests: - Add Domain GTests (ClientAssertionVerifierTest, ParServiceTest) and Drogon integration tests (EnterpriseParPrivateKeyJwtTest). - Update DiscoveryReconciliationHttpTest kAuthMethods to include private_key_jwt.
265ee16 to
0b0cbe4
Compare
Summary
failures_todaymetric (AuditService::getDashboardStats) with integration test coverage.POST /oauth2/par) and RFC 7523private_key_jwtclient authentication (RS256/ES256,kidrouting, single-use JTI replay protection).V047__par_and_private_key_jwt.sqlmigration, OpenAPI spec + fingerprint/route_manifest baselines, and regenerated Python/Go/TS SDKs.origin/master(dbb83db2) and reconciledAuthorizationEndpointController,TokenEndpointController,DiscoveryController, andDiscoveryReconciliationHttpTest.Verification
.\manage.ps1 build-backend(Windows MSVC Release): PASS.\manage.ps1 test-backend(dual-configconfig.json+config.ci.json): 770/770 passed (0 failures)check_spec_governance.py,api_diff.py,migration_check.py,naming_validator.sh): PASS