feat: add self-integrity verification for image and prompts#6
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Dockerfile: generates/opt/secy/integrity.sha256manifest at build timeagent/entrypoint.sh: verifies manifest on startup, exits with error if tamperedsetup.sh: saves/verifies Docker image digest on install/startsread/lib/modules/secyhealth.sh: adds integrity check section, re-runssha256sum --checkagainst manifest every patrol cycleWhat it defends against
Test plan
/opt/secy/integrity.sha256exists inside containerdocker exec ... bash -c 'echo x >> /opt/secy/AGENT.md') — should fail (read-only filesystem)./setup.sh status— verify integrity digest shown as verifieddocker compose --profile test run --rm secy-testCloses #4