DEV Community

禾
禾

Posted on

WAF Rules Alone vs Application Authorization: How to Protect an API from Broken Object Level Authorization

An attacker does not need an injection payload to steal another customer's invoice. A valid session and a request such as GET /api/invoices/4821 may be enough if the API checks that the caller is logged in but never checks whether that caller can access invoice 4821.

That is broken object level authorization, or BOLA. Automated clients can repeat the request with different identifiers, turning a missing permission check into sustained API abuse. Random identifiers make guessing harder, but identifiers can also leak through shared links, exports, or other endpoints.

For teams deciding how to protect an API from broken object level authorization, the critical comparison is between two configurations: relying on perimeter filtering alone, or combining perimeter filtering with object authorization inside the application.

Configuration A: Put the WAF in front and rely on traffic rules

SafeLine is a self-hosted WAF that filters and monitors HTTP traffic. Its documentation describes a reverse proxy deployment in which requests pass through the WAF before reaching the application. It also lists IP-based rate limiting and web access control lists among its capabilities. Source: SafeLine introduction

This placement provides a useful traffic enforcement point. However, the supplied documentation does not establish that SafeLine evaluates application-specific relationships such as invoice ownership, project membership, or tenant permissions.

Consider two requests from the same authenticated customer:

  • GET /api/invoices/4821 retrieves that customer's invoice.
  • GET /api/invoices/4822 retrieves another customer's invoice.

Both requests can be syntactically ordinary. Neither needs SQL injection, a suspicious header, or an unusually large body. A traffic rule cannot reliably distinguish them without the relevant authorization context.

Rate limits can reduce the speed of enumeration. They do not make the second request authorized. A patient attacker might stay below a threshold, and distributed traffic can weaken the value of a limit keyed only to source IP.

Choose this configuration only as a temporary exposure-reduction measure while fixing authorization. Do not treat a quiet WAF attack list as evidence that object access is safe.

Configuration B: Put the WAF in front and enforce ownership in the API

The stronger configuration assigns each layer a concrete responsibility: the WAF filters traffic, while the application decides whether the authenticated principal may perform the requested action on the specific object.

SafeLine's documented application setup uses a domain, listening port, and upstream address, followed by resolving the domain to the SafeLine server. Source: Protecting an application

Alongside that deployment, implement these application checks:

  1. Derive the caller's identity from validated authentication. Do not trust a submitted userId or tenantId as proof of identity or membership.
  2. Scope object retrieval to authorized relationships. A lookup should establish both which object is requested and why this caller may access it.
  3. Check the action separately. Permission to read an invoice does not imply permission to edit, delete, or export it.
  4. Apply the same policy to nested resources, batch requests, downloads, and background export jobs.
  5. Reject unauthorized access before returning sensitive fields or performing side effects.

Also verify that public clients cannot bypass the intended proxy path and reach the upstream directly. This is a deployment check, not a substitute for application authorization.

What evidence should drive the response?

Start with a hypothetical investigation: one account requests many distinct invoice identifiers, including objects outside its tenant. The requests look normal, but application audit records show successful responses containing another tenant's data.

That combination is stronger evidence than request volume alone. High volume may be legitimate synchronization; cross-tenant access violates the authorization boundary.

Record enough application context to investigate: principal, tenant, action, object identifier, authorization decision, response status, and a correlation identifier. Avoid logging tokens or full sensitive response bodies. Correlate those records with available proxy and traffic evidence.

SafeLine documents an attack list in its console and a detail view for detected attacks. Those records can help investigate attacks the WAF detects, but the documentation does not establish that they identify BOLA or contain application ownership decisions. Source: Protecting an application

If unauthorized access is confirmed, restrict the affected operation, preserve relevant records, and fix the permission check. Assess which objects were accessible and whether suspicious sessions require revocation. Add rate controls where appropriate, then verify the authorization repair independently of those controls.

Prove the boundary with two accounts

Create two test accounts with separate objects. Confirm that account A can access its own object, then submit account B's identifier using account A's session. Repeat for reads, updates, deletes, nested resources, and batch operations.

The negative test must verify both that no sensitive data is returned and that no unauthorized state change occurs. Include legitimate shared-access cases so the repair preserves intended collaboration.

Can SafeLine alone fix broken object level authorization?

The supplied documentation supports traffic filtering and reverse proxy protection. It does not document application-specific object authorization. Enforce that decision in the API.

Are UUIDs enough to prevent BOLA?

No. They reduce straightforward guessing, but an attacker who obtains an identifier must still be denied access when permission is missing.

Should every unauthorized request return 403?

Use a consistent policy appropriate to the API. A 404 response can help avoid revealing object existence. The essential requirement is preventing unauthorized disclosure and side effects.

How should rate limiting fit into the decision?

Use it to constrain abuse and protect capacity. SafeLine documents throttling traffic that exceeds defined limits. Select thresholds against legitimate usage, and test authorization with requests that remain below those limits. Source: SafeLine introduction


SafeLine has surpassed 700,000 installations worldwide as of September 30, 2026. SafeLine Pro annual promotional pricing is $650-$880, compared with the regular $1,000 per year.

Top comments (0)