security: hash-pin deps (Q8) + behavioral anomaly alarms (Q10) - #3
Merged
Conversation
Q10 (AppSec review): add optional fleet-wide anomaly alarms, provisioned by the CFN Launch Stack when BudgetEmailAddress is set (off otherwise). Two alarms — escalation spike (default 25/hr) and invocation spike (default 100/hr), tunable via new parameters — plus an SNS topic. Each alarm aggregates its metric across all dimension schemas with a Metrics Insights query (SELECT SUM(...) FROM "Shadow"): a fixed-dimension alarm would watch an empty stream, and SEARCH is illegal in alarms. Alarms are regional and depend on Shadow's metric emission, both documented. Contract test asserts each alarm aggregates an emitted metric and wires its own threshold param. Q8 (AppSec review): keep deps version-pinned, not hash-pinned — SHA-pinned actions are the required control; pip hash-pinning was disproportionate for 3 deps (recipe noted for future). Docs: README cost-protection/monitoring updated for the alarms (region + metric dependencies, honest cost framing) and a corrected email-only budget row; cloudwatch.py docstring notes the Reason dimension. 542 tests pass.
sudsali
force-pushed
the
appsec/hardening-q8-q10
branch
from
July 21, 2026 01:08
08126dc to
341b021
Compare
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.
Addresses two findings from the AppSec review of the Shadow bot.
Q8 — Supply-chain: hash-pin Python dependencies
requirements.txtis now fully hash-pinned across the transitive tree (generated viapip-compile --generate-hashes); top-level pins live in the newrequirements.in.analyze,act) now install withpip install --require-hashes, so a tampered/substituted PyPI artifact fails the install instead of executing.--require-hashesinstall succeeds in a clean venv; requests/boto3/PyYAML import at pinned versions (12 packages, 166 hashes).Q10 — Monitoring: behavioral anomaly alarms
The engine already emitted CloudWatch metrics (namespace
Shadow) but had no alarms. Adds (opt-in, gated onBudgetEmailAddress— no new parameter):Note on approvals: there is no per-run "approval" metric because auto-approval is a separate adopter-side workflow, not the engine — and it's now off-by-default (see the per-repo
SHADOW_AUTO_APPROVEgate PRs). Escalation/invocation spikes are the engine-level anomaly signals.541 tests pass. Touches
.github/→ requires human approval + merge.