December 3, 2026
Same Cookie. Two Paths. One of Them Lied.
I didnβt find this bug in one request.

By Omar Mahmoud
5 min read
I found it in the gap between two answers the server gave the same person, in the same session, about the same data.
Path A said 403 Forbidden. Path B said 200 β and handed over the JSON.
That should not happen. Authorization is supposed to be about who you are, not which URL style you used.
The setup (no magic, just two doors)
Same product. Same login. Same session cookie.
Two API surfaces exposing the same business objects:
- REST β Classic resource paths
- Query API (OData-style) β Entity sets,
$top,$filter,$select, by-ID keys
If REST locks a door for your role, the query API should not open a window into the same room.
I went in assuming they shared one authorization brain. They didn't.
Act 1 β The first contradiction (and why it was easy to dismiss)
First hit looked almost boring.
REST, notifications-style collection:
GET /api/v1/notifications?$top=5
Cookie: <same session>
β 403 ForbiddenGET /api/v1/notifications?$top=5
Cookie: <same session>
β 403 ForbiddenFine. Role is limited. Expected.
Then, same cookie, query surface:
GET /odata/v1/Notifications?$top=5&$format=json
Cookie: <same session>
β 200 OKGET /odata/v1/Notifications?$top=5&$format=json
Cookie: <same session>
β 200 OKBody full of objects: IDs, descriptions, status, priority, createdBy, timestampsβ¦
Brain tries to negotiate:
- Maybe REST is deprecated and "supposed" to 403
- Maybe this role is meant to read via the query API only
- Maybe it's empty-auth noise
So I didn't file yet. I made it harder on purpose.
Act 2 β Prove it's the same principal, not two different users
Everything reused one browser session. No second account. No token swap.
In DevTools, same origin, credentials: 'include':
fetch('/api/v1/notifications?$top=3', { credentials: 'include' })
.then(r => r.text().then(t => console.log('REST', r.status, t.slice(0, 120))))
fetch('/odata/v1/Notifications?$top=3&$format=json', { credentials: 'include' })
.then(r => r.text().then(t => console.log('ODATA', r.status, t.slice(0, 300))))fetch('/api/v1/notifications?$top=3', { credentials: 'include' })
.then(r => r.text().then(t => console.log('REST', r.status, t.slice(0, 120))))
fetch('/odata/v1/Notifications?$top=3&$format=json', { credentials: 'include' })
.then(r => r.text().then(t => console.log('ODATA', r.status, t.slice(0, 300))))REST: 403 OData: 200 + data
Same cookie jar. Same identity. Different path prefix only.
That's the moment it stops being "weird routing" and becomes authorization inconsistency.
Act 3 β Don't trust one resource type
One entity could be a mistake. Two is a pattern.
Locations:
GET /api/v1/locations?$top=3
β 403
GET /odata/v1/Locations?$top=3&$format=json
β 200 + objectsGET /api/v1/locations?$top=3
β 403
GET /odata/v1/Locations?$top=3&$format=json
β 200 + objectsSpare parts:
REST β 403
OData β 200 (empty feed, but the entity set answered)REST β 403
OData β 200 (empty feed, but the entity set answered)The control lives on the REST controllers. The query layer was serving entity sets without the same checks.
Still: list endpoints. Easy for someone to say "enumeration only" or "low."
So the next nights were about making the impact harder to shrug off.
Act 4 β From "a list leaked" to "I can pick the object"
If the entity set is open, by-ID often is too.
GET /odata/v1/Locations('<id>')?$format=json
β 200 (full object)
GET /odata/v1/Equipment('<id>')?$format=json
β 200 (full object)GET /odata/v1/Locations('<id>')?$format=json
β 200 (full object)
GET /odata/v1/Equipment('<id>')?$format=json
β 200 (full object)Matching REST detail:
GET /api/v1/equipment/<id>
β 403GET /api/v1/equipment/<id>
β 403List vs detail matters in triage. REST denies the object. Query API returns the object by key. That's not a vague feed issue β that's object-level read where the other door stays locked.
Act 5 β Treat it like an API the product didn't mean to give you
Once Notifications was readable on OData and forbidden on REST, the question became: can you work the dataset?
$selectβ 200, project only the fields you want$filterβ 200, slice by source / org-like fields$orderbyβ 200$top/$skipβ 200, walk the full collection$expandβ failed cleanly (good negative test)
GET /odata/v1/Notifications?$format=json&$top=1&$select=notificationId,shortDescription,longDescription,createdBy
GET /odata/v1/Notifications?$format=json&$filter=source eq 'TestOrg'
GET /odata/v1/Notifications?$format=json&$top=1&$skip=49GET /odata/v1/Notifications?$format=json&$top=1&$select=notificationId,shortDescription,longDescription,createdBy
GET /odata/v1/Notifications?$format=json&$filter=source eq 'TestOrg'
GET /odata/v1/Notifications?$format=json&$top=1&$skip=49You're not "happening to see a list." You're extracting a collection the REST layer intentionally hid, with projection, filter, and pagination.
That's when the writeup gains weight without inventing a new bug class.
Act 6 β Map the surface (so you're not guessing)
Pulled $metadata, listed entity sets, compared each one under the same user:
- Notifications β REST: 403, OData: 200 β Clear bypass
- Locations β REST: 403, OData: 200 β Clear bypass
- SpareParts β REST: 403, OData: 200 β Empty, but allowed
- Equipment β REST: list 200 / detail 403, OData: 200 list + by-ID β Bypass on detail only
- Models / WorkOrders β REST: list often 200, OData: 200 + by-ID β Don't over-claim list
- Indicator values β REST: value paths 403, OData: 200 β Extra telemetry surface
Rule I stuck to (and you should too):
Only claim rows where REST denies and OData allows. If REST already returns 200 for a list, that list is not your bypass.
Discipline keeps the report credible when you ask for a severity bump later.
Act 7 β The read-only role still gets the multi-creator feed
Retested with a stricter read-oriented account. Same split:
REST /api/v1/notifications β 403
OData /odata/v1/Notifications β 200 (dozens of rows)REST /api/v1/notifications β 403
OData /odata/v1/Notifications β 200 (dozens of rows)The feed wasn't "only my stuff." Multiple createdBy values. Multiple sources.
Whatever the product docs imply about "notifications you created or that were shared with you," the REST layer was denying the collection outright β while OData was still pouring the wider set into the same session.
Vertical write escalation? Explicitly checked β create-style calls still failed for insufficient role.
This report stayed honest: confidentiality bypass, not "I became admin."
Root cause in one sentence
Authorization was enforced on the REST controller layer for several object types, while the OData entity sets exposed the same objects to the same principal without the equivalent checks.
Two faces. One identity. Only one of them said no.
Remediation (the boring part that actually fixes it)
- Shared authorization middleware for REST and OData β not per-controller only
- For every role that gets REST 403 on a resource, the matching entity set must 403 (or return only the authorized subset)
- Regression matrix: same user, same object, both surfaces
- Review by-ID,
$filter,$select, and telemetry entity sets the same way
Why this story is longer than one curl
- First 403 vs 200 β Smell test
- Same cookie / DevTools β Same principal
- Second resource type β Pattern, not fluke
- By-ID where REST detail 403 β Object-level read
$filter/$select/$skipβ Systematic extraction- Full entity-set map β Clear claim vs non-claim
- Stricter read role β Not an over-privileged test user
Each step was a night of "maybe I'm wrong" followed by another 200 that said I wasn't.
Takeaway
Broken access control isn't always a missing check on a single endpoint. Sometimes it's two correct-looking APIs that disagree.
When REST says 403, don't stop. Hit the other surface with the same session. If it says 200, you've found a fork in the authorization model β then earn the severity by proving object-level read, extraction primitives, and a role that still shouldn't see that data.
Same cookie. Two paths. Only one of them was telling the truth.
Read-only testing on designated program environments. No successful writes. No cross-tenant access claimed.