Free learning / 50-minute lab + optional token/context workshops
Identity 101: a login is not permission
Separate authentication, authorization and tenant scope. Follow a document through its access checks, then run five real local database cases before adding retrieval and agents. An optional workshop verifies real locally signed tokens before those reads.
No account needed. Use your own copy for writing and keep the original as a reference.
Engineering lab library / Run locally
See which requests may reach the data.
Predict five cases, compare the actual query and returned-row counts, then change one request input at a time. Keep trusted identity separate from generated arguments.
Real in-memory SQLite reads with fictional records. Identity verification is supplied as a fixture; no login, model, network or production database is used.
Search titles, outcomes and prerequisites, then narrow by runtime.
2 of 2 labs · All labs
Start here / Real library, SDK or framework · Scripted inputs
Token validation before document access
Distinguish token rejection, missing action scope and a current document grant using actual local verification.
Python 3.11+ · Pinned PyJWT + cryptography · Fictional tokens · No account
Python 3.11+ · Standard library
Document access and tenant scope
Compare identity/scope/grant reads, then inspect actual context selection, accidental agreement and a removed read grant.
Python 3.11+ standard library · No model, network or account
You sign in to a support application and ask an assistant to find a maintenance procedure. The assistant finds a close match. Before it reads the document, the application has another job: establish whose request this is and whether that person may read that particular document.
This original 50-minute lesson separates those decisions. Start with the visual, predict five cases, then run a small Python program that performs actual database queries. All organizations and records are fictional. No account, model or network connection is needed.
1. Start with the building badge
UNDERSTAND THE SYSTEM
Follow a document request through its access checks
A building badge identifies you; permission opens a particular room. Follow the same distinction in software: a verified caller, one active organization and a document read. These are authored lab cases with real local query behavior and a supplied identity fixture.
Watch one example, step by step.
Read the full worked example
- 01Separate the two inputs
The request names P-7; trusted context identifies U-7 in North. The document ID alone does not tell the application which organization's file is allowed.
Before the first read: Request: P-7 · trusted workspace: North
- 02Read the permitted document
The scoped query matches North/P-7 and U-7's read grant. South/P-7 is a different record even though the identifier matches.
allowed case: 1 query · 1 permitted row · North checklist
- 03Stop without a caller
The anonymous case has no verified caller context. The program cannot infer an identity from the requested document and returns before querying.
anonymous case: No query · sign_in_required · no document
- 04Refuse a workspace claim
The request asks for South while trusted context remains North. Even a person with membership in both organizations must use a separately verified workspace switch.
claim-tenant case: No query · not_available · scope unchanged
- 05Check permission within North
P-8 belongs to North, but U-7 has no read grant for it. The query returns zero rows. Being in the right organization is necessary but not sufficient.
restricted case: 1 query · 0 rows · no incident notes
- 06Recheck after permission changes
The revoked case first returns North/P-7, removes its read grant, then repeats the request. The second query returns no document; the earlier response remains an earlier observation.
revoked case · second read: Current query: 0 rows · earlier response already delivered
Read the connections in plain English
- 01Proposed request → Access check
Treat the requested document and optional tenant claim as untrusted input.
- 02Trusted context → Access check
Use the verified active workspace, never a tenant selected by the model.
- 03Access check → Document query
Bind the document ID and trusted scope as query parameters.
- 04Current read grant → Document query
Join the document to the current caller's read grant in the same organization.
- 05Document query → Returned content
No matching row means no document content is returned.
- 06Access check → Returned content
Missing identity or a mismatched scope can stop before a document query.
Check your understanding: A valid North login asks for North/P-8. Must the application return it?
No. The caller still needs permission for that document and action. The restricted lab case has a valid supplied identity and matching organization, but its scoped query returns zero rows. Enforce that boundary before data enters model context.
A badge check establishes who you are. The lock on a room decides whether you may enter. If two companies occupy the building, having a valid badge does not give you access to both companies' files.
In software, authentication establishes a person or workload identity. Authorization decides whether that identity may perform an action on a resource. Tenant isolation keeps one organization's data and actions within its permitted scope. A tenant is often a customer organization in a shared application.
The analogy stops at the door: software may need to check every document request, background job and citation, even after sign-in. A person can belong to multiple organizations while working within one explicitly selected workspace.
For an FDE building an agent, this is practical architecture. The model can suggest a document to read. The application's trusted code determines who is asking and which records are available. An instruction such as “use the South tenant” cannot grant that authority. These responsibilities follow the OWASP authorization guidance.
2. Read the small access map
The exercise has two organizations, North and South, that both use document ID P-7. The same short identifier therefore names different records in different organizations.
| Record | Content | U-7 may read it? |
|---|---|---|
| North / P-7 | A fictional North checklist | Yes, in the North workspace |
| South / P-7 | A different fictional South checklist | Yes, in the South workspace |
| North / P-8 | Fictional internal incident notes | No |
The supplied trusted context is U-7 in north. It represents the result of identity and workspace verification; this exercise does not implement that verification. The request's document_id is untrusted input. An optional tenant field is checked against the trusted scope and cannot switch it.
Three terms will help you read the code. A principal is the person or workload making the request. A grant is a recorded permission, such as U-7 being allowed to read North/P-7. A scoped query constrains the database read using that caller, active organization, requested document and allowed action.
2a. Verify a token for this API
The five-case database exercise below deliberately starts with a trusted identity fixture. This optional 25-minute workshop examines the preceding boundary: what makes an incoming token acceptable to this API in the first place?
A JSON Web Token (JWT) carries claims and, in this exercise, a digital signature. Decoding its claims is not verification. A signature protects the signed bytes; it does not encrypt them. An OAuth access token is used with a resource server, while an OpenID Connect ID token serves the client’s sign-in flow. Do not substitute one merely because both can be signed JWTs. Not every OAuth access token is a JWT.
Download fde-token-validation-lab.py and its companion fde-token-validation-requirements.txt. Use Python 3.11 or newer and an isolated environment. The initial package installation needs access to your approved package source. The exercise itself runs locally without a listener, cloud account, identity provider or model call.
python3 -m venv .venv
.venv/bin/python -m pip install -r fde-token-validation-requirements.txt
.venv/bin/python fde-token-validation-lab.py compareOn Windows use .venv\Scripts\python.exe instead of .venv/bin/python. The program generates temporary RSA keys in memory and genuinely signs fictional tokens. PyJWT validates them using a fixed trusted public key and RS256 algorithm. It never prints private keys or complete tokens. It changes neither the training platform’s authentication nor your computer’s certificate trust settings.
Read the configured contract before the results:
| Check | Question it answers |
|---|---|
| Trusted key and allowed algorithm | Does this signature verify under the application’s chosen key and algorithm? |
Issuer (iss) | Is the token from the issuer this API expects? |
Audience (aud) | Is this API an intended recipient? |
Token type (typ) | Does it have the selected access-token profile, at+jwt? |
| Expiry and time claims | Is it within the accepted validity period? |
| Action scope | Does the verified token include the complete documents:read scope? |
| Current resource grant | May this subject read North/P-7 now? |
The application fixes these expectations. Incoming fields cannot choose a new trusted issuer, key or accepted algorithm. A subject is understood within its issuer’s context; client_id identifies a client and is not a grant to every record. North is still a separate application workspace fixture in this lab, not an organization selected by a model or token argument.
Predict each outcome before reading results:
| Case | Token decision | Document query | Permitted rows |
|---|---|---|---|
valid | Accepted | Executes | 1 |
signature-tampered | Rejected | Not executed | 0 |
wrong-audience | Rejected despite valid signature | Not executed | 0 |
wrong-type | Rejected despite valid signature | Not executed | 0 |
expired | Rejected | Not executed | 0 |
missing-scope | Accepted, action scope refused | Not executed | 0 |
valid-no-resource-grant | Accepted, scope accepted | Executes | 0 |
wrong-issuer | Rejected despite valid signature | Not executed | 0 |
future-nbf | Rejected before its validity begins | Not executed | 0 |
Inspect token_validation, validation_error, scope_check, query_executed, rows_returned and permitted. Refusal before a query is different from a real permission-constrained SQLite query returning no row. The local report explains these differences for learning; a public API should avoid leaking sensitive claim values or record existence through detailed error responses.
Change one condition. Preserve the original and edit a separate copy. Change only EXPECTED_AUDIENCE from urn:lockedin:training:documents to urn:lockedin:training:billing. Run compare again. Predict why valid is now refused and wrong-audience can pass. Other conditions, including scope and the current grant, still apply. The edit deliberately represents another intended resource server. It is not the fix for a documents API receiving the wrong token; obtain the correctly intended token through the authorized flow and restore the original verifier configuration.
This is a local verification and authorization experiment, not an OAuth server or SSO integration. It does not implement login, discovery, key rotation, remote revocation, delegated consent or production workspace selection. The selected profile follows the distinctions in RFC 9068 access-token validation and RFC 8725 validation guidance, checked 25 October 2026. An unexpired token still does not override a removed resource grant. The SQL experiment below makes that final boundary visible.
UNDERSTAND THE SYSTEM
A valid signature is only the first boundary
Follow four representative outcomes from the nine-case Python lab. These are worked examples; the browser does not receive or validate tokens. The downloadable exercise performs the signature and database checks locally.
Watch one example, step by step.
Read the full worked example
- 01Read the permitted document
The locally signed access token is accepted for the documents API, includes documents:read and identifies U-7. The fixed North workspace and current P-7 grant admit one row. A legitimate success is essential alongside refusals.
VALID: Token accepted · 1 permitted row
- 02Reject another recipient
The signature and issuer are valid, but the token names the billing API. The documents API refuses it before scope or document lookup. Sharing an issuer or signing key does not make APIs interchangeable recipients.
WRONG AUDIENCE: Wrong audience · no document query
- 03Stop before the query
This token passes validation for the documents API, but has no documents:read scope. The action check refuses it before the database read. Token validity and permission for this operation are separate observations.
MISSING SCOPE: Missing scope · no document query
- 04Check the current grant
The token and read scope pass, but this case has no current North/P-7 read grant for U-7. The real SQLite query executes and returns zero rows. An earlier token does not create a missing resource permission.
NO RESOURCE GRANT: Token accepted · 0 permitted rows
Read the connections in plain English
- 01Signed token → This API's verifier
Apply this API's trusted policy, not instructions from the incoming claims.
- 02This API's verifier → Requested action
Pass verified claims to the action check only after all token checks succeed.
- 03Requested action → Current record grant
Action scope permits asking the current resource policy; it does not bypass it.
- 04Current record grant → Permitted result
Return only the document admitted by the current permission-constrained query.
Check your understanding: A token is correctly signed for another API. Should you accept it because the issuer is familiar?
No. This API must validate its intended audience under trusted configuration. Obtain the right token through the authorized flow; disabling audience verification changes the boundary rather than fixing the request.
3. Run five access cases
Coming from the landing-page example? After these five reads, run the source-to-context comparison to reproduce the North/South selection and challenge an accidentally correct result.
Download fde-identity-boundary-lab.py into an empty practice folder. Use Python 3.11 or newer. The program creates a fresh in-memory SQLite database for each run and closes it afterward; it does not write files or open a listener.
Before running each command, predict whether a query will execute and whether any document text will return.
python3 --version
python3 fde-identity-boundary-lab.py allowed
python3 fde-identity-boundary-lab.py anonymous
python3 fde-identity-boundary-lab.py claim-tenant
python3 fde-identity-boundary-lab.py restricted
python3 fde-identity-boundary-lab.py revokedInspect trusted_context_fixture, untrusted_request and each observation's query_executed, rows_returned and response. These are local teaching traces, not production error responses or a model transcript.
| Case | Expected observation | What it teaches |
|---|---|---|
allowed | One query, one permitted row, North checklist | Caller, organization, document and read grant all match. |
anonymous | No query; sign_in_required | There is no verified caller context to authorize. |
claim-tenant | No query; not_available | Asking for South cannot change the trusted North workspace. |
restricted | Query returns zero rows; not_available | Being in North does not grant access to every North document. |
revoked | First read succeeds; the next returns zero rows | Removing the grant affects the next access check, even for the same caller. |
In revoked, the program retains the first observation so you can compare it with the second. Revocation prevents the later read; it cannot erase information already delivered. This single-process example does not test concurrent requests, cached responses or distributed revocation.
3a. Run the source-to-context comparison
Optional 20-minute extension. Keep the same standalone Python file. This moves the landing page's illustrated source decision into actual SQLite reads. It still makes no model call or generated answer, and supplies identity and candidate order as fixtures. The first two candidates match the landing-page illustration; a third, restricted North/P-8, supports the changed case below. Candidate identities are proposed metadata, not a permission receipt or a search-ranking result.
Predict the context packet for both paths before opening each report:
python3 fde-identity-boundary-lab.py context-selection > context-original.json
python3 fde-identity-boundary-lab.py context-selection --candidate-order north-first > context-north-first.json
python3 fde-identity-boundary-lab.py context-selection --north-grant revoked > context-revoked.json
python3 fde-identity-boundary-lab.py context-selection --candidate-order restricted-first > context-restricted-first.jsonEach command runs two independently reset in-memory databases with the same inputs. deliberately_unchecked directly reads its first proposed workspace/document without checking current workspace or grants. That is an intentionally broken teaching comparison over fictional rows. scoped passes candidates through the existing read_document function until the first allowed source is found; refused bodies are not put in its context. Both paths stop after their first returned source. This is a one-source policy, not a complete retrieval strategy.
| Supplied condition | Deliberately unchecked context | Scoped context | Receiving question |
|---|---|---|---|
| South/P-7, North/P-7, North/P-8; both P-7 grants present | South/P-7: checklist S | North/P-7: checklist N | Did trusted North scope survive the proposed South identity? |
| Same records/grants, North/P-7 comes first | North/P-7: checklist N | North/P-7: checklist N | Did the same text come through the same checks? |
| Original order, North/P-7 grant removed before each path | South/P-7: checklist S | Empty | Was another workspace used to fill the missing permitted context? |
| North/P-8 comes first; both P-7 grants present | North/P-8: restricted incident-note fixture | North/P-7: checklist N | Was active-workspace membership confused with document permission? |
Inspect candidates, trusted_context_fixture, paths, each path's attempts, sql_reads, context and unattempted_candidates. The SQLite trace callback records SELECT statements actually executed after fixture preparation. A foreign-workspace candidate is refused before a scoped body query. A North candidate without its read grant produces an actual permission-constrained query with zero returned rows. Those are different observations.
In the original scoped path, South is refused, North/P-7 returns one row and North/P-8 is unattempted. Do not report that last candidate as rejected or inspected. With North/P-7's grant removed, both North reads return zero permitted rows and the scoped packet stays empty. The South read grant still exists; it cannot switch the active workspace or fill the packet. In restricted-first, North/P-8's refusal shows why a workspace filter alone would be insufficient.
north-first is the adversarial control: both paths produce the same North text even though the broken path has no authorization check. Inspect its direct SELECT and then remove North's grant while retaining north-first. A correct body in one run does not establish a safe mechanism. These are sequential local reads; current permitted context also does not establish model faithfulness, verified login, source freshness, cache invalidation or race-free revocation.
Receive it as a pair. Builder A predicts and runs the original comparison. Receiver B locates the actual body, SQL and unattempted candidate without replacing A's account. Swap roles for north-first, then agree one changed-grant run. Each participant keeps their own prediction, exact command/file/version, observed context and query references, assistance and correction. Solo practice remains self-review. The application owner receives the access-path question, the search owner receives candidate-order/coverage questions, and the identity/source owners receive current-principal and grant-ordering evidence requests. A pod lead agrees the next bounded receiving test; this exercise grants no deployment permission, qualification or client placement.
UNDERSTAND THE SYSTEM
Follow the source that actually enters context
Four authored comparisons explain the downloadable SQLite experiment. Candidate order and identity are supplied fixtures. The browser runs no query or model; each unchecked/scoped comparison starts from separate memory databases.
Watch one example, step by step.
Read the full worked example
- 01Keep the question and candidates fixed
With South/P-7 first, the unchecked path returns checklist S. The scoped path refuses South before a body query and reads North/P-7 for checklist N. North/P-8 remains unattempted after that first permitted source.
south-first / North grant present: Unchecked: South/P-7 · scoped: North/P-7
- 02Expose accidental agreement
Put North/P-7 first. Both paths return its text, but only the scoped path ran the permission-constrained read. One matching output does not establish the mechanism; inspect SQL and then remove the grant.
north-first / North grant present: Same North text · different checks
- 03Remove the current North grant
Return to South-first order and remove North/P-7's read grant before each path. The broken path still returns South. The scoped path refuses South and gets zero permitted rows for both North candidates, leaving its packet empty.
south-first / North grant revoked: Unchecked: South/P-7 · scoped: empty
- 04Separate workspace from document permission
Put restricted North/P-8 first. The unchecked path returns its incident-note fixture. The scoped path receives zero permitted rows for P-8, refuses South, then admits North/P-7. Being in North is not permission for every North record.
restricted-first / North grant present: Unchecked: North/P-8 · scoped: North/P-7
Read the connections in plain English
- 01Candidate identities → Unchecked body read
The teaching comparison performs a direct read for the first supplied identity.
- 02Unchecked body read → Actual context packet
Its returned source can belong to another workspace or lack the current read grant.
- 03Candidate identities → Current read boundary
A candidate proposes a record; it does not grant permission to use its text.
- 04Trusted fixture scope → Current read boundary
Keep the trusted active workspace and current subject/read grant together.
- 05Current read boundary → Actual context packet
Only an allowed source read contributes text; a refused candidate is not a fallback.
- 06Actual context packet → Receiving engineer
Compare actual context with the SQL and decisions that produced it.
Check your understanding: If both paths return the North checklist once, is the unchecked path safe?
No. A supplied order can make an unchecked read look correct. The foreign-workspace, revoked-grant and restricted-record comparisons expose its missing boundary. Current permitted context still does not prove a model used that source faithfully or that a real identity/concurrency policy has been verified.
4. See where the boundary is enforced
Open the read_document function. It receives trusted principal separately from the proposed request. Without a principal it returns before querying. A mismatched tenant claim also returns before querying. The remaining read joins documents to current grants and constrains the result by organization, document, caller and action.
SELECT d.id, d.text FROM documents AS d
JOIN grants AS g ON g.tenant = d.tenant AND g.document_id = d.id
WHERE d.tenant = ? AND d.id = ? AND g.subject = ? AND g.action = 'read'The values are bound as query parameters. The organization comes from trusted context. The document ID is an input to a permission-constrained lookup; knowing it is not sufficient to retrieve it. A missing document and a document with no matching grant both produce not_available without returning document text.
This is application-enforced query scoping. SQLite is not independently applying row-level tenant policy here, and a different unrestricted query could bypass the example's function. A production design must cover every path, including search, citations, exports, workers and caches. The OWASP multi-tenant guidance is a starting point for examining those paths.
5. Change one input and explain the result
Make two separate copies of the original file. Preserve the original for comparison.
In the first copy, find the line marked Experiment A. Change only "south" to "north", then run claim-tenant using that copy's filename. It should return North/P-7. You changed the requested organization to match the existing workspace; you did not grant South access or switch workspaces.
In the second copy, find the line marked Experiment B. Change only "P-8" to "P-7", then run restricted. It should return North/P-7 because the supplied read grant covers that record. P-8 remains restricted.
Save your predicted and observed results. Point to the exact comparison or query condition responsible. If you cannot explain why the result changed, revisit the access map before adding a framework.
5a. Prove the grant belongs to this workspace
A database join pairs rows according to the conditions you supply. Our composite key uses more than one field: (tenant, id) identifies a document. North/P-7 and South/P-7 are different resources. A grant must refer to the same resource, caller and action; matching only the short document ID is insufficient.
Run a second experiment using the same downloaded file:
python3 fde-identity-boundary-lab.py compare-joinsIt creates four independent, fictional in-memory cases and compares the existing guarded read with an intentionally broken query. No real identity, service or customer database is involved. Both paths use bound parameters and select d.tenant from the supplied trusted context. The meaningful difference is here:
-- Complete relationship in the guarded query:
JOIN grants AS g ON g.tenant = d.tenant AND g.document_id = d.id
-- Deliberately broken relationship, for this local comparison only:
JOIN grants AS g ON g.document_id = d.idBoth still check the requested document ID, caller and read action. Bound parameters keep supplied values from becoming SQL syntax; they do not add a missing authorization relationship. Filtering the document to North does not automatically constrain the grant to North.
Predict each pair of row counts before inspecting the JSON. The broken path uses fetchall() so a duplicate match cannot disappear behind fetchone(). Its document_tenant and grant_tenant fields are synthetic teaching diagnostics, not a recommended public error response.
| Case | Trusted workspace | Remaining read grants | Guarded rows | Missing-binding rows |
|---|---|---|---|---|
| both-read-grants | North | North and South | 1 | 2 |
| south-grant-only | North | South only | 0 | 1 |
| south-workspace | South | South only | 1 | 1 |
| no-read-grants | North | None | 0 | 0 |
In the first case, the broken query returns the same North text twice, once with each grant. In the second, North's permission is gone but South's grant still matches North/P-7. Inspect document_tenant: north beside grant_tenant: south. The trusted workspace has not changed; the query has misapplied permission from another workspace to a North document. It does not return South's document.
The South control changes the supplied trusted context in a separate fixture, representing a workspace switch that a real application would have to verify. An untrusted tenant argument still cannot make that switch in the original five cases. The final refusal is necessary but insufficient: even the broken query refuses when no grants exist. Keep positive and discriminating negative cases together.
Repair the relationship, not the presentation
Make one separate copy of the original file. In compare_join_binding, restore g.tenant = d.tenant AND to the deliberately broken JOIN. Keep the four cases and their data unchanged. Predict missing-binding row counts of 1, 0, 1, 0, then run that copy and compare. Its report field retains the original label, so record the actual edit with your output. The guarded results should stay unchanged.
Explain why adding DISTINCT would leave the second case's unauthorized single row intact. Explain why taking just the first row would conceal the first case's extra match. Neither change restores the permission relationship.
The deletions and reads occur sequentially on one connection per case. SQLite lets that connection see its own preceding changes. This is not evidence of cross-connection propagation, race-free revocation, cache invalidation or recall of previously delivered content. The policy is enforced by application queries; the lab does not configure database row-level security. A real deployment must verify every receiving path and the chosen permission-change ordering policy.
Primary reading checked 25 October 2026:
UNDERSTAND THE SYSTEM
A tenant filter is only half of this access check.
Compare two real SQLite reads over fictional documents. Both filter the document to the trusted workspace; only one binds the permission to that same workspace. The four cases are reproduced by the free lab. Caller verification is supplied, not performed.
Watch one example, step by step.
Read the full worked example
- 01Both read grants exist
The guarded North read returns one row. The broken join matches both North and South grants to North/P-7, returning two rows containing the same North text. The duplicate exposes an extra permission relationship; it is not merely a display defect.
LOCAL SQLITE · BOTH READ GRANTS: Guarded: 1 row · missing binding: 2 rows
- 02Only South permission remains
Remove the North read grant in a fresh fixture while North remains active. The guarded read returns no content. The broken join still returns North/P-7 using South's remaining grant. The workspace did not switch, and South's document was not returned: the wrong grant authorized the North read.
LOCAL SQLITE · SOUTH GRANT ONLY: Guarded: 0 rows · missing binding: 1 row
- 03Use the legitimate South scope
A separate fixture supplies South as the verified active workspace, with only the South grant remaining. Both queries return South/P-7. This positive control shows that a person with authorized South access can read there. Editing an untrusted tenant argument is not the same operation.
LOCAL SQLITE · SOUTH WORKSPACE: Guarded: 1 row · missing binding: 1 row
- 04Remove all read grants
Both queries return no rows in this fresh North fixture. That negative case alone would miss the broken join. Keep allowed and wrong-tenant-grant cases in the same regression set; a test suite containing only refusals cannot establish useful authorization.
LOCAL SQLITE · NO READ GRANTS: Guarded: 0 rows · missing binding: 0 rows
Read the connections in plain English
- 01Caller + grant facts → Match the full grant
Use the supplied trusted workspace and the complete grant relationship.
- 02Match the full grant → Guarded result
Only a permitted row can return content through the guarded path.
- 03Caller + grant facts → Omit one relationship
Keep the caller, requested document and database facts unchanged between the two queries.
- 04Omit one relationship → Inspect every match
Count all matching rows and compare the tenant on each side of the join.
Check your understanding: Would DISTINCT, fetchone() or parameterized SQL repair the missing permission relationship?
No. They address duplicate presentation, retrieval size or how values enter a statement. None requires a grant to belong to the selected document's tenant. Preserve the complete authorization relationship and test the otherwise-valid mismatched-grant case. This is a local application-query demonstration, not database row-level security or a production audit.
6. Carry this into an agent workflow
Sketch a request from a signed-in user through an agent's read_procedure tool to a data service. Draw trusted caller context on a separate path from generated tool arguments. Mark where a document can first enter model context.
Now give the model a highly relevant result from the other organization. Explain why it must be excluded before the model receives its content. Then remove the user's read grant and consider a previously cached answer or a queued job. Identify the current permission check each path would need; neither path is implemented by this exercise.
Keep a small evidence sheet: five predictions, actual query and row counts, the two edited-copy outcomes, your data-flow sketch and one remaining production gap. Have another person explain why a valid login can still produce not_available.
6a. Observe database-enforced row policies
The SQLite exercise above enforces access in application queries. To inspect a separate database policy boundary, use the optional PostgreSQL role-security workshop. It runs ten actual PostgreSQL 17 cases in a disposable local container, including owner/BYPASSRLS behavior, write refusal and permissive policies combining with OR. Keep the supplied connection identity distinct from verified application authentication. A receiver reruns an ordinary and a denied operation and names the remaining pool, function or export checks.
7. Continue into protected retrieval engineering
Continue in the authorized Academy lesson, Keep retrieval inside the right boundary, to add source freshness, cache scope, citation access and a receiving-team design task. The existing agent-engineering workbook provides a deeper context-building exercise.
Primary references checked 21 October 2026: OWASP Authorization Cheat Sheet and OWASP Multi-Tenant Security Cheat Sheet. The lab and lesson are original LockedIn Labs material. They do not establish a production security assessment or vendor certification.
7. Separate candidate coverage from current-source access
The optional retrieval-limit workshop uses actual in-memory SQLite FTS5 ranking. Compare an empty late-filter result with available permitted sources, then change the candidate limit and one current grant or source revision. Retain the separate body-read decision and receiving action; a smaller packet does not justify using a rejected source. The exercise is sequential and lexical, not an ANN, authentication or concurrency proof.
A first tool-boundary exercise
For a first tool-design session, use the separate tool-boundary and receiving worksheet. Allow 45 minutes plus setup as a foundation route; it is not another requirement inside the guide's 50-minute core. It uses the existing five standard-library access cases and complete-grant comparison, with no model, account, package install or MCP connection.
Map operation, arguments, trusted context, resource permission and safe output before running. Preserve the useful North read as well as refusals, distinguish a query returning no permitted row from a query never executed, and retain the first observation after grant removal. The worksheet then asks a receiving engineer to locate the actual predicate and specify an unimplemented equipment update with separate write authority, conflict, duplicate and uncertain-outcome controls. Each person keeps their own command, explanation and assistance.
The existing grant relationship diagram explains why parameterization and a document-tenant filter do not repair a missing grant-tenant join. The deeper tool-boundaries foundations lesson retains normal Academy access. These local reads do not establish real identity verification, MCP interoperability, concurrent revocation or production write authorization.