Skip to content

Studio 04 / Code review

Find the missing authorization boundary.

Inspect synthetic Node-style backend code, switch between unsafe and guarded handlers, and run deterministic object-access tests. Then explore the publicly runnable implementation.

01 / Inspect the code

Authenticated does not mean authorized.

This deliberately unsafe handler lets any signed-in account access an object by ID. The guarded version scopes each query to its caller's tenant.

// Deliberately vulnerable: authentication alone is insufficient
async function readDocument(session, documentId) {
  if (!session) return { status: 401 };
  const document = await db.document.findUnique({
    where: { id: documentId }
  });
  if (!document) return { status: 404 };
  return { status: 200, body: document };
}

Review finding: the database lookup lacks a tenant predicate. The session check cannot enforce resource ownership.

02 / Run a synthetic request

Principal

alice

Requested object

b-202

Returning another tenant's document is a confirmed flaw in the synthetic unsafe handler.

Open the runnable API lab

All results are determined by local synthetic fixtures. This visual exercise does not evaluate arbitrary code, scan a server, access real data or run an actual database.