Menu

Fetch Metadata turns request context into an authorization input
📰

Fetch Metadata turns request context into an authorization input

#devcommunity#dev#fetch#request#headers
Reading 0:00
15s threshold

Fetch Metadata turns request context into an authorization input

Many web attacks reach a state-changing endpoint through a request shape the application never intended. A page may expect a JSON POST from its own JavaScript, then accept the same action from a cross-site form, an image load, or a top-level navigation. Fetch Metadata headers give the server a way to inspect that request context before the business logic runs.

The specification defines headers that describe how a request was initiated. Sec-Fetch-Site identifies the relationship between the initiator and the target. Sec-Fetch-Mode describes the request mode, and Sec-Fetch-Dest identifies the expected destination. Sec-Fetch-User indicates whether a navigation was triggered by user activation. Browsers add these headers so a server can make an early decision about whether the request fits the endpoint's contract.

The useful boundary

Fetch Metadata is most valuable at endpoints with a narrow expected context.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.