Skip to content

feat: add self-integrity verification for image and prompts#6

Merged
suisuss merged 3 commits intomainfrom
feat/4-self-integrity-verification
Apr 2, 2026
Merged

feat: add self-integrity verification for image and prompts#6
suisuss merged 3 commits intomainfrom
feat/4-self-integrity-verification

Conversation

@suisuss
Copy link
Copy Markdown
Owner

@suisuss suisuss commented Apr 2, 2026

Summary

  • Three-layer integrity verification to detect tampering of secy's own security controls
  • Build-time SHA256 manifest of prompts, configs, blocklists, and scripts
  • Container refuses to start if any security-critical file was modified
  • Patrol's secyhealth module re-verifies every 30 minutes from inside the running container

Changes

  • Dockerfile: generates /opt/secy/integrity.sha256 manifest at build time
  • agent/entrypoint.sh: verifies manifest on startup, exits with error if tampered
  • setup.sh: saves/verifies Docker image digest on install/start
  • sread/lib/modules/secyhealth.sh: adds integrity check section, re-runs sha256sum --check against manifest every patrol cycle

What it defends against

  • Post-compromise modification of prompts (AGENT.md, WATCH.md, C2.md) to weaken detection
  • Modification of sread blocklists to expose credentials
  • Modification of srt-settings.json to allow network exfiltration
  • Silent image replacement

Test plan

  • Build image, verify /opt/secy/integrity.sha256 exists inside container
  • Start container, verify "integrity manifest: verified" in secyhealth output
  • Modify a file inside running container (e.g., docker exec ... bash -c 'echo x >> /opt/secy/AGENT.md') — should fail (read-only filesystem)
  • Run ./setup.sh status — verify integrity digest shown as verified
  • Run existing tests: docker compose --profile test run --rm secy-test

Closes #4

suisuss added 3 commits April 2, 2026 12:57
Three verification layers:
- Build-time: Dockerfile generates SHA256 manifest of security-critical
  files (prompts, configs, blocklists, scripts) at /opt/secy/integrity.sha256
- Container startup: entrypoint.sh verifies manifest before handing off
  to secy — refuses to start if any file was tampered with
- Host-side: setup.sh saves image digest on install, verifies on start
- Patrol: secyhealth module re-verifies manifest every 30 minutes from
  inside the running container

Closes #4
_verify_image_digest now detects non-interactive stdin (cron,
systemd restart, healthcheck) and exits immediately instead of
blocking on a read prompt.
Add agent/lib/*.sh (invoke_claude, patrol scheduling, watch common,
c2 correlation) and sread/lib/*.sh (blocklist enforcement, redaction,
common utilities) to the SHA256 manifest. These contain security-critical
logic that was previously unverified.
@suisuss suisuss merged commit b7b7f29 into main Apr 2, 2026
1 check passed
@suisuss suisuss deleted the feat/4-self-integrity-verification branch April 2, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add self-integrity verification for secy image and prompts

1 participant