A security test is hard to interpret if you cannot tell which inputs it used or which files it changed. Set up a small, disposable workbench with separate supplied fixtures, editable source and generated observations. This checkpoint checks those boundaries before you connect a model.
By the end, you should be able to identify the interpreter and supplied inputs, create a marked run without overwriting another folder, recover from a wrong working directory, and remove only that run's outputs.
Check the environment before extracting
You need a terminal, a text editor, a user-writable directory and CPython 3.13 on a current supported security patch. The Python standard library supplies all modules used here; this checkpoint installs no Python packages. The commands below use macOS zsh. Execution was checked on macOS 15.7.9 arm64 with Python 3.13.0; that older observed patch is not the recommended patch level. Linux, CPU-only inference and Windows/WSL are not claimed as tested profiles.
In your terminal, run:
python3 --version
The command identifies the interpreter that will execute the following files.
It must report the 3.13 series. If it is missing or selects another series,
obtain a separate supported 3.13 installation using the
official macOS instructions, then
select that interpreter explicitly. The installer may require your computer's
administrator permission. Do not replace the operating system's Python to make
this course command work. If you use a named interpreter such as python3.13,
substitute it consistently for python3 below.
The next lesson uses a portable Ollama 0.40.9 runner and local
qwen3:0.6b model. The measured teaching profile was an Apple M2 Mac with 16 GB
RAM using Metal, not a measured minimum-RAM or CPU-only profile. Downloads need
internet access and local disk space: the runner archive is about 181 MB and
the model package about 523 MB, with additional extraction/cache space. Reserve
several GB in the chosen disposable directory as a planning allowance. There
is no paid AI account or cloud resource in this route. This lesson's commands
read and write local files only.
Obtain the supplied files
In this lesson's Practice files panel, download AI security practice
workbench (security-workbench.zip). It is included with ordinary course
access. Extract it into a new disposable directory; do not merge it with an
existing project. The archive contains a top-level security-workbench folder.
Open a terminal in that extracted folder. For example, use cd with the actual
path you chose, then inspect the location:
pwd
ls
pwd prints your current directory. ls should show manifest.json,
README.md, fixtures, starter, tests and solution. An extractor may add
an outer folder; enter the inner directory containing the manifest. These are
ordinary local files from the course download, not a browser terminal or hosted
lab. Use only synthetic inputs; keep real tickets, credentials and personal
data out of the workbench.
| Supplied path | What it means |
|---|---|
manifest.json | Workbench identity, readiness checkpoint and SHA-256 fingerprints of the three readiness fixtures |
fixtures/principals.json | Application-selected Cedar/Rowan identities and sessions; not a login system |
fixtures/tickets.json | Two fictional owned tickets and private teaching markers |
fixtures/proposals.json | Saved example outputs, including invalid/foreign proposals; not live responses |
starter/security_lab/workspace.py | Maintained readiness and cleanup implementation |
tests/test_workspace.py | Disclosed behaviour checks using temporary copies |
solution/README.md | Explained recovery; attempt the task before reading it |
runs/<run-id>/ | Created observations, kept apart from fixtures and source edits |
A fixture is a supplied, repeatable starting input. A checkpoint names
the starting state for a lesson. Here it is workspace-readiness; no assistant
state has been mutated. A fingerprint detects accidental changes to local
inputs. Because the manifest arrives in the same archive, its hashes alone do
not authenticate that archive against a malicious distributor.
Inspect before creating a run
From the extracted root:
python3 -B starter/security_lab/workspace.py inspect
-B prevents Python from creating bytecode-cache files in the supplied tree.
The script checks the current directory, manifest identity, fixture paths,
JSON readability and each recorded hash. It prints the interpreter/platform,
checkpoint, fixture owners and hashes. It creates no runs directory and
contacts no model. Inspect all three fixture entries rather than accepting
successful exit as proof of the correct inputs.
Now create one run:
python3 -B starter/security_lab/workspace.py start --run first-a
first-a is your chosen run name, not a principal or permission. Use a lowercase
letter followed by up to 31 lowercase letters, digits or hyphens. A name cannot
contain a slash, an absolute path or ... Choose a new name for each new run.
The first start creates the workbench's runs directory and its ownership
marker. Inside runs/first-a, it creates .owner.json and readiness.json.
The markers identify this workbench path and run for conservative cleanup;
they do not authenticate a user or approve a ticket action.
This illustrative field selection shows what to inspect; the real report also includes your platform, Python patch and full fixture hashes:
{
"status": "ready",
"run": "runs/first-a",
"workbench_id": "ai-security-support-workbench",
"checkpoint": "workspace-readiness",
"model_contacted": false
}
The false model-contact flag describes this file-only command's implementation. It is not a general network audit. The platform and paths will reflect your machine. No ticket change or approval occurs at this checkpoint.
Read the guards in the actual code
Open starter/security_lab/workspace.py. You are using supplied infrastructure
here, not asked to implement an unexplained helper. Its main safeguards are:
| Code block | Why it affects behaviour |
|---|---|
main | Requires the terminal's current directory to match the extracted root and checks the CPython series before dispatching a command |
inspect and regular_child | Check manifest identity, bounded JSON files, confined relative fixture paths, no symlink input, and fixture fingerprints |
validate_run_id | Accepts one simple directory name, preventing a run argument from becoming an arbitrary path |
runs_directory | Creates a new runs root or requires an existing matching marker; an unrelated directory is preserved |
start and write_new | Refuse existing run names and use file mode x, which fails rather than replacing an existing file |
cleanup | Validates markers and the complete file list before any deletion; it never recursively removes an unknown tree |
For example, this exact excerpt is from start; run is the already
confined path and readiness is the inspected input report:
if run.exists():
raise ValueError("Run already exists; inspect it or choose a fresh run ID")
run.mkdir()
write_new(run / ".owner.json", {**owner(root), "run_id": run_id})
write_new(run / "readiness.json", readiness)
raise stops the attempted reuse. mkdir creates only the new run directory.
The first new JSON file records ownership; the second records the observation.
Removing the refusal or changing write_new from x to w could overwrite an
earlier observation. Those changes would weaken evidence preservation, not fix
a failed setup. The helper is for a private, single-user disposable tree; path
checks are not a sandbox against another local process replacing files
concurrently.
Run the disclosed self-checks
From the same extracted root:
python3 -B -m unittest discover -s tests -p 'test_workspace.py' -v
unittest is Python's included test runner. discover finds this named test
file under tests; -v prints individual results. The tests copy inputs into
their own temporary directories. They check positive readiness, collision and
wrong-directory refusal, changed fixtures, symlinks, ownership, interrupted
outputs and cleanup preservation. They do not clean your actual runs or grade
your explanation. Expect individual ok results and final OK; investigate
any failure instead of modifying the test to force a pass.
Recover without overwriting
Try both tasks before opening the reasoning:
- From the workbench root, move to its parent with
cd ... Run the script through itssecurity-workbench/starter/security_lab/workspace.pypath usinginspect. Predict and inspect the refusal, then recover the correct location and obtain readiness. If your extracted top-folder name differs, use its actual name. - Back in the root, after your first successful start, create an empty directory
with
mkdir runs/occupied. Trystart --run occupied. Recover with a fresh run name while preserving that occupied directory. Explain why adding an ownership marker yourself would not be a good recovery method.
Record which inputs, source files and outputs remained unchanged. If a real
directory was already named occupied, leave it alone and use a different
name for this controlled task.
Hint 1
The file location tells Python where the script is. The current working directory tells the workbench where you intend to operate. They must agree.
Hint 2
An existing folder does not prove exercise ownership. A fresh run name solves the collision without replacing evidence or asserting ownership of unknown files.
Answer and reasoning
The parent-directory command should return STOP: Wrong working directory
and create no run. Use cd security-workbench from that parent, check pwd
and ls, then repeat inspect. Moving the script or changing its root constant
would hide the location error instead of correcting it.
The occupied run should be refused. Start a new run such as recovered-b and
inspect its report; runs/occupied must remain untouched. A hand-written marker
would defeat the helper's basis for deciding which outputs may be removed.
If you intentionally created the empty directory yourself, you may inspect
and remove that exact empty directory later; unknown contents must be preserved.
Success means a correct readiness report and a fresh marked run, with earlier
folders and fixture/source bytes preserved. A zero exit code obtained by
overwriting a folder fails the purpose of this task. The archive's
solution/README.md explains the same recovery decisions.
Inspect, resume and clean up one run
After an interruption, inspect the named run's readiness.json and marker.
In-memory assistant/approval state does not yet exist here. Later sessions
will restart from their named fixtures; an old output file does not resume a
pending approval. If a marker is corrupt or missing, preserve that directory
for diagnosis and extract a fresh copy to continue. Do not forge a marker.
To discard first-a, from the extracted root:
python3 -B starter/security_lab/workspace.py clean --run first-a
Read the listed files. Only if they match the run you intend to discard, run:
python3 -B starter/security_lab/workspace.py clean --run first-a --confirm
The plan does not delete anything. Confirmation removes only that run's allowed
files and directory, preserving other runs, source edits, fixtures and software.
The runs-root marker remains for future runs. An unexpected file, subdirectory
or symlink blocks cleanup before deletion. Move only your own extra notes to a
chosen safe place after inspection; preserve unknown files. A missing
readiness.json with an intact owner marker can still be cleaned as a partial
run. A second clean of an already removed run should report that it is absent.
Diagnose a differing result
| Observation | Safe next check |
|---|---|
| Script/file not found | Use pwd/ls; enter the extracted root containing the supplied files |
| Wrong Python series | Select the separately installed CPython 3.13 interpreter consistently |
| Fixture changed | Compare with a new archive extraction; preserve edits separately rather than rewriting the manifest hash |
| Existing/unowned output | Inspect it and choose a new run or extracted directory; never overwrite it |
| Cleanup refused | Inspect ownership and unexpected files; retain anything whose origin is unclear |
Sources and environment limits
Python's macOS setup, pathlib, unittest and version status support the local setup and library behaviour. The later inference profile uses the pinned runner release, macOS runner requirements, local model package and model card. File-only readiness is not evidence of a working model or another platform; retain that distinction when you record your observations.