← All posts

Field notes / Security

Authentication Is Not Authorization: Why Object-Level Access Control Matters

A user logs into an application successfully.

Their credentials are valid. Their session is legitimate. Their JWT checks out.

Then they request:

GET /projects/51

The server retrieves Project 51 and returns it.

Secure?

Not necessarily.

The application has established who the user is, but it has not yet answered the more important question:

Should this user be allowed to access Project 51?

That distinction sits at the heart of one of the most common API authorization failures: Broken Object Level Authorization, often discussed as BOLA or IDOR.

And the problem is bigger than changing 51 to 52.

It is about understanding where trust ends and where authorization decisions must begin.

Authentication Answers Only One Question

Authentication establishes identity.

A user might authenticate with credentials, a token, a certificate, or another mechanism. Once that process succeeds, the application may know something like:

req.user = {
    id: 42,
    role: "user"
}

That is valuable information.

But all it establishes is:

This request is associated with user 42.

It does not establish:

User 42 may access every resource available through this application.

Consider an internal project management application with an endpoint resembling:

router.get("/projects/:projectId", async (req, res) => {

    const project = await Project.findByPk(req.params.projectId);

    if (!project) {
        return res.status(404).send();
    }

    return res.json(project);

});

The route takes a project identifier supplied by the requester, retrieves the matching project, and returns it. The original scenario explicitly establishes that JWT authentication occurs upstream, so authentication is not the missing control here.

The security problem appears in what happens next.

There is no visible decision asking whether the authenticated user is actually permitted to access the requested project.

Authentication succeeded.

Authorization did not happen.

Think From the Server's Perspective

One of the most useful shifts when analyzing application security is moving away from what the workflow looks like to the end user and instead following the decisions being made by the server.

For this request:

GET /projects/51

the server needs to answer a series of different questions.

Authentication: Who is making this request?

Input handling: What resource are they requesting?

Authorization: Is this identity permitted to perform this action on this particular resource?

Data access: What information should be retrieved?

Response handling: What information should actually be returned?

These are separate decisions.

The source material captured this broader principle well: describe the request lifecycle from the server's perspective and identify the security decision occurring at each stage.

That perspective becomes particularly important when reviewing code.

A developer may reasonably say:

"The endpoint is protected. You have to be logged in."

A security engineer needs to ask the next question:

"Logged in as whom, and what is that identity allowed to do?"

The Object Is the Authorization Boundary

Suppose user 42 has a legitimate JWT and makes these requests:

GET /projects/51
GET /projects/52
GET /projects/53

If all three projects exist, the vulnerable implementation may return all three.

Why?

Because existence is effectively the only condition being evaluated.

The server asks:

Does Project 52 exist?

It does not ask:

Is user 42 permitted to access Project 52?

That missing decision is the vulnerability.

This is why object-level authorization matters. Permission cannot stop at the application, API, or route level. It must ultimately apply to the specific resource being requested.

An Object ID Is an Identifier, Not an Access Control

A common response to this class of vulnerability is:

"But users can't guess our IDs."

That is the wrong security boundary.

Object identifiers should be treated as discoverable.

An attacker might learn them through several different mechanisms:

  1. Enumeration: Sequential or otherwise predictable identifiers can be tested systematically.
  2. Social engineering: Employees or other users may disclose identifiers through conversations, screenshots, emails, links, or documents.
  3. OSINT: Public documentation, repositories, indexed URLs, or other publicly accessible information may expose identifiers.
  4. Legitimate application observation: A user may see identifiers belonging to resources they legitimately access through URLs, browser developer tools, intercepted application traffic, or normal application behavior.
  5. Information leakage: Debug interfaces, exposed backups, verbose errors, improperly exposed logs, or other misconfigurations may reveal valid identifiers.

The exact method is secondary to the security principle:

Security should never rely on object IDs remaining secret.

Or more succinctly:

An object ID is an identifier, not an access control.

Switching from integers to UUIDs does not solve the underlying problem either.

A UUID may make enumeration substantially more difficult, but if authorization is absent, possession of a valid UUID can still provide unauthorized access. Obscurity changes how easily the identifier can be discovered. It does not determine whether the requester should be trusted with the object.

One Missing Check Can Expose Much More Than an ID

Now consider what the project actually contains:

{
    "id": 51,
    "ownerId": 13,
    "name": "Q3 Acquisition",
    "budget": 850000,
    "notes": "...",
    "customer": "...",
    "internalComments": "..."
}

The consequence of failed authorization is not merely:

An attacker learns that Project 51 exists.

The response could expose ownership information, budgets, customer relationships, project names, notes, internal comments, or whatever else has been stored in the record. The scenario specifically demonstrates a route returning the project object containing these kinds of fields.

Free-form fields make the situation particularly interesting from a security perspective. A notes or internalComments field can potentially contain information far beyond what its name implies.

The application may have been designed for someone to type a project note there.

That does not guarantee that users only stored harmless project notes there.

Once object-level authorization fails, every returned field should be treated as potentially compromised.

That leads to a second question even after object authorization is corrected:

Does an authorized user need every field being returned?

Authorization to view a project does not automatically imply authorization to see every piece of information associated with that project.

Object-level authorization and data minimization need to work together.

"Just Check the Owner" Is Better, But It Is Not an Authorization Strategy

A developer might respond by adding:

const project = await Project.findByPk(req.params.projectId);

if (project.ownerId !== req.user.id) {
    return res.sendStatus(403);
}

That appears much better.

The server now compares the authenticated identity with information associated with the requested object.

But another question immediately follows:

Is ownership actually the organization's authorization policy?

Suppose the application supports:

Those requirements were explicitly part of the authorization-design scenario.

An owner-only check cannot represent that model.

In fact, it could create the opposite problem: legitimate users who should have access are denied.

The implementation may therefore fix one unauthorized-access path while breaking legitimate application behavior.

There are additional concerns worth reviewing as well.

What happens when findByPk() returns no project?

Are identity types normalized before comparison?

Should unauthorized and nonexistent objects produce distinguishable responses?

Can authorization be incorporated into the data-access operation rather than retrieving an arbitrary object first?

Are sensitive fields restricted separately?

Are related objects protected by the same policy?

The larger lesson is that authorization should not emerge from scattered if statements added whenever someone discovers another access-control bug.

It needs a model.

Authorization Is a Business Rule

A useful authorization design starts by defining relationships and permissions.

For example:

Employee: May access projects explicitly available to that employee.

Manager: May additionally access projects belonging to employees they manage.

Finance: May view projects according to the organization's Finance access policy.

Contractor: May access only projects assigned to that contractor.

Administrator: May perform privileged modification operations where the administrative policy permits them.

Notice what is missing from that model:

"The user is logged in."

Authentication is a prerequisite, not the authorization rule.

The server first establishes identity. When the authenticated identity requests a resource, the application evaluates that identity and action against the authorization policy governing the specific resource.

Conceptually:

Request
   |
   v
Establish identity
   |
   v
Identify requested resource and action
   |
   v
Evaluate authorization policy
   |
   +---- denied ----> Stop
   |
 allowed
   |
   v
Retrieve / modify permitted data
   |
   v
Return appropriate response

The authorization decision may depend on role, permissions, ownership, group membership, organizational boundaries, resource relationships, or combinations of them.

The implementation can vary.

The security requirement does not:

Every protected operation must enforce the appropriate authorization policy before unauthorized data or actions become available.

Why This Becomes an Organizational Problem

The most dangerous version of this vulnerability is not one insecure /projects/:projectId route.

It is a development pattern.

Imagine dozens of services following the same logic:

authenticate user
        ↓
accept object ID
        ↓
retrieve object
        ↓
return object

If developers treat authentication as sufficient authorization, the same flaw can appear in:

/projects/51
/customers/183
/invoices/882
/reports/19
/employees/204
/contracts/74
/tickets/491

Now the organization does not have an isolated BOLA vulnerability.

It has an authorization architecture problem.

The scenario specifically raises this organizational risk: contractors or other internal users could potentially access projects outside their need-to-know boundaries if object-specific authorization is not consistently enforced.

Internal applications are not exempt from this problem.

An authenticated contractor should not automatically gain access to Finance.

An authenticated Finance employee should not automatically gain administrative modification privileges.

An authenticated employee should not automatically gain access to HR, Legal, executive, customer, or unrelated project data.

Identity tells the system who crossed the front door.

Authorization determines which doors inside the building they may open.

Authorization Must Scale Beyond Individual Endpoints

As an application grows, authorization needs to become consistent enough that developers do not reinvent access control every time they create an endpoint.

The exact architecture depends on the application, but the design should provide a reliable way to evaluate questions such as:

Can this user view this project?

Can this manager view this employee's project?

Can this contractor view this assigned project?

Can this Finance user view this financial information?

Can this administrator modify this object?

That policy also needs to remain enforceable as services, endpoints, roles, teams, and resource relationships multiply.

This is where models such as role-based, attribute-based, relationship-based, ownership-based, and hybrid authorization become useful.

The important part is not choosing the fanciest acronym.

The important part is making the organization's actual access rules explicit, testable, and consistently enforceable.

Testing Authorization Requires Negative Cases

Testing the happy path is easy:

User 42 requests Project 51 and receives Project 51.

That proves very little about authorization.

Security testing needs to deliberately cross boundaries.

If a contractor can access Project A, test Project B that is not assigned to them.

If a manager can access a subordinate's project, test a project owned by an employee outside their reporting structure.

If Finance has broad read access, test whether that accidentally grants modification rights.

If administrators can modify projects, verify whether that permission unnecessarily exposes other sensitive operations.

Test horizontal boundaries:

User A → User B's resource

Test vertical boundaries:

Normal user → Administrative operation

Test organizational and relationship boundaries:

Contractor → Finance project
Manager → Unrelated department
Tenant A → Tenant B

And test every relevant operation, not merely GET.

An endpoint may correctly restrict reads while leaving update, delete, export, attachment, search, or nested-resource operations improperly authorized.

The question is always the same:

What decision does the server make before allowing this identity to perform this action on this object?

Security Engineering Is About the Decision, Not the Buzzword

It is easy to memorize:

"This is IDOR."

That identifies the vulnerability class.

It does not demonstrate that you understand the system.

A stronger review explains the actual failure:

The requester controls which project ID is supplied. The application retrieves the corresponding project but does not verify that the authenticated user is permitted to access that specific project. As a result, a legitimate authenticated user may be able to retrieve projects belonging to other users or groups.

Only after explaining that behavior does the label become useful:

Broken Object Level Authorization, commonly associated with IDOR.

That reasoning-first approach also makes terminology less fragile.

If the exact security term disappears from your brain in the middle of a review or interview, you can still describe:

If you can explain the system, you can communicate the vulnerability.

The Bigger Mental Model

There is a broader lesson here than BOLA.

When reviewing application security, follow the request through the server and ask what decision is being made at each trust boundary.

For authentication:

How does the server establish identity?

For authorization:

How does the server decide whether that identity can perform this action on this object?

For input validation:

When and how does the server determine whether attacker-controlled input is acceptable?

For database access:

How does the server construct and constrain the query?

For request integrity:

How does the server establish that an authenticated action was intentionally initiated in the expected context?

That server-side perspective was one of the central takeaways from the source material.

It turns security review from vulnerability-name recognition into system reasoning.

And that is the skill that scales.

Final Takeaway

Authentication is essential, but authentication is not permission.

A valid token proves identity.

It does not grant universal access.

A project ID identifies a project.

It does not grant access to it.

A UUID makes an object harder to guess.

It does not authorize the requester.

And an authenticated employee, contractor, administrator, or service account is still an untrusted actor whenever they attempt to cross a boundary they are not permitted to cross.

The server must make the authorization decision.

For the requested action.

For the authenticated identity.

For the specific object.

Every time.

Because authorization protects the object, not the obscurity of the identifier.

← Back to the blog