application

package
v0.1.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

View Source
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

func API

func API() http.Handler

API returns the backend handler.

Every branch is one line in answer-key.yaml. Nothing here is incidental: the refusals are as much of the ground truth as the exposures, because a scanner that reports them is worse than one that misses the leak.

func App

func App(apiURL string) http.Handler

App returns the front end, which names the API by absolute URL.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL