Repository navigation
Add opt-in EdDSA (Ed25519) support; harden cache completion and GUC prefix - #5
Merged
Merged
Conversation
…refix complete_refresh returned false for invalid ttl/payload arguments without clearing the refreshing flag, which would have left the entry in progress for every backend until restart. It is unreachable today because the issuer-key layer rejects oversized responses before a refresh starts, but the invariant should not depend on that. A rejected completion now releases ownership and counts as a failure. Reserve the pg_oauth_validator GUC prefix after all definitions so a misspelled setting is reported instead of silently ignored. Document minor-release rebuilds and that playground files are not production configuration. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Accept `EdDSA` as a third allowed algorithm. The default allowlist stays `RS256,ES256`; an administrator must list `EdDSA` explicitly, so upgrading changes no existing deployment's accepted tokens. Ed25519 only: the token header must be exactly `EdDSA` and the selected JWK must be kty=OKP, crv=Ed25519, alg=EdDSA with a 32-byte key. Ed448, X25519, wrong-length keys, private-key material, and the RFC 9864 fully-specified names are rejected before the key reaches libjwt. Key selection rules are unchanged, and a JWKS that also publishes other keys remains valid. Adds unit, signature, fuzz, and PostgreSQL integration coverage, ADR 0003, and the spec/configuration updates. Not run: PostgreSQL 19, static analysis, sanitizer builds. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
proddata
force-pushed
the
eddsa-and-cache-hardening
branch
from
October 1, 2026 21:13
6528374 to
f103076
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent changes, kept as separate commits so each can be reviewed on its own:
e09aaa3): release cache refresh ownership when a completion is rejected; reserve the GUC prefix.6528374): addEdDSAas a third allowed signing algorithm. Decision record: ADR 0003 (statusProposed, needs review).No release, version bump, or tag is part of this PR. Release work stays under REL-01.
EdDSA: requirement and threat model
Some authorization servers sign access tokens with Ed25519 by default (JWKs of type
OKP,alg: "EdDSA"). Without this change they can only be used by downgrading every PostgreSQL client to RSA.algmust be exactlyEdDSA; the selected JWK must bekty=OKP,crv=Ed25519,alg=EdDSA,use=sig/key_ops=[verify], a 32-bytex, and no private members. Ed448, X25519, wrong-length keys, mismatched/missing JWKalg, case variants, and the RFC 9864Ed25519name are rejected. The curve is pinned in this project's code, not inherited from libjwt. AnEdDSAtoken cannot select an RSA/EC key, and vice versa.pg_oauth_validator.allowed_algorithmsstill defaults toRS256,ES256, so existing deployments accept exactly what they did before. Enable with e.g.'RS256,EdDSA'.EdDSAfrom the setting and reload. Downgrading the module whileEdDSAis listed fails closed (earlier modules reject the unknown entry as invalid configuration).EdDSAname in favor ofEd25519/Ed448. Deployed issuers still emitEdDSA; supporting the new name is a recorded follow-up.Tests and commands run
All in the pinned PostgreSQL 18 container (
compose.test.yml), on each commit's final tree:dev-verify-pg18(unit/component gate): pass, including new JWK, policy, token-header, and signature negative/boundary cases (a genuine Ed25519 signature verifies; wrong key, tampered payload, tampered signature are rejected).dev-integration-pg18(real server, non-slow): 18 passed, 2 skipped (existing pg19-only tests). New test: EdDSA denied by default, accepted after opt-in, algorithm-relabelling and wrong-kidtokens denied, EdDSA-only allowlist denies RSA tokens, no token in logs or client errors.fuzz-jwks/fuzz-jwt-envelope: 2000 runs each, clean; targets now exercise EdDSA with a valid seed.scripts/format-c.sh --check(pinned pgindent): pass.Not run / remaining risks
docs/operations.mdsample config still shows the default'RS256,ES256', which remains correct.🤖 Generated with Claude Code