Skip to content

API1/API5: Authorization guidance assumes a single hop - end-user identity is lost when APIs call other APIs #180

Open

Description

@alienatix

API1 and API5 both frame authorization as a check against the caller. API1 says the checks "should validate that the logged-in user has permissions to perform the requested action on the requested object," and API5 asks whether "a regular user" can reach administrative endpoints. Every scenario in both categories is a single hop from client to API.

In service-to-service architectures, the API that performs the action is often not the one the user called. A public-facing API authenticates the user, then calls internal APIs to fulfil the request. By that point, the downstream API often has no "logged-in user" to check against. It sees the upstream service's credential, a forwarded token whose audience is not the downstream API, or identity asserted in a plain header. Each API assumes the other one authorized the request, so, in practice, neither does.

Proposed changes

1. API1 and API5, "Is the API Vulnerable?" Add a paragraph:

When an API fulfils a request by calling other APIs, each API that acts on an object or function must be able to authorize the action against the end user on whose behalf it is performed. The API is vulnerable if a downstream API authorizes only the calling service rather than the end user, trusts identity or role information asserted by an upstream component without verification, or assumes that authorization was performed upstream while the upstream API assumes it is performed downstream.

2. "How To Prevent" Add to both categories:

  • Propagate end-user identity to downstream APIs in a verifiable form (for example, OAuth 2.0 Token Exchange / on-behalf-of flows) rather than calling downstream APIs with a service credential alone.
  • Issue each hop a token restricted to that downstream API (audience/resource-bound). Do not forward the client's original token as-is to other services.
  • Do not trust identity or role information in plain request headers (e.g. X-User-Id, X-User-Role) unless the header is set by a trusted component, stripped from all incoming client requests, and the downstream service is unreachable except through that component.
  • Assign explicit responsibility for each authorization check to a specific API in the call chain, and test that downstream APIs reject requests lacking valid end-user context. Treat missing or unverifiable end-user context as a denial, never as implicit success.
  • Do not grant service identities broad privileges on the assumption that upstream checks are sufficient; downstream authorization should still be scoped to the end user.
  • Where audience restriction is too coarse, bind the authorization to the specific action and resource (for example, with OAuth 2.0 Rich Authorization Requests, RFC 9396, or a per-request signed assertion), so that credentials issued for a downstream API cannot be reused for a different object or operation.

3. New scenario for API1:

An e-commerce platform's public Orders API authenticates the user and exposes GET /orders/{orderId}/invoice. To build the response, it calls an internal Billing API at GET /internal/invoices/{invoiceId} using the Orders service's own credential. The Billing API returns any invoice to a request carrying that credential, on the assumption that the Orders API has already checked ownership. The Orders API passes the client-supplied invoiceId through without checking it, on the assumption that the Billing API does. An attacker who changes the invoice ID in the request receives other customers' invoices. Each service individually "implements authorization," but no service checks whether this user may access this invoice.

4. New scenario for API5:

An API gateway validates users' access tokens and forwards requests to internal services, adding X-User-Id and X-User-Role headers that the internal services trust for authorization decisions. The gateway does not remove these headers when a client sends them itself. An attacker adds X-User-Role: admin to a request, and an internal service grants access to its administrative functions.

5. References: Add CWE-441: Unintended Proxy or Intermediary ('Confused Deputy'), RFC 8693: OAuth 2.0 Token Exchange, and RFC 9396: OAuth 2.0 Rich Authorization Requests.

This proposes new guidance and scenarios, so I understand it may land in the next edition. Happy to open a PR after there's an agreement on placement (scenarios in API1/API5 vs. a dedicated section).

Activity

  1. alienatix commented on Oct 12, 2026

    @alienatix
    Author

    Hey @ErezYalon, would you mind adding a label to gather community feedback?

  2. QueBallSharken commented on Oct 26, 2026

    @QueBallSharken

    First, thank you for raising this issue and for putting together such a clear, practical proposal. I appreciate the way you've connected the authorization gap to concrete multi-hop API scenarios. The invoice example, in particular, illustrates how individually reasonable assumptions can combine into an end-to-end authorization failure.

    I'd like to contribute an additional consideration based on my own work developing and examining a deterministic execution and verification architecture: the integrity, preservation, and independent verification of security-relevant context across execution and service boundaries.

    During my examination of the architecture's boundary-transition and replay-verification paths, I identified a potential consistency gap. The original execution supports explicit transition constraints, but the replay-verification path I examined does not carry those configuration inputs forward, and the receipt construction path does not appear to preserve them. I also identified a path in which replay verification is skipped when required inputs are missing.

    I want to be precise about what these findings establish. They identify a potential verification-coverage gap; they do not, on their own, demonstrate an authorization bypass or prove that end-user identity is lost. However, they raise a related question that I believe is relevant to the concern you've described: when a downstream service or independent verifier evaluates a security decision, can it establish that the security-relevant identity, authority, and constraints governing the original decision have been preserved and correctly verified?

    I wonder whether this could complement your proposed guidance for API1 and API5 through several additional considerations:

    • Preserve and verifiably bind the relevant principal, delegated authority, requested action, resource identity, and applicable constraints to the downstream decision.
    • Ensure independent verification evaluates the security-relevant inputs and constraints governing the original execution rather than silently omitting them.
    • Treat missing required evidence, or an inability to verify a required security condition, as an explicit verification failure rather than allowing the absence of evidence to imply success.
    • Include adversarial tests for altered identity, resource identifiers, delegated scopes, and relevant execution constraints across multiple service hops.

    I see this as a complementary consideration, not a replacement for your proposed guidance. Identity propagation, audience-restricted tokens, and clearly assigned authorization responsibilities address essential parts of the problem. Preserving and independently verifying the context governing those decisions may help address another question: whether the authorization decision being relied upon downstream is still bound to the action and constraints it was intended to govern.

    Your proposal provides a strong foundation for this discussion, and I appreciate the practical examples and thought you've put into it. I'd be interested in whether you and the maintainers think this additional consideration belongs within the existing API1/API5 guidance or would be better addressed separately.

    My engineering principle is: BUILD IT. BREAK IT. FIX IT. RESPECTFULLY. ∞

    For me, that means building precise contracts, challenging assumptions through adversarial testing, preserving both successful and failed findings, and strengthening security claims through reproducible evidence. The goal is not to claim that a design is secure because it behaves as expected, but to establish what has actually been verified, identify what remains uncertain, and improve it accordingly.

    Thank you again for bringing this forward. I believe this is a worthwhile discussion for the API security community.

    -Stevil

  3. alienatix commented on Nov 11, 2026

    @alienatix
    Author

    Thanks, @QueBallSharken , for the thoughtful comment. Two of your points fit the current scope, so I’ll fold them in:

    1. Fail closed on missing evidence. I’ll make this explicit:

    ...and test that downstream APIs reject requests lacking valid end-user context. Treat missing or unverifiable end-user context as a denial, never as implicit success.

    1. Binding the decision to the action and resource. Audience-restricted tokens limit which API a token can reach, not which object or operation it covers, so a token valid for the downstream API still allows the invoice-swap in the API1 scenario. I’ll add a bullet to “How To Prevent”:

    Where audience restriction is too coarse, bind the authorization to the specific action and resource (for example, with OAuth 2.0 Rich Authorization Requests, RFC 9396, or a per-request signed assertion), so that credentials issued for a downstream API cannot be reused for a different object or operation.

    On replay verification, receipts and independent verifiers, I think that’s out of scope here.

  4. QueBallSharken commented on Nov 12, 2026

    @QueBallSharken

    Thank you, @alienatix, for taking the time to consider these points and incorporate them into the proposed guidance. I appreciate your clear distinction between what belongs within API1/API5 and what may warrant separate treatment.

    I agree with that scope boundary. Replay verification, receipts, and independent verification introduce broader architectural questions that deserve their own examination rather than expanding this issue beyond its intended purpose.

    One additional consideration that may strengthen the proposed guidance is authorization continuity across multiple service hops.

    Binding authorization to a specific action and resource is essential, but that binding must remain enforceable when downstream services transform requests, resolve resource identifiers, or delegate execution to additional components.

    A useful adversarial test would be to authorize a request for one resource, then deliberately alter the effective resource or operation at an intermediate service boundary. The downstream service should reject the resulting action unless the transformed request remains within the original authorized scope.

    This would help distinguish authorization that is merely valid at the point of entry from authorization that remains valid at the point of execution.

    I see this as complementary to your existing recommendations, not a request to broaden the proposal into a full execution-verification framework.

    Thank you again for the constructive engagement and for advancing this discussion.

    Break assumptions, not people. Verify claims against evidence.

    Respectfully,
    Stevil

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