Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: authorizerdev/authorizer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.4.0
Choose a base ref
...
head repository: authorizerdev/authorizer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.4.1
Choose a head ref
  • 3 commits
  • 22 files changed
  • 1 contributor

Commits on Sep 3, 2026

  1. security: resolve client IP from the connection, not from spoofable h…

    …eaders (GHSA-93hc-xq3w-xw87) (#788)
    
    * fix(security): resolve client IP via trusted proxies only
    
    utils.GetIP returned X-Real-Ip / X-Forwarded-For verbatim while the gin
    router was hardened with SetTrustedProxies. The two views of "who is this
    request from" disagreed, and the admin-secret lockout buckets on GetIP,
    so a guesser rotated the header per request and never filled a bucket:
    10 failures per 15 minutes became 10 per attacker-chosen label.
    
    Three distinct bypasses closed:
    
    - Forged X-Forwarded-For / X-Real-Ip from an untrusted peer. Headers are
      now honoured only when the connection peer is in --trusted-proxies,
      walking the chain right-to-left past trusted hops. Safe whether the
      proxy strips or appends the client's header; "take the leftmost entry"
      is not, and is the advice commonly given.
    - RemoteAddr was returned as "IP:port", so the ephemeral port put every
      new TCP connection in a fresh bucket with no header forgery at all.
    - gRPC and REST resolved IPAddress from caller-settable metadata,
      bypassing the router entirely. Both now anchor on the unforgeable peer
      address; the in-process gateway is identified by its bufconn peer and
      its appended chain is split back apart so REST and gin agree.
    
    utils.SetTrustedProxies is configured next to router.SetTrustedProxies
    from the same value so they cannot drift again, and
    TestGetIPMatchesGinClientIP pins the two implementations together.
    
    BREAKING CHANGE: deployments behind a proxy that never set
    --trusted-proxies now resolve every client to the proxy address, so one
    attacker's failed admin guesses fill the shared bucket. The flag was
    already load-bearing for rate limiting (gin ClientIP); this makes
    client-IP resolution consistent with it. Startup logs a warning when it
    is unset. Railway deployments want --trusted-proxies=100.64.0.0/10.
    
    Claude-Session: https://claude.ai/code/session_016dbRdiyrapnT7J3tAyZhdR
    
    * fix(security): match gin on malformed X-Real-Ip, note MCP bufconn
    
    - X-Real-Ip was returned unparsed, so a trusted proxy sending garbage
      produced a lockout bucket key that is not an address. gin validates it
      and falls back to the peer; now so does GetIP. The parity table gained
      the malformed cases that would have caught this.
    - MCP also serves over an in-process bufconn, so it reaches the gateway
      branch. It forwards only Authorization by design, so it carries no
      chain and now records an empty address where it previously recorded
      the literal "bufconn". Neither is spoofable and the admin lockout is
      unreachable over MCP; documented rather than changed.
    
    Claude-Session: https://claude.ai/code/session_016dbRdiyrapnT7J3tAyZhdR
    
    * fix(security): block Grpc-Metadata- forwarded-header smuggling
    
    The REST surface was still fully exploitable after the GetIP rewrite.
    
    grpc-gateway's DefaultHeaderMatcher strips a "Grpc-Metadata-" prefix and
    forwards whatever follows, so a client sending
    `Grpc-Metadata-X-Forwarded-For: 203.0.113.9` produced a genuine
    `x-forwarded-for` metadata entry — placed BEFORE the authoritative chain
    AnnotateContext appends afterwards. clientIPFromGRPC read the FIRST
    value, so an unauthenticated REST caller picked its own client IP and the
    admin-secret lockout bucketed on it again. Same class, same endpoint, the
    raw-header fix simply did not reach this spelling.
    
    Verified through the real runtime.AnnotateContext:
      outgoing md[x-forwarded-for] = ["203.0.113.9", "198.51.100.10"]
      MetaFromGRPC -> "203.0.113.9"   (real peer was 198.51.100.10)
    
    Two independent locks, because this header decides a throttling identity:
    - gateway.Handler refuses X-Forwarded-For / X-Real-Ip / X-Forwarded-Host
      at the boundary, in any spelling, so they never reach metadata.
    - clientIPFromGRPC reads the LAST value, since anything this server
      appends itself lands after anything a client smuggled in.
    
    The header matcher is extracted so the test drives the real policy rather
    than a copy — the drift between the router's view and GetIP's view is the
    whole vulnerability, and a copied policy would reintroduce it.
    
    Found by adversarial review. The existing tests could not catch it:
    metadata.New cannot express a multi-value key, so the "smuggled value
    then appended peer" shape never appeared. The new tests build metadata
    through the real gateway annotator.
    
    Claude-Session: https://claude.ai/code/session_016dbRdiyrapnT7J3tAyZhdR
    lakhansamani authored Sep 3, 2026
    Configuration menu
    Copy the full SHA
    a505cb2 View commit details
    Browse the repository at this point in the history
  2. security: keep machine identity on delegated tokens and the required_…

    …relations gate (GHSA-vq29-8q3c-3hrm) (#789)
    
    * fix(security): keep machine identity on delegated tokens
    
    A delegated token minted from a SERVICE-ACCOUNT subject dropped the
    login_method claim. service/fga.go treats a missing login_method as a
    human user, so an autonomous machine laundered itself into "user:<sub>":
    OpenFGA decisions flipped deny -> allow and every login_method-keyed
    guard was bypassed.
    
    The report framed this as self-delegation (subject == actor) and proposed
    rejecting that shape. That is a symptom patch. The laundering lives in
    CreateDelegatedAccessToken omitting the claim, so it applies identically
    to the multi-hop agent chain the design explicitly supports and which the
    proposed check does not cover. Both shapes are now covered by tests, and
    the self-delegation check is not added: once the subject keeps its real
    identity, subject == actor yields an ordinary attenuated, resource-bound
    machine token.
    
    resolveFgaCaller's machine branch now RETAINS actorID. It used to drop
    it, on the reasoning that a machine subject is never delegated — true of
    client_credentials, false of a machine-subject delegation, which now
    reaches that branch. Dropping it would collapse authority from
    perms(agent) n perms(subject) to perms(subject), trading identity
    laundering for privilege widening.
    
    Blast radius is one grant: CreateDelegatedAccessToken has exactly one
    caller (handleTokenExchangeGrant). authorization_code, implicit, refresh,
    client_credentials, OIDC id_token/userinfo, SAML and SCIM never reach it.
    A USER-subject delegation still carries no login_method and is unchanged.
    
    Claude-Session: https://claude.ai/code/session_016dbRdiyrapnT7J3tAyZhdR
    
    * test: pin chained machine-subject re-exchange behaviour change
    
    Stamping login_method makes a previously-broken path work: before, a
    machine-subject delegated token carried no login_method, so re-exchanging
    it took the USER branch, did GetUserByID(<service-account row id>), found
    nothing and rejected the hop. A machine-subject chain only ever worked
    for its first hop (400 on hop 2).
    
    It now takes the agent branch and succeeds, which is what the multi-hop
    design intends. Recorded as a test rather than left as a surprise, along
    with the controls that bound it: subject liveness is re-checked every
    hop, scope still attenuates monotonically, and maxActChainDepth still
    caps the chain.
    
    Claude-Session: https://claude.ai/code/session_016dbRdiyrapnT7J3tAyZhdR
    
    * fix(security): classify machine subjects on the required_relations gate
    
    enforceRequiredRelations resolved the caller and then discarded
    caller.subject, hardcoding "user:"+userID. machineFgaSubject therefore
    never ran on this surface, so a machine identity was answered as a human
    user — the same laundering primitive as the delegated-token bug, but
    reachable with NO delegation at all: a plain client_credentials token
    presented to validate_jwt_token with required_relations was satisfied by
    a tuple written for "user:<service-account-row-id>", while
    check_permissions denied the identical token.
    
    That is the "two answers to one authority question" this function's own
    doc comment warns about, and a gateway gating on required_relations
    would admit requests the permission API refuses.
    
    Classification is extracted into fgaSubjectFor so all three decision
    surfaces share one source of truth, and the presented token's own
    login_method is threaded in from validate_jwt_token. The browser-session
    callers pass "" — a session subject is always a user.
    
    Found by adversarial review, not by the original report. Pre-existing on
    main rather than introduced by the delegation fix, but the same class,
    so it ships with it.
    
    Claude-Session: https://claude.ai/code/session_016dbRdiyrapnT7J3tAyZhdR
    lakhansamani authored Sep 3, 2026
    Configuration menu
    Copy the full SHA
    f6b60cf View commit details
    Browse the repository at this point in the history
  3. chore: release prep for 2.4.1 (#790)

    Security release notes for GHSA-93hc-xq3w-xw87 and GHSA-vq29-8q3c-3hrm,
    plus the two same-class issues found while fixing them.
    
    Also corrects the 2.4.0 A2A entry, which claimed "sub remains the user".
    That was never true of an agent-to-agent exchange, where the subject is
    the delegated service account — the misstatement is the invariant the
    delegation bug was built on.
    
    Carries the migration note for --trusted-proxies: it now governs client-IP
    resolution everywhere, so a proxied deployment that never set it will see
    audit IPs and the admin lockout collapse onto the proxy address.
    
    Claude-Session: https://claude.ai/code/session_016dbRdiyrapnT7J3tAyZhdR
    lakhansamani authored Sep 3, 2026
    Configuration menu
    Copy the full SHA
    0bceb94 View commit details
    Browse the repository at this point in the history
Loading