Foundation / Module 02

Build a lab that cannot surprise production

Create an isolated workspace, a written scope, synthetic data, and a stop procedure before running security experiments.

45 minutes Beginner Practical lab
01

Scope is a technical control

Written authorization is not paperwork added after the technical work. It defines the assets, identities, methods, test window, data rules, rate limits, and emergency contacts that make the activity safe and lawful.

For self-study, use loopback services, local containers, disposable accounts, synthetic identities, and intentionally vulnerable applications. Never convert a hostname found in a tutorial into a real target.

  • In scope: exact local services, test accounts, and permitted actions.
  • Out of scope: production, third-party tenants, real people, and shared networks.
  • Stop conditions: unexpected outbound traffic, real data, instability, or unclear ownership.
  • Recovery: snapshots, reset scripts, logs, and an easy way to destroy the environment.
02

Use the standard Python environment

The source PDF installs a separate virtualenv package. Modern Python already includes venv, so a simpler beginner baseline is a project-local environment, a requirements file, and a secret-free configuration example.

Do not hard-code provider keys. Keep local environment files untracked, use least-privilege test credentials, set spending limits, and rotate any key that reaches a screenshot, notebook, shell history, or repository.

Terminal
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install numpy pandas scikit-learn jupyter
python -m pip freeze > requirements-lock.txt
03

Isolation needs more than a container

A container reduces accidental package and filesystem overlap, but it is not a complete security boundary. Restrict mounted folders, avoid privileged mode, remove unnecessary host sockets, limit egress, and use a dedicated test network.

If a lab calls a hosted model, assume prompts and outputs may leave your machine. Use synthetic text and a dedicated project. A local model can reduce data exposure, but model files and dependencies still need provenance checks.

A disposable lab should be easy to rebuild and easier to delete than to repair.

Practice

Create a safe-lab charter

Safety boundary: This lab contains no scanning or exploitation.

  1. 01

    Create a folder with README, .gitignore, requirements-lock, fixtures, results, and notes subfolders.

  2. 02

    Write a scope with allowed assets, actions, data, and maximum request rate.

  3. 03

    Create synthetic users and log records with no real names, emails, or credentials.

  4. 04

    Document the stop command and the reset procedure.

  5. 05

    Ask another person to identify any ambiguity that could reach a real system.

Checkpoint

Ready to move on?

Go deeper

Primary sources for this module

All resources
Previous module01 · AI security starts with the system, not the model Next module03 · Use Python to inspect security data, not to hide reasoning
Share this module LinkedIn Email Permanent link