# Extension Challenges Ideas for extending this project, ordered by difficulty. Each one teaches a different skill. Don't feel like you need to do them in order. ## Easy Challenges ### 1. Add a Docker Persistence Scanner Docker containers can be configured to restart automatically, and Docker volumes can mount host paths that persist across container restarts. Attackers use `--restart=always` containers and bind mounts to /etc/cron.d as persistence mechanisms. **What to build:** A scanner that checks /etc/docker/daemon.json for insecure configurations (like `--insecure-registry`), enumerates Dockerfiles in common locations, and checks for docker.service overrides. **What you'll learn:** How container orchestration creates new persistence surfaces that traditional scanners miss. **Hints:** - Start with checking if /etc/docker/daemon.json exists and parsing it for suspicious settings - Check /etc/systemd/system/docker.service.d/ for drop-in overrides - MITRE technique: T1610 (Deploy Container) **Test it works:** Create testdata/docker/daemon.json with an insecure configuration and verify the scanner flags it. ### 2. Add Cloud-Init Persistence Scanner Cloud-init runs on first boot (and optionally on every boot) in cloud VMs. User data scripts in /var/lib/cloud/instance/scripts/ and cloud-config in /var/lib/cloud/instance/user-data.txt can contain arbitrary commands. **What to build:** Scan cloud-init locations for user-data scripts containing network tools, encoded payloads, or download-and-execute chains. **What you'll learn:** How cloud initialization creates a persistence vector unique to cloud environments. **Hints:** - Key directories: /var/lib/cloud/instance/, /var/lib/cloud/scripts/per-boot/ - Use ScanFileForPatterns() since cloud-init scripts are plain shell - MITRE technique: T1078.004 (Valid Accounts: Cloud Accounts) ### 3. Add Severity-Based Exit Codes CI/CD pipelines need a way to fail builds when critical findings exist. Right now sentinel always exits 0. **What to build:** Exit code 1 when findings at or above a specified severity are found. Add a `--fail-on` flag that sets the threshold. **What you'll learn:** How security tools integrate into automated pipelines. Most commercial scanners use exit codes for policy enforcement. **Hints:** - Add `--fail-on` as a persistent flag alongside `--min-severity` - After printing output, check if any findings meet the threshold - Exit code 0 = clean, 1 = findings above threshold, 2 = scan error **Test it works:** ```bash sentinel scan --root testdata --fail-on critical; echo $? ``` ## Intermediate Challenges ### 4. Add Glob Pattern Matching to Ignore Rules Currently ignore rules match exact paths. Real-world usage needs glob patterns like `/etc/cron.d/*` or `/home/*/.*rc`. **What to build:** Extend the ignore-list matcher to support shell glob patterns using `filepath.Match()`. **What you'll learn:** How to balance expressiveness with safety in configuration formats. Glob patterns are more useful than exact matches but introduce the risk of over-suppression. **Implementation approach:** 1. Modify `matchesFinding` in config.go to check if the path field contains glob characters (*, ?, [) 2. If it does, use `filepath.Match(rule.Path, finding.Path)` instead of exact comparison 3. Add test cases for wildcard and question mark patterns 4. Document the supported glob syntax in the ignore file format **Hints:** - `filepath.Match()` is safe (no `**` recursion, no regex injection) - Consider adding a `pattern:` field separate from `path:` if you want to preserve backward compatibility ### 5. Add HTML Report Output JSON is great for machines. Terminal output is great for quick checks. But incident response reports need to be shared with management and legal teams who don't read terminals. **What to build:** An `--html` flag that generates a self-contained HTML report with findings grouped by severity, sortable tables, and expandable evidence sections. **What you'll learn:** Report generation, Go's html/template package, and how to produce self-contained (no external CSS/JS dependencies) HTML documents. **Implementation approach:** 1. Create internal/report/html.go with an HTML template 2. Embed the CSS inline in a `