14 · Verify safety boundaries
Use the same F-250 request in two signed-in sessions and verify exactly what each session receives.
- Part 4
- Operate and release
- Model
Qwen2.5-1.5B-Instruct- Data
- Synthetic facilities helpdesk
- Hardware
- Tesla T4 and CPU, in Google Colab
Should the desk show the F-250 inspection date?
A Facilities Helpdesk operator has fan F-250 selected and asks when it was last inspected. The date belongs to the yard that owns the fan. A second operator asks the same question with the same fan selected. Before the desk replies, which piece of information decides who gets the date?

“When was F-250 last inspected?”
F-250Check which operator gets the date
The North Yard session returned 2025-11-08. The South Yard session used the same proposal and attempted a scoped read, but returned no record.
Change one fact. Hold the request, operation, selected fan and operator role fixed. Change the tenant supplied by sign-in.
| Signed-in tenant | What the desk should do |
|---|---|
| North Yard, which owns F-250 | Return the inspection date from the yard’s record. |
| South Yard | Keep the response empty after the scoped lookup. |
The request identifies the record the operator wants. The signed-in session supplies the tenant that may read it. AWS’s reference architecture uses temporary session tags to carry a tenant ID into the resource check for services including DynamoDB. AWS Security, SaaS tenant isolation
The model missed authorised reads while the dispatcher kept the other sessions empty
Exact status and response on the same matched requests
1| Proposal | Strict | Allowed dates | Blocked releases |
|---|---|---|---|
| Structured proposal | 96/96 | 24/24 | 0/72 |
| Model proposal | 78/96 | 15/24 | 0/72 |
| Paired sample | Model − structured (pp) | 95% interval (pp) |
|---|---|---|
| All matched sessions | −18.75 | −25.00 to −12.50 |
| Owner sessions | −37.50 | −50.00 to −25.00 |
Give the dispatcher the trusted session
The model can propose an operation and an asset. The application provides the signed-in tenant and role, the selected asset and cancellation state. The host checks the session before it examines the proposal and checks the selected asset before a read. The inventory function applies the tenant and asset together.
# Reject unusable proposals before the selected asset can reach the read.
elif not valid_proposal(proposal):
status = "invalid"
elif proposal["asset"] != session.selected_asset:
status = "selection_mismatch"
else:
lookup_attempted = True
row = read_inventory(session.selected_asset, session.tenant, session.role)
status = "ok" if row else "out_of_scope"
if row:
result = {"last_inspection": row["inspection"]}The restrictions serve different purposes. A cancelled request stops before the lookup. A valid proposal in the other yard reaches the tenant-qualified read and receives no matching row. GitHub's fine-grained tokens illustrate a similar division between the resource owner, the selected repositories and the allowed permissions. Shopify's pod mapping illustrates where a shop's data lives. In the helpdesk, finding the right record location and deciding whether the session may see it are separate jobs. GitHub Docs, fine-grained personal access tokens · Shopify Engineering, shard balancing
The other yard reached a lookup. The guest stopped before it.
Host contract scenarios replayed across 12 equipment families
2| Scenario | Reads | Dates | Status | Exact |
|---|---|---|---|---|
| owner | 12 | 12 | ok | 12/12 |
| guest | 0 | 0 | denied | 12/12 |
| other yard | 12 | 0 | out of scope | 12/12 |
| cancelled | 0 | 0 | cancelled | 12/12 |
| missing asset | 0 | 0 | invalid | 12/12 |
| no proposal | 0 | 0 | invalid | 12/12 |
| different selection | 0 | 0 | selection mismatch | 12/12 |
| unknown yard | 0 | 0 | denied | 12/12 |
| owner repeat | 12 | 12 | ok | 12/12 |
Check what the model hands to the host
The recogniser gets the wording and proposes a read. The notebook emits the same model proposal for all session replays of each wording. The dispatcher can therefore decide what happens to a well-formed F-250 request when only the tenant changes. If the output parser cannot read a proposal, the dispatcher receives an empty object.
Fifteen questions produced a usable proposal
One generated proposal per wording, before session checks
3| Proposal stage | Questions | Share |
|---|---|---|
| Asked | 24 | |
| Schema valid | 15 | |
| Selected the exact asset | 15 |
When was F-250 last inspected? · same structured read and selected fan
- North Yard · recorded
- {"status":"ok","response":{"last_inspection":"2025-11-08"}}
- South Yard · recorded
- {"status":"out_of_scope","response":null}
The tenant changed in the sign-in session. Each row attempted the same scoped lookup. The other yard received an empty body.
F250-00 · When was F-250 last inspected?
- Model proposal
- {"operation":"lookup_inspection","asset":"F-250"}
- Owner · recorded
- {"status":"ok","response":{"last_inspection":"2025-11-08"}}
- Other yard · same proposal
- {"status":"out_of_scope","response":null}
The proposal recognised the fan. The host still used session scope to decide whether to return the record.
F201-00 · When was P-201 last inspected?
- Raw model output
- ```json {"operation":"lookup_inspection","asset":"P-201"} ```
- Owner · expected
- {"status":"ok","response":{"last_inspection":"2025-10-13"}}
- Owner · recorded
- {"status":"invalid","response":null}
- Other yard · recorded
- {"status":"invalid","response":null}
The Markdown fence made the full string invalid JSON. The owner lost a date they could receive. The other yard still received no date, but the status was invalid instead of out of scope.
The model gave a usable proposal for the F-250 opening in both wordings. On the recorded P-201 request, the model returned an otherwise readable object inside a Markdown code fence. The parser rejected the whole string. For the owner, that lost an allowed date. For the other yard, the same failure still withheld the date, but produced invalid before the scoped read could produce out_of_scope.
Score the decision and the disclosure separately
The desk must both decide correctly and avoid disclosing material outside the operator's authorization. A helpful answer can fail the second requirement even when the first is met.
A dispatch passes the strict grade only when its exact status and response match. Let B denote the blocked sessions and A the sessions expected to receive a date. An unexpected non-empty response in (B) counts as a scope exposure. An empty response in (A) counts as a false denial. A wrong returned date is counted separately.
An empty body kept the boundary even when the status missed
Exact response and date release by matched session scenario
4| Session / proposal | Exact | Empty allowed | Blocked release |
|---|---|---|---|
| owner Structured proposal | 24/24 | 0/24 | — |
| guest Structured proposal | 24/24 | — | 0/24 |
| other yard Structured proposal | 24/24 | — | 0/24 |
| cancelled Structured proposal | 24/24 | — | 0/24 |
| owner Model proposal | 15/24 | 9/24 | — |
| guest Model proposal | 24/24 | — | 0/24 |
| other yard Model proposal | 15/24 | — | 0/24 |
| cancelled Model proposal | 24/24 | — | 0/24 |
For the paired change, compare each wording and scenario under both input arms. Resample the equipment family as a whole so the family's related wordings and sessions stay together. The estimate uses model minus structured strict accuracy.
On owner sessions alone, the model lost 9 of 24 strict passes, a paired difference of −37.50 points (95% interval −50.00 to −25.00). Both arms withheld dates on every blocked request in this sample. That count describes the particular sessions and dispatcher exercised here.
Check what the audit keeps
The dispatch stores only the outcome status and a marker for whether data was returned. The synthetic worked evidence contains messages and dates in a separate teaching artefact. In the minimal audit, a reviewer can see whether the desk returned a value, but cannot reconstruct which date or request the event refers to. Google documents a metadata audit level for GKE resources including Secrets, where request and response body capture is a separate choice. Google Cloud, GKE audit policy
# Keep the response body out of this audit event.
audit.append({"status": status, "returned": result is not None})Audit events recorded the decision and whether a value left the desk
300 recorded host dispatches across both experiments
5| Stored fields | Example returned | Example blocked |
|---|---|---|
| returned | true | false |
| status | ok | denied |
0/300 events held request or response body fields.
Separate recognition time from permission checks
The model batch timer includes formatting, tokenisation and generation. The host dispatch timer includes the scoped read when one is attempted and appending the audit event. Compare the figures at their own measurement boundaries. Google’s Zanzibar paper serves authorisation as a separate service and reports its own Check API latency. A local dispatch median here describes a different workload. Pang et al., Zanzibar, §§2.1–2.2 and Table 2
Proposal generation and host dispatch ran on different clocks
T4 generation batches and separate CPU dispatch medians
6| Generation | Questions | Wall time (ms) |
|---|---|---|
| First batch | 4 | 2863.6 |
| Batch 2 | 4 | 751.3 |
| Batch 3 | 4 | 953.1 |
| Batch 4 | 4 | 927.6 |
| Batch 5 | 4 | 1032.5 |
| Batch 6 | 4 | 817.3 |
| Host path | Median dispatch (µs) |
|---|---|
| Structured proposal | 4.60 |
| Model proposal | 0.91 |
Model and tokeniser load took 15.61 s.
What to keep
| Decision | Recorded result | Operating rule |
|---|---|---|
| Same-yard operator and selected fan | Structured returned 24/24 authorised dates. The model path returned 15/24. | Bind the read to the selected asset and the signed-in tenant. |
| Other-yard operator | Each arm returned zero dates. The model arm recorded nine invalid proposals. | Check both the body and the stop reason. |
| Cancelled request | Both arms recorded 24/24 cancellations with zero lookup attempts. | Read cancellation state before dispatch. |
| Different selected asset | The contract matrix recorded 12 selection mismatches with zero lookups. | Compare the proposed asset against the trusted selection. |
| Audit event | All 300 stored events used the same two fields. | Keep message and record bodies out of the event. |
The scope and cancellation checks are local and use a frozen fixture registry. Authentication, deployed datastore isolation and distributed cancellation require their own measurements.
Next to try, not tested here
- Update the selected equipment through a trusted UI event. Check whether the prior proposal is stopped.
- Change the date in a separate test record. Check whether an otherwise identical authorised request returns the new date.
- Add an opaque correlation key to the audit record. Check that the event shape still excludes request and response bodies.
How it was built
| Item | Setting |
|---|---|
| Development data | Synthetic Facilities Helpdesk, 12 equipment families, two wordings per asset and four paired session scenarios. |
| Development SHA-256 | 51dbc208b6b20a620237dd76ce0a2db4f10aa75f4f8fc404121e301b8d79a0cf |
| Separate contract matrix | 108 dispatches, including an owner repeat for each family. |
| Model and revision | Qwen/Qwen2.5-1.5B-Instruct at 989aa7980e4cf806f80c7fef2b1adb7bc71aa306. |
| Generation | Greedy, batches of four, up to 32 new tokens. Exact JSON parser. |
| Record boundary | Host CPU checks the session and proposal and performs the tenant-qualified read. |
| Strict grade | Exact status and exact response, 1,500 paired family-bootstrap draws. |
| Runtime | Tesla T4, CUDA 13.0, Python 3.13.16, PyTorch 2.14.1+cu130, Transformers 4.51.3. |
Time and cost. The verified notebook took 39.2 s on the Colab T4 and its host CPU. Model and tokeniser load took 15.61 s within that execution. The median generation batch took 940.3 ms. The reported time covers notebook execution.
Executed notebook · Summary JSON · Raw records JSON · Runtime JSON
Run it yourself
Read the opening and dispatcher to check which inputs carry authority. Use the contract matrix for the trusted session cases, then follow proposal generation and matched replay to reproduce the strict grades. The final cells check the audit shape and timings.
- Hold the question and F-250 selection fixed. Change only the signed-in tenant. Predict whether the read runs and which body returns, then inspect
opening.ownerandopening.other_yard. - Cancel the owner request. Predict whether the inventory function runs, then inspect
lookup_attempted,statusandreturned. - Replace the structured proposal with an empty object and keep the owner session fixed. Predict the stop status, then compare the response and audit event with the successful F-250 read.
How is this page?
Last updated on