Skip to content

fix: Overlapping-route auth compares identity, not spelling (#221) - #227

Closed
jrosskopf wants to merge 2 commits into
mainfrom
fix/gh-221-overlap-auth
Closed

jrosskopf wants to merge 2 commits into
mainfrom
fix/gh-221-overlap-auth

Conversation

@jrosskopf

@jrosskopf jrosskopf commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Overlap auth comparison now asks who gets in, not how the block is spelled: a plaintext password and a hash of it are one user (verified with PasswordHasher); an OIDC provider preset equals its spelled-out issuer-url (preset applied before comparing).
  • Three-level overlaps are judged against the endpoint that actually answers: protected /a/:x/:y, open /a/b/:y (allow-shadowing) and open /a/b/c now start, because /a/b/:y already serves /a/b/c open. The covering route must be loaded/created first (files load in path order).
  • flapi_create_endpoint never opts into shadowing: pinned by tests, documented in MCP_REFERENCE and CONFIG_REFERENCE.
  • Documented which OIDC keys are identity; email-claim, jwks-cache-hours, enable-client-credentials, enable-refresh-tokens are not.
  • EndpointRepository gets a shared_mutex (the getters have no callers outside tests, but ConfigManager writes it from several threads); fixed the false 'has its own locking' comment.

Known limits (fail closed)

  • Two PBKDF2 hashes of the same password with different salts cannot be proven equal (one-way hash), nor can bcrypt (not verifiable by flapi). They stay refused; docs say to reuse the same hash string or keep one side plaintext while migrating.

Test plan

  • test_route_precedence_auth.py / test_mcp_create_endpoint.py extended; red on the pre-fix binary (plaintext vs hash, OIDC preset, three-level), green after
  • Guard tests: different password, issuer, user, uncovered literal, re-salted hashes still refused
  • Catch2: routeCovers, hash/OIDC/three-level overlap, EndpointRepository concurrency; full flapi_tests green
  • Related config-service/auth integration tests green

Closes #221
Refs #198


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…e never shadows (red) (#221)

- Plaintext vs PBKDF2 hash of one password, OIDC preset vs spelled-out issuer, and
  an open literal under an allowed open middle route must start (refused today)
- Guards: different password/issuer/user, uncovered literal, unprovable re-salted hashes stay refused
- Pin that flapi_create_endpoint ignores allow-shadowing in any spelling
- A plaintext password and the hash of it are one user (verified); salted hashes
  of one password cannot be proven equal and stay refused
- OIDC is compared with the provider preset applied; email-claim, jwks-cache-hours,
  enable-client-credentials and enable-refresh-tokens are not identity
- An overlap is judged against the endpoint that actually answers: a literal
  covered by an equivalent-auth, allow-shadowing middle route needs no flag
- flapi_create_endpoint never opts into shadowing (pinned and documented)
- EndpointRepository takes a shared_mutex; the false locking comment is fixed
Refs #198
@jrosskopf

Copy link
Copy Markdown
Contributor Author

Superseded by #230 (combined and merged).

@jrosskopf jrosskopf closed this Nov 21, 2026
@jrosskopf
jrosskopf deleted the fix/gh-221-overlap-auth branch November 21, 2026 03:27
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.

Overlapping-route auth comparison: false positives and MCP opt-in

1 participant