Skip to content

feat(oauth2,audit): RFC 9126 PAR, RFC 7523 private_key_jwt, and dashboard failures_today 24h filter - #399

Merged
voidvec merged 2 commits into
masterfrom
feat/par-private-key-jwt-and-dashboard-fix
Dec 2, 2026
Merged

voidvec merged 2 commits into
masterfrom
feat/par-private-key-jwt-and-dashboard-fix

Conversation

@voidvec

@voidvec voidvec commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • fix(audit): Apply 24h time filter to dashboard failures_today metric (AuditService::getDashboardStats) with integration test coverage.
  • feat(oauth2): Implement RFC 9126 Pushed Authorization Requests (PAR, POST /oauth2/par) and RFC 7523 private_key_jwt client authentication (RS256/ES256, kid routing, single-use JTI replay protection).
  • Add V047__par_and_private_key_jwt.sql migration, OpenAPI spec + fingerprint/route_manifest baselines, and regenerated Python/Go/TS SDKs.
  • Rebased onto latest origin/master (dbb83db2) and reconciled AuthorizationEndpointController, TokenEndpointController, DiscoveryController, and DiscoveryReconciliationHttpTest.

Verification

  • .\manage.ps1 build-backend (Windows MSVC Release): PASS
  • .\manage.ps1 test-backend (dual-config config.json + config.ci.json): 770/770 passed (0 failures)
  • Local gates (check_spec_governance.py, api_diff.py, migration_check.py, naming_validator.sh): PASS

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T08:20:48.058039Z e432ed6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +78 to +79
// RFC 7523 private_key_jwt: client public JWK Set JSON (inline jwks).
std::string jwksJson;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +258 to +261
nonce = pushed.nonce;
promptParam = pushed.prompt;
maxAgeParam = pushed.maxAge;
usedPar = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@voidvec
voidvec force-pushed the feat/par-private-key-jwt-and-dashboard-fix branch from e432ed6 to 265ee16 Compare December 2, 2026 10:52
- 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.
@voidvec
voidvec force-pushed the feat/par-private-key-jwt-and-dashboard-fix branch from 265ee16 to 0b0cbe4 Compare December 2, 2026 11:48
@voidvec
voidvec merged commit f8a2673 into master Dec 2, 2026
20 checks passed
@voidvec
voidvec deleted the feat/par-private-key-jwt-and-dashboard-fix branch December 2, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant