# Web security practice: test an access boundary and write the finding

> Use two lab accounts to examine a document-access boundary, record a controlled request, and separate a real finding from a misleading status code.

Canonical: https://codelivly.com/blog/practise-web-security-safely

| | |
|---|---|
| Category | Web security |
| Author | Codelivly team |
| Reading time | 6 min |

A web application responds with `200 OK` when you change a number in a URL. Is that a vulnerability? You cannot answer from the status code alone. You need to know which identity made the request, what that identity was allowed to access, and what the response actually contained.

This article works through a small authorization exercise with two accounts and two documents. It shows how to establish a baseline, change one variable, record the result and write a finding that another person can reproduce. The same discipline helps when an apparent finding turns out to be a login page, an expired session or a misunderstood requirement.

 **Scope of this example**

The host `lab.example.test`, accounts and documents are fictional. Use a deliberately vulnerable lab or an explicitly authorized exercise with test data. Nothing here authorizes requests to an unrelated site. A Codelivly simulation may use a simplified interface; follow the room's supported actions.

## Write the access rule before testing it

Our sample application has two ordinary users, Alex and Blair. Each owns a private document. The exercise requirement says that an ordinary user may read only their own document. There is no sharing feature or administrator exception in this specific scenario.

| Signed-in identity | Document | Expected access |
|---|---|---|
| Alex | 4101, owned by Alex | Allow |
| Alex | 4102, owned by Blair | Deny |
| Blair | 4102, owned by Blair | Allow |
| Unauthenticated visitor | Either private document | Deny |

This matrix is the test's reference point. Without it, you might report intended sharing as unauthorized access or miss a boundary that the application was supposed to enforce. In a real assessment, confirm the intended rule with the owner and the agreed scope rather than inventing it.

## Establish a baseline you can trust

Sign in as Alex in the lab and open Alex's document through the normal interface. Capture the method, path, relevant headers and response. Keep the session credential private. A redacted record is appropriate for a report; an actual replay requires the authorized lab session, not the placeholder below.

```http
GET /api/documents/4101 HTTP/1.1
Host: lab.example.test
Cookie: session=[REDACTED]
Accept: application/json
```

```json
{
  "id": 4101,
  "owner": "alex",
  "title": "Alex training note",
  "body": "Sample content created for this exercise."
}
```

Record that the baseline returns the expected document for Alex. Confirm the active account through the application, not just a browser tab label. Mixing cookies from two accounts can create a false finding: you think Alex read Blair's document when the request actually carried Blair's session.

In a browser-based lab, separate profiles or isolated sessions can help keep identities clear. Record which session belongs to which test account. Avoid copying authentication material into public notes, screenshots or a shared URL.

## Change one variable and inspect the whole result

Keeping Alex's authorized lab session, change only the document identifier from `4101` to the known test document `4102`. Do not enumerate unrelated identifiers or expand beyond the exercise's supplied records. We are testing one defined relationship between a user and a resource.

```http
GET /api/documents/4102 HTTP/1.1
Host: lab.example.test
Cookie: session=[ALEX SESSION REDACTED]
Accept: application/json
```

Compare the response with the baseline. A status code is useful context, but the response body and identity determine what the result supports. [MDN's 200 reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200) describes a successful HTTP response; it does not establish that an application's authorization rule was correct.

| Observed result | What it supports | Next check |
|---|---|---|
| 403 and an error body | This request was refused. | Confirm the baseline still works and the refusal is for the intended identity. |
| 404 and no private content | The response does not disclose the target document. | Do not infer that the document does not exist; the application may conceal it. |
| 200 with an HTML login page | The returned page is not the private document. | Check session expiry and redirects. |
| 200 with Blair's private document body | The defined read boundary appears to fail for this test. | Confirm Alex's identity, Blair's ownership and repeatability. |

A [403 response indicates refusal](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403), but a single denied request is not proof that every resource or action is protected. The conclusion should remain as narrow as the test.

## Verify a suspected finding before reporting it

Suppose Alex receives Blair's document body. Repeat the original allowed request, then repeat the cross-account request without changing identities. Verify that document 4102 is private and owned by Blair under the scenario's rule. Check that the content is not a public preview or a shared template.

Use only the minimum evidence needed to establish the result. In this exercise, the controlled test document's identifier, owner and harmless sample text are enough. Accessing additional users' records would add exposure without answering the defined question.

If the response changes between attempts, capture the difference rather than selecting only the result that supports your first impression. Session expiry, a changed fixture or a caching issue may explain it. A non-reproducible observation can still be documented, but its uncertainty belongs in the finding.

## Write the report around the broken rule

“IDOR found” is a label, not a complete explanation. A useful report states the violated access rule, the controlled steps, the observed result and the practical consequence supported by the evidence.

```text
Title
Alex can read Blair's private training document in the lab API.

Preconditions
Two ordinary test accounts. Document 4101 belongs to Alex;
4102 belongs to Blair. The exercise prohibits cross-account reads.

Steps
1. Sign in as Alex and request /api/documents/4101. Confirm Alex's document.
2. Keep the same session and request /api/documents/4102.
3. Observe Blair's document identifier, owner and private sample body.

Expected
Alex is denied access to document 4102 and receives no private body.

Observed
The sample failing response returns Blair's document to Alex.

Impact and limits
Unauthorized read of the tested document in this lab configuration.
Write access, other endpoints and other roles were not tested.
```

This is a hypothetical failing result for teaching report structure. It is not a claim about Codelivly or another deployed application. If your actual lab denies the request, report that observed outcome instead of copying the example's conclusion.

## Describe a fix and a useful retest

For this scenario, the application needs to check the requesting identity's permission for the requested document on the server. An interface that hides a link is not the same as enforcing that check. An identifier that is difficult to guess also does not define who is allowed to read the resource.

A retest should cover the allowed and denied rows in the matrix. Alex must still read Alex's document; Alex must not receive Blair's private content. Repeat the corresponding checks as Blair and without an authenticated session. Record the responses and any limits of the retest. This verifies the stated sample requirement, not the entire application's security.

 **Try it on paper first**

Change the scenario so Blair explicitly shares document 4102 with Alex. Update the matrix before writing a test. Which request is now allowed? What additional fact would you need before calling Alex's access unauthorized?

Continue with [Web Fundamentals](https://codelivly.com/learning-paths/web-fundamentals) if you need more practice reading HTTP, then use the authorized exercises in [Web Application Security](https://codelivly.com/learning-paths/web-application-security). For broader testing methodology, consult the [OWASP Web Security Testing Guide](https://owasp.org/www-project-web-security-testing-guide/) and the specific instructions governing your lab.
