Worked example — HarborView status endpoint
Completion requirements
View
Core time: about 5 minutes.
Fictional request
HarborView needs a status endpoint that only authenticated staff may call. It must return 200 with a service status, return 403 to other callers, and never log credentials.
Proposed diff
+ @app.get("/api/status")
+ def status():
+ app.logger.info(
+ f"status token={request.headers.get('Authorization')}"
+ )
+ return {"status": "ready"}, 200
+
+ def test_status():
+ response = client.get("/api/status")
+ assert response.json["status"] == "ready"
Think-aloud review
- Map the contract: staff-only access,
200for allowed callers,403otherwise, and no credentials in logs. - Inspect the boundary: no visible authentication or staff-role authorization appears.
- Inspect confidential data: the authorization header is written to a log.
- Inspect evidence: the test checks a JSON field but not the response status, allowed role, rejected caller, or absence of token logging.
- Classify: all three findings block merge because they concern explicit access, confidentiality, and evidence requirements.
Review map
| Observed behavior | Impact | Request and evidence |
|---|---|---|
| No route guard is visible. | Any caller may receive staff-only status. | Add the standard auth/role guard and allowed/denied tests. |
| Authorization header is logged. | A bearer token may persist in logs. | Remove it and prove logs omit credentials. |
| One partial happy-path test. | The access and confidentiality contract is unproved. | Trace tests to all material outcomes. |
One model comment
Blocking — route boundary: The new endpoint returns the status without establishing an authenticated staff role, so the diff does not satisfy the staff-only requirement. Please apply the application’s standard authentication and role guard, then add tests showing an allowed staff request returns
200and an anonymous or wrong-role request returns403.
Page summary
The reviewer did not search randomly for defects. They mapped the contract, followed the six passes, classified findings, and requested observable evidence. Use the same sequence on NeighborLink.