Goal: Experience the full lifecycle of a secrets incident — from prevention (pre-commit hooks) to detection (history scanning) — and then build a small role-based anonymization pipeline that demonstrates least-privilege data access. Everything in this lab uses free, local, open-source tools — no cloud accounts or paid services required. Steps:
git init. Create 2–3 fake "config" files (e.g., config.py, .env.example, notes.txt) containing realistic-looking but fake secrets — a fake OpenAI-style key (sk-fake...), a fake database password, and a fake AWS access key. Commit these files so your repo has some seeded history.detect-secrets tool (pip install detect-secrets). Run detect-secrets scan > .secrets.baseline against your repo. Open the generated baseline file and identify which of your fake secrets it flagged, noting the detector type used for each (e.g., high-entropy string, keyword match).pre-commit (pip install pre-commit), add a .pre-commit-config.yaml that wires up detect-secrets-hook, and run pre-commit install. Now add a brand-new fake secret to a file and attempt git commit. Screenshot or copy the terminal output showing the hook blocking your commit.brew install gitleaks, a released binary, or Docker) and run gitleaks detect --source . --report-path gitleaks-report.json against the same seeded repo (including the commits from Step 1, before the hook existed). Compare its findings to your detect-secrets baseline: Did Gitleaks catch anything detect-secrets missed, or vice versa? Note one concrete difference in how the two tools approach detection (e.g., regex/rule-based scanning of full history vs. baseline-and-diff plugin detectors).pip install presidio-analyzer presidio-anonymizer). Using 3–5 sample text records containing fake PII (names, emails, phone numbers, SSNs), write a short Python script that applies two different anonymization policies to the same source records: an "admin" policy that only redacts the highest-sensitivity fields (e.g., SSN) and leaves the rest visible, and an "analyst" policy that redacts or masks all detected PII entities. Print both outputs side by side for at least one record so the least-privilege effect is visible.Deliverables: Submit your write-up (Step 7) as online text entry, plus a file upload containing: your .secrets.baseline, your gitleaks-report.json, a screenshot/log of the blocked commit (Step 3), and your Presidio pipeline script with its console output for both roles.