Documentation
¶
Overview ¶
Package application is a deliberately broken web application, used as the ground truth for the application-layer findings.
It exists because docs/exploitability.md asks for an ANSWER KEY rather than a test, and the difference is not pedantry: a test written by the same person as the check can agree with it for the same wrong reason, which happened six times while these checks were being built.
So the behaviour is DECLARED HERE, in one place, and transcribed by hand into answer-key.yaml. internal/exploit then demonstrates each entry against a running copy, importing nothing from internal/routes. Two implementations that never share a line, agreeing on what this application does.
Unlike the other labs this one needs no external product and no network: it is a Go server, so the demonstrations run offline and deterministically, on anyone's machine, every time.
Index ¶
Constants ¶
const ( // TokenA and TokenB are two different accounts. Neither is an admin. TokenA = "fixture-token-a" TokenB = "fixture-token-b" // RecordA is what /invoices/42 returns to ANY signed-in caller. It belongs // to account A, which is the bug: the endpoint checks for a session and // not for ownership. RecordA = `{"id":42,"customer":"acme","contact_email":"ap@acme.invalid"}` // PublicRecord is what /system/mode returns to ANYONE, including callers // with no credential at all. It carries an address, which is what raises // it above a status page. PublicRecord = `{"success":true,"data":{"mode":"maintenance",` + `"updated_by_email":"ops.lead@example.invalid","updated_at":"2025-03-04T09:14:00Z"}}` // BypassPath is refused to a plain request and served when a rewrite // header names it -- a proxy authorising the path it received and // forwarding the one the header names. BypassPath = "/admin/users" // BypassRecord is what that bypass yields. BypassRecord = `{"users":[{"role":"admin","contact_email":"root@example.invalid"}]}` )
The four behaviours, stated once. answer-key.yaml transcribes these.
Variables ¶
var Spec = map[string]any{ "openapi": "3.0.0", "info": map[string]any{"title": "fixture", "version": "1"}, "paths": map[string]any{ "/system/mode": getOp("read system mode"), "/invoices/{id}": getOp("read one invoice"), "/admin/users": getOp("list users"), "/crm/customers": getOp("list customers"), "/internal/logs": getOp("read internal logs"), }, }
Spec is the specification the API publishes to anyone.
It names endpoints the front end never calls, which is the whole reason a specification is worth reading.
Functions ¶
Types ¶
This section is empty.