Security

Passing Authentication Does Not Make Input Trustworthy

ASI Backbone Learning Christopher D. Cavell
Security

A whole authenticated request can still be wrong: only the subject comes from the validated token, while identifiers, quantities, prices and status are just claims the client typed. The article walks through five authenticated failures in a wholesale ordering API and the habit that fixes all of them: assign each request field to an owner and let nobody else set it.

Key points

  • A validated JWT proves the token is genuine and names the subject the issuer asserted; it does not vouch for the body, route, query string or headers.
  • The authorization policy named in RequireAuthorization decides whether the caller may place orders somewhere, not whether it may touch account C-2041.
  • Sort every request field into identity, selector, caller-owned input, server-owned fact or hint before writing checks; the kind decides the handling.
  • Bind the request to a dedicated request model, never to the EF Core entity, so fields like UnitPrice, Total and Status cannot be written by the client.
  • Resolve each selector against the tenant and check the caller is assigned to it; 'sub' arrives as ClaimTypes.NameIdentifier because MapInboundClaims is true by default.
  • Claims are a snapshot from issue time: a short token lifetime narrows, but does not close, the window for revoked access.

Why it matters

Most authenticated-but-wrong requests come from stale clients and copy-paste configuration rather than attackers, so per-field ownership removes a whole class of data-integrity and cross-tenant bugs before any hostile caller shows up.

Real-world use

  • A multi-tenant SaaS order API where the distributor tenant must be resolved from the caller's validated identity instead of a body field.
  • A mobile client that caches a price list and keeps sending last month's unit prices, requiring the server to compute prices and compare the client's copy as a precondition.
  • A partner integration that reads TenantId from a copied configuration file, making server-side tenant resolution the only safe option.
  • An approval workflow where a status such as Approved must only ever be set by server logic, never accepted from the request body.

This summary was generated by the agent from the original post on ASI Backbone Learning. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message