Level 10 / Project 05 - Compliance Evidence Builder¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| Concept | This project | — | Quiz | Flashcards | — | — |
Focus¶
- Observer pattern for pluggable evidence collectors
- Control framework mapping with coverage assessment
- Content hashing for evidence integrity verification
- Audit-ready report generation with status rollup
Why this project exists¶
Compliance audits (SOC2, ISO 27001, PCI-DSS) require demonstrable proof that controls are active. This project automates evidence collection into a structured package, so teams can produce audit artifacts on demand instead of scrambling before an audit. The observer model lets new checks be added without modifying the core.
Run (copy/paste)¶
Expected terminal output¶
Collected 4 evidence items
{
"framework": "SOC2-mini",
"total_controls": 5,
"total_evidence": 4,
"status_summary": { ... }
}
Expected artifacts¶
- Compliance report printed to stdout
- Passing tests (
pytest -vshows ~12 passed)
Alter it (required)¶
- Add a
LogSampleCollectorthat reads recent log entries and packages them as evidence for monitoring controls. - Add evidence deduplication — if two collectors produce evidence with the same
content_hash, keep only one. - Re-run tests and add coverage for deduplication logic.
Break it (required)¶
- Register no collectors and call
collect_all— observe that all controls show NOT_ASSESSED. - Create evidence that maps to a non-existent control ID — verify it is collected but does not affect assessment.
- Pass empty content to
Evidenceand check the hash behavior.
Fix it (required)¶
- Add validation that
control_idsis non-empty when creating Evidence. - Make
collect_allidempotent — calling it twice should not double the evidence list. - Add tests for both fixes.
Explain it (teach-back)¶
- How does the Observer pattern decouple evidence collection from assessment logic?
- Why does each Evidence item store a
content_hash? How does this support audit integrity? - What is the difference between SATISFIED, PARTIAL, and NOT_ASSESSED control statuses?
- How would you extend this to support multiple compliance frameworks simultaneously?
Mastery check¶
You can move on when you can:
- write a new EvidenceCollector that satisfies the Protocol,
- explain how evidence maps to controls through control_ids,
- generate a compliance report and interpret the status summary,
- describe how this pattern applies to real SOC2 or ISO 27001 audits.
Related Concepts¶
| ← Prev | Home | Next → |
|---|---|---|