MYTHOSAI

Offline learning workbooks · Fictional cases

Web API access decision using owned sample documents

See how a vulnerable resource decision differs from a server-side owner check.

What this miniature lab demonstrates

See how a vulnerable resource decision differs from a server-side owner check.

Set up a harmless offline test

Requires Python 3. Run only on your own computer in a text console. No packages, accounts, network connections, malware, production logs or cloud credentials are required. Copy the example into a file or download the runnable script. The script includes assertions that fail if the expected behaviour changes.

documents = {"invoice-A": "mina", "invoice-B": "alex"}
def read_document(requester, doc_id):
    if doc_id not in documents:
        return 404
    if documents[doc_id] != requester:
        return 403
    return 200

cases = [("mina", "invoice-A", 200),
         ("mina", "invoice-B", 403),
         ("alex", "invoice-B", 200),
         ("mina", "missing", 404)]
for who, document, status in cases:
    actual = read_document(who, document)
    assert actual == status
    print(who, document, actual)

Output from the bundled script

The following text was generated by running this exact script in an offline Python environment during package validation. It is not a product or attacker simulation result.

mina invoice-A 200
mina invoice-B 403
alex invoice-B 200
mina missing 404

Interpretation and limits

A pure Python function stands in for a web handler. It has no network listener, database or authentication provider. The purpose is to reason about object-level authorisation, not to issue requests against websites.

Questions to discuss

Why can hiding a button never replace the server-side ownership check? What logging can preserve privacy while explaining denials?

To practise further, open the web defence learning track and download a three-case CSV from any individual guide. Those records are fictional and deliberately contain an ambiguous case for analysis.

Primary sources

Scope: An illustrative educational model tested for deterministic output; no real-world security effectiveness or deployed vulnerability assessment is claimed. If a command, API or framework changes, follow the current official documentation and obtain approval before changes to real systems.