feat(secure-at-inception/claude): surface user-visible messages when hooks run - #50
Open
lcrowther-snyk wants to merge 1 commit into
Open
feat(secure-at-inception/claude): surface user-visible messages when hooks run#50lcrowther-snyk wants to merge 1 commit into
lcrowther-snyk wants to merge 1 commit into
Conversation
…hooks run Adds a branded systemMessage (HOOK_BANNER "Snyk Secure at Inception") to the hook's JSON responses so it's clear in the UI when each hook fires and what it did: - SessionStart -> "session started — security scanning is active" - PostToolUse -> "change detected in <file> — running a background scan" - Stop (clean) -> "Stop hook ran — no new vulnerabilities introduced" - Stop (blocked) -> "Stop hook blocked — N new code + M new dependency vuln(s)" - Stop (scan failed) -> "Stop hook ran — security scan could not complete" output_response gains an optional system_message param; no-op paths (non-code edits, unknown events) stay silent. dist/ artifacts are regenerated at release time per repo convention, so they are intentionally not included in this PR. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Author
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.

What
Adds clear, branded UI messages so users can see when each Secure-at-Inception hook fires and what it did, for the Claude async-CLI variant.
Messages are emitted via the hook response's
systemMessagefield, prefixed🔒 Snyk Secure at Inception ·:session started — security scanning is active (warming scan cache).change detected in <file> — running a background security scan…✅ Stop hook ran — scan complete, no new vulnerabilities introduced. Safe to stop.🚨 Stop hook blocked — N new code + M new dependency vulnerability(ies) introduced…⚠️ Stop hook ran — security scan could not complete; see fallback instructions.Why
Previously the hook ran silently from the user's point of view (only
[SAI]stderr lines, visible in transcript/verbose). There was no positive confirmation that scanning was active, and in particular no explicit "all clear" message when the Stop hook found no newly introduced vulnerabilities. These messages make the guardrail's activity visible and reassuring.How
output_response()gains an optionalsystem_messageparam; when set, it attachessystemMessage(prefixed with a newHOOK_BANNERconstant).Scope
guardrail_directives/secure_at_inception/hooks_version/claude/async_cli_version/snyk_secure_at_inception.py(+40/-7).dist/artifacts are not included — per repo convention they're regenerated inchore: releasecommits, not per feature PR.Testing
python3 -m py_compilepasses.output_responseoutput shape (clean / block / no-message) and confirmed no-op handler paths still return{}.🤖 Generated with Claude Code