Repository navigation
feat(auth)!: split auth, roles and claims config; strict config - #92
Merged
Merged
Conversation
Identity configuration moves from rls/rls.auth to auth (mode, jwt, headers, mint_type), roles (switch, anonymous, default, allowed) and claims (prefix, json_setting). Headers mode requires trusted_proxies, an empty roles.anonymous refuses unauthenticated requests with 401 and a WWW-Authenticate challenge (new auth_required code), and the claims prefix defaults to jwt.claims, with an optional JSON claims setting for PostgREST-style policies. Config loading is strict: unknown keys fail with a moved-to or did-you-mean hint, plugin names are snake_case, plugin settings are typed and decoded from env too, and log.format is validated. The statement timeout defaults below the request timeout, the CLI loads on default config, CORS exposes the response headers pdbr sends, and cardinality violations (class 21) are client errors. BREAKING CHANGE: rls.* keys, kebab-case plugin names and the pdbq.claims prefix are replaced; see docs/upgrading.md.
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.
Pre-1.0 config and security contract changes (readiness review B1, B2, B3 and the shared bugs; pdbcore issues 76, 77, 78 and 80) for pdbr. Depends on suprbdev/pdbcore#83 (go.mod pins its commit; switched to the tag after it merges).
Config shape
Breaking changes (before → after)
rls.enabledroles.switch(false still verifies credentials; setauth.mode: nonefor no auth)rls.anonymous_role(defaultanonymous)roles.anonymous(default empty → 401)rls.default_role/rls.allowed_rolesroles.default/roles.allowedrls.role_claimauth.jwt.role_claim_path/auth.headers.role_claimrls.claims_prefix(pdbq.claims)claims.prefix(jwt.claims)rls.auth.*auth.mode,auth.jwt.*,auth.headers.*,auth.mint_typePDBR_RLS_*PDBR_AUTH_*/PDBR_ROLES_*/PDBR_CLAIMS_*smart_comments,advanced_filters,nested_mutations, …)database.statement_timeout30sOther changes
auth_required; cardinality violations (SQLSTATE class 21) are 400 instead of 500.Content-Range,Link,X-Total-Count,ETag,Preference-Applied,Location, …) and no longer overwritesVary.pdbr request,schema dump/checkandplugins listload on default config (auth.mode: none, connection role).Tested: race, vet, lint, e2e on PostGIS 18 and 14 (
-p 1), FuzzFilter/FuzzParse/FuzzSpatial/FuzzSplitEnvelope 10s each.