<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/if-the-path-id-and-the-body-id-disagree-authorize-both-uv3xxcqdy" -->

---
title: If the path ID and the body ID disagree, authorize both
description: A concise security rule warns that APIs accepting a resource ID in both the URL path and the JSON body create an authorization gap attackers can exploit by...
canonical: https://daily.dev/posts/if-the-path-id-and-the-body-id-disagree-authorize-both-uv3xxcqdy
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: If the path ID and the body ID disagree, authorize both | daily.dev
og:description: A concise security rule warns that APIs accepting a resource ID in both the URL path and the JSON body create an authorization gap attackers can exploit by...
og:url: https://daily.dev/posts/if-the-path-id-and-the-body-id-disagree-authorize-both-uv3xxcqdy
og:image: https://api.daily.dev/og/posts/UV3XXcqDy.png
og:image:alt: If the path ID and the body ID disagree, authorize both
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# If the path ID and the body ID disagree, authorize both

**[Auth By Example](https://daily.dev/sources/7eadcwhmohx0bchehapmt)** · [@authbyexample](https://daily.dev/authbyexample) · 1 min read · 0 upvotes · 0 comments

## Summary

A concise security rule warns that APIs accepting a resource ID in both the URL path and the JSON body create an authorization gap attackers can exploit by sending mismatched IDs. The guidance: reject requests where path and body IDs differ, or explicitly run authorization checks against both, rather than authorizing only the path ID and then mutating whatever ID appears in the body. It stresses that authentication confirms identity, but authorization must bind to the exact resource being modified.

## Content

APIs often take a resource id in the URL and another in the JSON body. Attackers send mismatched ids hoping you authorize only one of them.

Rule: if both ids are present and they differ, reject the request — or run the same authorization check against both. Never authorize the path and then mutate whatever id arrived in the body.

Authn tells you who called. Authz must still bind to the exact resource being changed.

## Similar posts on daily.dev

- [How to Prevent IDOR Vulnerabilities in Next.js API Routes](https://daily.dev/posts/how-to-prevent-idor-vulnerabilities-in-next-js-api-routes-dmkrw7ol0) · freeCodeCamp · 1 upvotes · 0 comments
- [A Trailing Slash Bypassed AWS API Gateway Authorization](https://daily.dev/posts/a-trailing-slash-bypassed-aws-api-gateway-authorization-xczhpumsq) · InfoQ · 1 upvotes · 0 comments
- [Build an IDOR Vulnerability Lab: Why WHERE Clauses Don’t Protect Your API.](https://daily.dev/posts/build-an-idor-vulnerability-lab-why-where-clauses-don-t-protect-your-api--wmreqolv5) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Everyone Knows About Broken Authorization – So Why Does It Still Work for Attackers?](https://daily.dev/posts/everyone-knows-about-broken-authorization-so-why-does-it-still-work-for-attackers--exddy4tnt) · Security Boulevard · 1 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#rest-api](https://daily.dev/tags/rest-api), [#authorization](https://daily.dev/tags/authorization)

[View this post on daily.dev](https://daily.dev/posts/if-the-path-id-and-the-body-id-disagree-authorize-both-uv3xxcqdy)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/if-the-path-id-and-the-body-id-disagree-authorize-both-uv3xxcqdy","headline":"If the path ID and the body ID disagree, authorize both","text":"A concise security rule warns that APIs accepting a resource ID in both the URL path and the JSON body create an authorization gap attackers can exploit by sending mismatched IDs. The guidance: reject requests where path and body IDs differ, or explicitly run authorization checks against both, rather than authorizing only the path ID and then mutating whatever ID appears in the body. It stresses that authentication confirms identity, but authorization must bind to the exact resource being modified.","url":"https://daily.dev/posts/if-the-path-id-and-the-body-id-disagree-authorize-both-uv3xxcqdy","datePublished":"2026-09-22T11:02:44.672Z","dateModified":"2026-09-22T11:03:08.646Z","author":{"@type":"Person","name":"Auth By Example","url":"https://daily.dev/authbyexample","image":"https://media.daily.dev/image/upload/s--Fgz7IgGQ--/f_auto/v1789653205/avatars/avatar_7EADCwHmOHX0bChEhAPmt?_a=BAMAMicg0","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/7eadcwhmohx0bchehapmt","name":"Auth By Example"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Auth By Example","item":"https://daily.dev/sources/7eadcwhmohx0bchehapmt"},{"@type":"ListItem","position":3,"name":"If the path ID and the body ID disagree, authorize both"}]}
```

