Skip to content

Auth hardening: Bearer aud/exp, OIDC config gaps, JWKS refetch on unknown kid #281

Backlog

Description

@jrosskopf

These are documented as limits in the authentication guide; the code should close them.

  • Bearer:
    • no aud check;
    • a token without exp never expires;
    • without jwt-issuer, REST requires "iss": "" while MCP defaults to flapi;
    • REST requires a roles array while MCP makes it optional;
    • REST bearer never fills auth.email.
  • OIDC, besides OIDC rejects every valid token: decodeJWT returns crow::json::rvalue pointing into freed strings #273:
    • a dotted roles-claim always nests, so namespaced Auth0 claims cannot resolve;
    • the presets override an explicit username-claim: sub;
    • groups-claim, scopes, client-secret, enable-client-credentials and enable-refresh-tokens are parsed but unused;
    • without allowed-audiences, client-id is not checked against aud;
    • the Auth0 preset issuer lacks the trailing slash;
    • the github preset cannot validate tokens;
    • only RS256/384/512 are accepted.
  • JWKS: an unknown kid refetches the JWKS on every such request, up to 3 times, with no cooldown (src/oidc_jwks_manager.cpp:56-61, src/oidc_auth_handler.cpp:62-70).
  • Rate limit keys: key: user hashes the raw Authorization header before verification, per route, so a new token means a new bucket.
    Found while writing and reviewing the task guides (docs: Task guides for every feature area, run in CI and aligned with flapi.io #272).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions