srt-security-scan
Skill329 starsChanged 7 days agoMIT-0View on GitHub
Use when running the SRT security scan (make srt-scan), triaging its HIGH findings, and mitigating or suppressing them.
- Pipes a download into a shell
- Installs packages
In this repository42 other files it gives its agents.
- .claude/rules/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-modelSkill
- agent-capability-reviewSkill
- api-rbac-testSkill
- backend-lambdaSkill
- code-reviewSkill
- create-hf-dataset-prSkill
- curate-security-resultsSkill
- cut-release-changelogSkill
- dependabot-prsSkill
- documentationSkill
- extraction-pipelineSkill
- fix-single-issueSkill
- frontend-uiSkill
- full-test-batterySkill
- infrastructureSkill
- live-auth-checksSkill
- live-eval-and-costSkill
- prepare-changelogSkill
- prep-develop-for-releaseSkill
- product-demoSkill
- pr-review-ciSkill
- pr-reviewSkill
- releaseSkill
- release-validationSkill
- remove-classification-flat-keysSkill
- repo-quality-reviewSkill
- run-benchmarksSkill
- run-stack-testsSkill
- sync-pii-anonymizerSkill
- testing-qaSkill
- test-upgradeSkill
- transform-deploy-testSkill
- ui-i18nSkill
- update-solution-profileSkill
- ux-test-ciSkill
- ux-testSkill
- ux-test-stories-ciSkill
- ux-test-storiesSkill
- work-the-backlog-hazardsSkill
- work-the-backlogSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use this skill whenever you run the Sample Security Review Tool (SRT) — via make srt-scan / make srt — or when the SRT gate fails, either …
- Very specific: line 42
An allowlist entry that matched no finding is exit 1 too: Delete it, and its twin in .ash/.ash.yaml.
- Very specific: line 131
Keep the dependency entries in .ash/.ash.yaml in sync with scripts/security/dep_audit_allowlist.json: a new allowlist entry needs its ASH …
- Distinctive: line 341
If the user reports N findings and your local scan shows many more, the extra ones are almost always gitignored — confirm, then focus only …
- Very specific: line 378
Run make srt-clean first. .aws-sam build dirs are gitignored, so they add phantom findings (34 in one run) *and* crash checkov on the …
- Very specific: line 382
If srt assess errors with "Configuration not found.
- Distinctive: line 411
Mitigate (fix the code): when the finding is a genuine weakness: missing encryption, over-broad IAM, a real hardcoded secret, public …
- Distinctive: line 416
Suppress: only when one of these holds — and say which in the reason:
- Distinctive: line 445
Third-party / vendored code: not in the CI checkout — usually just gitignored (see above).
- Distinctive: line 535
After either, restore + re-scan to confirm:
- Very specific: line 581
If a scan reports a pile of HIGH findings in .aws-sam/packaged.yaml / .aws-sam/idp-main.yaml, you ran a scan over a built tree.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SRT Security Scan — Running, Triaging, Suppressing & Mitigating
Use this skill whenever you run the Sample Security Review Tool
(SRT) — via
make srt-scan / make srt — or when the SRT gate fails, either in GitLab CI
(srt_security_review) or on a GitHub pull request
(.github/workflows/security-checks.yml). Both run the same two commands
(make srt-setup && make srt-scan), so a finding reproduces identically. It covers reproducing the scan, telling real issues from
false positives, and the two ways to make a HIGH finding go away: mitigate
(fix the code) or suppress (record accepted-risk / scanner-limitation).
⚠️ SRT does NOT check dependencies for CVEs — make dep-audit does
SRT's five scanners include syft, which builds an SBOM: an inventory of packages, with no vulnerability matching. So SRT can never fail a build for a known-vulnerable dependency, and for a long time nothing else in CI did either (found by diffing our SRT output against an independent ASH scan, whose grype stage flags exactly this class). If you are asked "are we exposed to CVE-X", SRT is the wrong tool — reach for:
make dep-audit # regenerate manifests + audit ~1800 pinned deps vs OSV
make dep-audit-fast # reuse existing dist/manifests (skip regeneration)
make dep-audit DEP_AUDIT_ARGS=--no-unmapped # skip the GitHub advisory pass- Implemented by
scripts/security/dep_audit.py; gated in CI by thedep_auditjob (fast_checks, every push and MR, no AWS). - Reads the manifests
scripts/generate-dep-manifest.shproduces, coveringuv.lock, everypackage-lock.jsonand everyrequirements.txt. - Fails on HIGH/CRITICAL. Triage the same way as SRT — but in
scripts/security/dep_audit_allowlist.json, with a real justification ({"id": "GHSA-…", "package": "…", "reason": "…"}). Prefer bumping the pin; allowlist only when the advisory is genuinely unreachable, and say why. - Exit 2 means the audit could not run (OSV unreachable) — that is not a pass. Exit 1 is findings, 0 is clean.
- An allowlist entry that matched no finding is exit 1 too. Delete it, and its
twin in
.ash/.ash.yaml; it would otherwise pre-approve the id if it came back. - Read the
UNMAPPED ADVISORIESsection; it never fails the build. It lists unreviewed GitHub advisories with no package mapping whose summary names a pinned package and a range including its version — the class a commercial scanner reports and OSV cannot. Confirm each one by hand before acting. "not checked" means no GitHub token was available. Do not allowlist an unmapped advisory: with no OSV finding to suppress, the entry would fail the audit as stale. - Two gotchas worth knowing before you chase a finding:
- An advisory with no
fixedevent and an open-ended range matches every version. Check the reportedlast known affected range— the fix may have shipped outside the registry (SheetJS/xlsxpublishes patches tocdn.sheetjs.com, which OSV cannot model). - Bumping a pin can be blocked downstream:
bedrock-agentcore's fix needsboto3>=1.43.31against a deliberateboto3<1.43.0pin, and a Pillow bump can break SAM's arm64 build (seefeature-platform/pii-anonymizer/hook/Makefilefor the multi---platformworkaround).
- An advisory with no
Suppressing a finding so it stays suppressed (SRT and ASH)
Our security reviewers also run ASH out of band. ASH runs the real scanner binaries, so it inherits whatever each scanner natively honours — which means an inline pragma is strictly better than a tool-specific config entry: it lives next to the code it excuses, survives file moves and line drift, and satisfies every tool that runs that scanner.
Verified locally against the actual scanner binaries (not assumed):
| Scanner | Inline pragma | Notes |
| bandit | # nosec B310 - reason | # noqa: S310 is ruff, NOT bandit. A line needs both. |
| detect-secrets | # pragma: allowlist secret | Works in #, // and <!-- --> comments. |
| checkov | # checkov:skip=CKV_AWS_123:"reason" | 521 already in use. |
| cfn-nag | Metadata: cfn_nag: rules_to_suppress | 157 already in use. |
| semgrep | # nosemgrep: rule-id | 43 already in use. |
| grype / npm-audit | none exists | Must go in a config file. |
Four traps that cost real time:
- bandit's
# nosecis line-scoped, and on a multi-line string the pragma must sit on a line INSIDE the string node. The closing"""works; the opening line does not — putting it there makes it part of the string, so it suppresses nothing and ships the pragma text as data. Two analytics prompts had exactly this bug and were sending# nosec B608 - ...to the model. - detect-secrets dedupes by secret hash, reporting one line per unique secret per file. Suppress the first occurrence and the next one surfaces — so annotate every occurrence of the pattern, then re-scan to confirm zero.
The marker is parsed, not pattern-matched, and four shapes mean something other than they look like. Bandit's parser is
NOSEC_COMMENT→NOSEC_COMMENT_TESTS(bandit/core/manager.py): it feeds every word after the marker to the plugin registry, keeps what resolves to a check, and — this is the part that surprises — treats an empty resolved set as "suppress everything on this line". Measured through that parser over all 310 markers in this tree, the 237 written<id> - reasonare all correct. These are the shapes that are not:Shape What it actually does # nosec b101blanket. The lookup is case-sensitive for short ids, so a lowercase id resolves to nothing — easier to type than a typo, and it silences every check on the line # nosec B101,B311scoped to B311 only. Without a space the two ids parse as one token and only the last survives, so B101 still fires while the comment says it is covered. # nosec B101, B311and# nosec B101 B311both work# nosec B9999 - typoblanket, same empty-set path as above # nosec B105 - value is random, not realscoped to B105 and B311, because randomis B311's plugin name. The one-word plugin names areciphers,eval,ftplib,marshal,md5,pickle,random,telnetlib,trojansourcea comment that merely quotes the pragma a live blanket marker for the line it sits on. Writing about it counts as writing it ⚠️ A blanket marker on a comment line inside a multi-line call covers the whole node's
linerange, not the one line, so it can silence a finding several lines away.None of this is visible in a scan. Bandit warns only about words it fails to resolve, so the widened marker — the one case where the scope silently grew — produces no diagnostic at any verbosity; and the warnings it does emit go to stderr, which SRT's own bandit command redirects to
/dev/nullbefore anything could capture it. So: name the id, capitalise it, comma-space between ids, and keep plugin words out of the prose.- A semgrep rule can match your own justification comment. Writing
min-release-age=0inside an explanatory comment in.npmrcre-triggered the very rule the comment was explaining.
ASH-only suppressions: .ash/.ash.yaml
For what cannot be inline — generated/data files with no comment syntax, and
dependency advisories — use global_settings.suppressions. path and reason
are required; rule_id, line_start, line_end, expiration are optional
(schema: automated_security_helper/schemas/AshConfig.json in the ASH repo).
⚠️ A
pathentry with norule_idsuppresses ALL findings on that path. Only ever do that for pure data files. Never for a source file or a CFN template — it converts a triage note into a blind spot.scripts/security/tests/test_dep_audit.py::TestAshConfigenforces this.
Keep the dependency entries in .ash/.ash.yaml in sync with
scripts/security/dep_audit_allowlist.json: a new allowlist entry needs its ASH
twin, and a dropped one takes its twin with it. A test checks both directions.
⚠️ pip install automated-security-helper does NOT install ASH. That PyPI
name is an unrelated placeholder ("test-package-placeholder", single release
11.0.2, no console script). Real ASH is installed from GitHub. See
docs/dependency-confusion.md — this is the same class of hazard that doc covers
for our own first-party names.
What SRT is and how the gate works
make srt-setupdownloads thesrtbinary into.srt/, writes.srt/srtconfig.json, installs prerequisites, and copies the committed baselinescripts/srt/issues.json→.srt/issues.json(this is how suppressions are restored).- Prerequisites are five scanners —
checkov,semgrep,bandit,syft(anchore_syft),jupyter— that SRT pip-installs into its OWN managed venv at.srt/.venv/bin/(NOT the system PATH).srt assesscallscheckAllInstalled()and aborts with✗ Prerequisites not installed. Run 'srt config' first(exit 1) if any one is missing. Contrary to older guidance, semgrep is NOT optional for SRT ≥ v1.0.2 — a missing semgrep blocks the scan exactly like any other scanner.scripts/srt/setup.pynow verifies all five landed in the venv, retries./srt config --reinstall-prerequisitesonce, and hard-fails the setup step in CI if they didn't (instead of printing a misleading "✅ setup complete"). A cold install (no pip cache) of all five is slow (~10-15 min); the CI job allows 50 min. make srt-scanrunsscripts/srt/run.py, which shells out to./srt assess -y -p <repo> --no-diagrams --no-threat-models --no-license-update. SRT merges new findings into.srt/issues.json, thenrun.pyparses that file and prints theOPEN HIGH PRIORITY SECURITY ISSUEStable.- The gate = HIGH priority AND
statusin (Open,reopened). Medium/Low never block. Onlysuppressedandresolvedare accepted dispositions. resolvedis NOT sticky —suppressedis. SRT setsreopenedwhen a finding it had recorded as resolved/suppressed is detected again, and counts it in its own "N issues need attention" line (Open: 39 / Reopened: 10). Until 0.6.5 bothscripts/srt/run.pyand the results curator gated onOpenalone, so a re-detected HIGH passed CI silently — two were sitting in the tree (LAMBDA-012innested/bedrockkb/template.yaml, and the semgrep npmminimum-release-agefinding onsrc/ui/.npmrc), both carryingstatus: resolved. If you intend a finding to stay quiet, writestatus: "suppressed"with asuppressionReason; never leave itresolved, because the next scan will re-detect it and now correctly block.- A suppression that shields nothing fails the gate too — so fixing a finding has a
second half. The suppression key is
(path, resourceType, resourceName, check_id)with no line, so an entry whose finding you fixed in source does not go inert: it pre-suppresses every future finding of that check in that file, and a real hardcoded credential landing in a pre-registered file would be suppressed on arrival.run.pynow prints aSUPPRESSIONS THAT SHIELD NOTHINGtable for every suppressed entry the scan produced no finding for, and exits 1 in CI. If you add an inline# nosec(or remove the value), delete the register entry in the same change. Every one of the 52 Bandit suppressions the register used to carry was dead for exactly that reason.- Measured per source, and only where silence is evidence:
register.WHOLE_REPO_SUMMARIES(Bandit — rules compiled into the package, runs over every file, so its finding set is a function of the tree alone).security-matrix,CheckovandSemgrepare excused inregister.NON_VACUITY_EXEMPT_SOURCES, each with the mechanism that moves its finding set without the tree moving — the first two evaluate per template and a failed template scan looks exactly like a clean one, the third takes rules from a remote registry. The remedy here is deletion, so reading absence as evidence where it is not would delete a live suppression. - An empty scanner summary is treated as "not measured", not as a clean tree. A
fresh but empty summary passes
scanner_health(which only checks freshness) and would otherwise report every suppression for that source as dead at once. - ⚠️ After you delete entries, the next local scan refuses to start.
.srt/issues.jsonstill holds them, andrestore_committed_registercannot tell a deliberate deletion from a local disposition nobody saved yet — both look like "HIGH dispositions the committed register lacks". Run the next scan once withSRT_DISCARD_LOCAL=1 make srt-scan, orrm .srt/issues.jsonfirst. CI never hits it: a fresh checkout has no live file, andmake srt-setupwrites the committed register into it.
- Measured per source, and only where silence is evidence:
- Exit code differs by environment (
run.py):- CI (
CI/GITLAB_CI/GITHUB_ACTIONSset): exits 1 on any HIGH-open → pipeline fails. - Local: exits 0 even with findings and prints a "run
make srt-fix" hint. So read the printed table /.srt/issues.json, never trust the local exit code.
- CI (
- The scan itself is Bedrock-backed and slow (~5–15 min);
run.pybuffers throughtail, so you see nothing until it finishes. Run it in the background and wait — don't assume it hung.
The gate can break with NO repo change (SRT upgrade / semgrep --config=auto)
Two moving parts outside the repo can fail the gate on an unchanged tree:
- The registry rule set. SRT invokes
semgrep scan --config=auto ... --json, andautofetches rules from the semgrep registry at scan time, so new rules ship continuously. - The SRT version.
srt-setupinstalls the latest release. v1.0.2 passed--exclude ".github"to semgrep; v1.1.0 dropped it, so all.github/workflows/**findings appeared at once with zero code change.
Symptom of both: HIGH-open findings in files whose git log shows no recent
change. Don't hunt for the commit that "caused" it — diff the SRT version and
check whether the rule is new.
Semgrep priority = extra.metadata.impact, NOT severity. SRT's semgrep
mapResult reads priority: J.extra?.metadata?.impact || "Unknown" (only
Bandit/Checkov go through mapSeverity). So an ERROR-severity semgrep finding
with impact: LOW/MEDIUM never blocks — which is why this repo can carry ~11
ERROR findings (subprocess-shell-true, tainted-sql-string, …) with a green
gate. When triaging, filter on impact:
python3 -c "import json;[print((r['extra'].get('metadata') or {}).get('impact'), \
r['check_id'].split('.')[-1], r['path'], r['start']['line']) \
for r in json.load(open('/tmp/sg.json'))['results']]"Semgrep findings key on (path, line, issue) (Bandit keys on
(path, line, check_id)), so a new rule cannot be pre-suppressed and a
line-number shift re-opens a suppressed one.
Watch for a silently-skipped scanner. srt assess logs a scanner crash to
.srt/logs/srt-tool.log.* and carries on with an empty result — the printed
table then looks clean for that source. On this dev box the venv semgrep
re-execs pysemgrep from PATH and finds a stray
~/.local/bin/pysemgrep (system python, no semgrep module), so every full
scan died with ModuleNotFoundError: No module named 'semgrep' and produced no
.srt/semgrep-summary.json.
Since 0.6.7 run.py checks this automatically (scripts/srt/scanner_health.py)
and prints a ⚠️ SCANNERS THAT DID NOT COMPLETE block, failing CI when the loss
is on a tracked file. To check by hand:
ls .srt/semgrep-summary.json .srt/bandit-summary.json # missing ⇒ scanner crashed
ls .srt/*/checkov-summary.json | wc -l # one per scanned template
grep -i error .srt/logs/srt-tool.log.* # whycheckov's stdout maxBuffer length exceeded — caused by .aws-sam/, not by size
The other silent-skip cause, and it looks alarming: three
Error during Checkov scan {stdout maxBuffer length exceeded} per scan. Facts,
all verified against the binary and by reproducing the command:
- SRT scans per file (
checkov -f <file> -o json --output-file-path <dir> --soft-fail --quiet) and its command wrapper calls node'schild_process.execwith nomaxBuffer, taking node's 1 MiB default. It is not configurable from outside the binary — no flag, no env var. - checkov duplicates its entire JSON report to stdout even with
--quietand--output-file-path. So the report size, not the file size, is what overflows. - It is not driven by template size. The largest file in the repo,
template.yaml(547 KB), yields 2.7 KB of stdout — 459 passed, 0 failed, 211 skipped — because it carries 218# checkov:skip=comments..aws-sam/idp-main.yamlis smaller (435 KB) but yields 2.6 MB, becausesam packagere-serializes YAML and drops comments, so all 218 skips become failures. - Therefore only
.aws-sam/artifacts can trigger it. Measured across a full scan, the largest successfully-scanned report is 127 KB — 12% of the buffer, 8× headroom. CI, which never has.aws-sam/, cannot hit this.
So the fix is make srt-clean, not a checkov flag. run.py now warns up
front when .aws-sam dirs are present, and classifies a checkov loss on a
gitignored path as non-blocking (ℹ️) while failing CI on a tracked one.
⚠️ Corollary worth remembering: # checkov:skip= / cfn_nag suppressions do
not survive sam package. Never treat a scan of a packaged template as
equivalent to a scan of its source — it will report every suppressed check as a
failure. This is also why suppressing an .aws-sam finding in issues.json is
always wrong.
Upstream bugs worth reporting to
aws-samples/sample-security-review-tool
if this ever bites a tracked file: exec should pass a generous maxBuffer (or
use spawn with a stream), and the checkov call already writes
--output-file-path, so stdout should be discarded rather than buffered.
To reproduce just the semgrep half in seconds instead of re-running the whole
Bedrock-backed assess, invoke the binary directly with the venv first on
PATH (this is what fixes the pysemgrep shadowing above):
PATH="$PWD/.srt/.venv/bin:$PATH" .srt/.venv/bin/semgrep scan \
--config=auto --json --output=/tmp/sg.json .github/workflows/
python3 -c "import json;[print(r['extra']['severity'], r['check_id'].split('.')[-1], \
r['path'], r['start']['line']) for r in json.load(open('/tmp/sg.json'))['results']]"Rules seen from this path (all were real issues, fixed not suppressed):
github-actions-mutable-action-tag (pin uses: to a 40-char commit SHA),
run-shell-injection (never interpolate ${{ github.* }} into run: — pass
via env: and quote "${VAR}"), gha-curl-pipe-shell (replace curl … | sh
with a SHA-pinned first-party action).
CRITICAL: local scans see more than CI
CI runs on a clean checkout of tracked files only. Your working tree usually has gitignored dirs that SRT will happily scan and flag, producing findings that do not exist in CI:
.aws-sam/,**/.aws-sam/packaged.yaml— SAM build artifacts (thesrt-cleantarget strips these; CI checkouts never have them)scratch/,subscription-features/, vendored Lambdalayer/python/trees — gitignored; full of third-party code (botocore, aiohttp, sympy, …) that trips bandit B105/B106/B324/B602 by the hundred
Since 0.6.7 run.py does this reconciliation for you — gitignored findings
are split into a separate non-blocking ℹ️ LOCAL-ONLY FINDINGS table and
excluded from the exit code (see "Never suppress an .aws-sam/ finding" below).
To reconcile by hand, drop anything gitignored: a finding only matters if its
file is tracked:
# For each open-HIGH path, is it actually in the CI checkout?
git check-ignore -q "<path>" && echo "IGNORED (not in CI)" || echo "in CI"
git ls-files --error-unmatch "<path>" # exit 0 = trackedIf the user reports N findings and your local scan shows many more, the extra
ones are almost always gitignored — confirm, then focus only on the tracked
subset. (To match CI exactly, run make srt-clean first, and/or scan a fresh
git archive / clean clone.)
Reproducing a scan locally
make srt-setup # one-time (or after upgrading SRT); restores suppressions
make srt-scan # ~5–15 min; run in backgroundRun it with CI=1 when there is no tty — plain make srt-setup hangs
scripts/srt/setup.py branches on is_ci (CI / GITLAB_CI /
GITHUB_ACTIONS). The CI branch runs yes '' | timeout 900 ./srt config and
retries once with --reinstall-prerequisites; the local branch is a bare
subprocess.run(["./srt", "config"]) with no timeout and no prompt feeding,
so with stdin closed — a backgrounded command, an agent tool call, a CI-like
shell — it spins at 100% CPU indefinitely (observed: 29 minutes, zero output,
killed manually). Always run:
CI=1 AWS_PROFILE=default AWS_DEFAULT_REGION=us-east-1 make srt-setup > /tmp/srt-setup.log 2>&1 # ~4 min
CI=1 AWS_PROFILE=default AWS_DEFAULT_REGION=us-east-1 make srt-scan > /tmp/srt-scan.log 2>&1 # ~25 minThree reasons that exact form matters:
CI=1onsrt-scanalso makes it gate — it exits non-zero on undispositioned HIGH findings, which is the only way to reproduce thesrt_security_reviewverdict locally. Without it the scan exits 0 and merely prints the table (see the exit-code note above).- Redirect to a file; do not pipe to
tail. A pipe buffers the whole run, so a scan that is working looks identical to one that is wedged. With a log file you can watch progress and inspect the stage withpgrep -af "srt assess"/ps --ppid <pid>(bandit alone can run 15+ min). - Run
make srt-cleanfirst..aws-sambuild dirs are gitignored, so they add phantom findings (34 in one run) and crash checkov on the largest templates, which leaves the scan reporting "SCANNERS THAT DID NOT COMPLETE".
If srt assess errors with "Configuration not found. Run: srt config", the
.srt/srtconfig.json is missing. Recreate it (non-interactive) and install
prereqs:
cat > .srt/srtconfig.json <<'EOF'
{ "AWS_PROFILE": "default", "AWS_REGION": "us-east-1",
"TELEMETRY_ENABLED": false, "INSTALLATION_ID": "local-dev" }
EOF
( cd .srt && yes '' | ./srt config ) # installs all 5 scanners into .srt/.venv/bin/
# Verify every scanner landed — assess needs ALL of them (a missing one → "Prerequisites not installed"):
ls .srt/.venv/bin/{checkov,semgrep,bandit,syft,jupyter}
cp scripts/srt/issues.json .srt/issues.json # restore suppressions before re-scanUses the default AWS profile (needs Bedrock access) — see the AWS-access note
in CLAUDE.md. To list current HIGH-open findings without re-scanning:
python3 -c "import json;[print(i['source'],i.get('check_id'),i['path'],i.get('line'),i.get('resourceName')) \
for i in json.load(open('.srt/issues.json')) \
if (i.get('priority') or '').upper()=='HIGH' and i.get('status')=='Open']"Triage: real issue → mitigate; false positive / accepted risk → suppress
For every HIGH-open finding, decide mitigate vs suppress. Default to mitigating; suppress only with a specific, defensible justification.
Mitigate (fix the code) when the finding is a genuine weakness: missing encryption, over-broad IAM, a real hardcoded secret, public resource that shouldn't be, missing logging you actually want. Change the template/code so the check passes, then re-scan to confirm it flips to resolved.
Suppress only when one of these holds — and say which in the reason:
- Scanner false positive — the property IS set but the checker can't see it.
The most common cause in this repo: the check can't resolve
Fn::If, so conditionally-setAccessLogSetting,MethodSettings, etc. read as absent. (SRT's security-matrix checks call aresolveValuethat handlesRefbut notFn::Ifbranches.) - Tool heuristic false positive — e.g. bandit B105/B106 "hardcoded
password", which match an identifier's name against the wordlist
pas+wo?r?d|pass(phrase)?|pwd|token|secrete?(notkey, notauth) wherever a constant is assigned, compared or passed.shard_token_budget = 40000,pass_count,next_tokenand_COMPACT_TOKENall trip it. ⚠️ In test code that no deployment artifact is built from, these two no longer gate, so there is nothing to suppress and a per-line marker for one of them is the accretion that scope decision replaced (#1086): three of them tookdevelopred in one day and each response added another marker.make srt-scanlists them under their own non-blocking heading. Everywhere that ships they still gate — fix the name, or justify that one line. Note where the boundary is, because path shape alone gets it wrong: atest_*.pyor atests/directory inside a Lambda'sCodeUriis copied into the artifact verbatim bysam build, so it counts as shipped and keeps gating even though it is a test.ci_paths.is_test_only_pathdecides, from theCodeUri/ContentUridirectories the templates declare, and the rationale — including why no Bandit rule can express this scope — is inNAME_HEURISTIC_EXEMPTthere. - Accepted architectural risk — the flagged config is intentional and
compensated. Example:
AuthorizationType: NONEon the Web UI SPA static-asset routes (WebUIRootMethod,WebUIProxyMethod) — the browser must fetch index.html + hashed assets before the user logs in; a JWT can't ride the document fetch. Compensating controls: WAFv2 IP allowlist + PRIVATE-endpoint policy still gate the stage, and only non-sensitive static files are exposed. - Third-party / vendored code not in the CI checkout — usually just gitignored (see above); prefer excluding it over suppressing each line.
The two suppression mechanisms
1. # nosec for Bandit (Python) findings — MITIGATE-in-place
Bandit honors an inline comment. Scope it to the exact test id and add a why:
# nosec B105 - the 40000 literal is an LLM token-budget default, not a
# credential. Bandit's heuristic fires only because the dict key
# "shard_token_budget" contains the substring "token".
DEFAULTS = {"max_tokens": 10000, "shard_token_budget": 40000} # nosec B105The # nosec BXXX must be on the flagged source line. Verify with
.srt/.venv/bin/python -m bandit <file> — the count under "specifically being
disabled" should increment and the issue disappears (Low-severity B110
try/except/pass etc. can remain; only High/Medium reach the gate). This is
preferred over a JSON suppression for Python because the justification lives
next to the code.
Check whether the file you edited is one ruff formats before reformatting it.
ruff.toml's [format] exclude names individual files that ruff format has
never been run over (the formatDebt entries in scripts/lint_debt.json), many
of them under scripts/ and src/lambda/. On one of
those, ruff format <path> rewrites the whole file and drags a large cosmetic diff
into a # nosec change; make lint-cicd would not have asked for it. Ask
python3 scripts/check_lint_debt.py --explain <path>, which reads the baseline
directly. Do not ask ruff: --force-exclude only restores the discovery
exclusions, so ruff format --check --force-exclude <path> prints empty output
for a file on the [format] exclude list (measured on two of them) rather than the
warning: No Python files found under the given path(s) that a discovery-level
exclusion gives — and empty output is easy to read as "nothing to do". If the file
is formatted, run bare ruff format rather than passing the path, because an
explicit path argument bypasses the exclusions and would reformat trees the repo
deliberately leaves alone. Also pin the local ruff to CI's
version before believing a formatting diff (CI: ruff==0.15.13 in .gitlab-ci.yml /
developer-tests.yml).
(Checkov findings similarly honor # checkov:skip=CKV_AWS_NNN: "reason", and
semgrep honors # nosemgrep: <rule-id> - reason — both already used in this
repo, e.g. scripts/srt/run.py, the WAF WebACL in nested/api-resolvers.)
2. scripts/srt/issues.json for security-matrix / Checkov CFN findings
SRT matches a scan finding to an existing issue by the 4-tuple
(path, resourceType, resourceName, check_id) (see mergeIssues in the
binary). To suppress, add an entry with that exact key and
"status": "suppressed" plus a "suppressionReason". The scanner emits
resourceName = the CloudFormation logical id and path = the template it
found the resource in (note: it scans both the source template.yaml and
any built .aws-sam/packaged.yaml; the .aws-sam copy is gitignored/absent in
CI, so suppressing the template.yaml path is what matters for the gate).
The file that counts is the committed scripts/srt/issues.json —
srt-setup copies it into .srt/ at the start of every run, so suppressions
must live there to survive. Editing only .srt/issues.json is lost on next
setup.
Entry shape (copy the issue/fix/resourceType/resourceName/check_id
verbatim from the scan's finding object so the key matches):
{
"source": "security-matrix",
"path": "nested/api-resolvers/template.yaml",
"resourceType": "AWS::ApiGateway::Stage",
"resourceName": "HttpApiStage",
"issue": "API Gateway does not have access logging enabled with proper retention",
"fix": "Ensure both DestinationArn and Format properties are specified in AccessLogSetting",
"priority": "HIGH",
"check_id": "API-GW-001",
"status": "suppressed",
"isCustomResource": false,
"firstDetectedAt": "<ISO8601>",
"assessmentCount": 1,
"suppressionReason": "Accepted (scanner limitation): AccessLogSetting IS configured with DestinationArn + Format but wrapped in Fn::If [EnableApiAccessLogs], which SRT cannot resolve. Logging is correctly implemented."
}Two ways to add entries:
- Interactive:
make srt-fixwalks each open finding and lets you suppress with a typed reason — then commit the updatedscripts/srt/issues.json. - Scripted (when srt-fix isn't practical): append entries to
scripts/srt/issues.jsonwith a small Python script. Dedupe on the 4-tuple key so you don't double-add. Grab the exact finding objects from.srt/issues.json(theOpenrecords) to copy their fields.
After either, restore + re-scan to confirm:
cp scripts/srt/issues.json .srt/issues.json && make srt-scanThe finding should now show Suppressed and drop out of the HIGH-open table.
Verifying and finishing
- Re-run
make srt-scan(aftercp scripts/srt/issues.json .srt/issues.json). - Confirm the HIGH-open table no longer lists tracked-file findings (gitignored noise may remain locally — that's fine, CI won't see it).
- Commit
scripts/srt/issues.jsonand any# nosec/# checkov:skipsource edits. Do not commit.srt/(gitignored binary/cache). - In the PR/MR description, list each finding and whether it was mitigated or suppressed-with-reason so reviewers can audit the security posture.
Known-good suppressions already in the baseline (context)
These are accepted and living in scripts/srt/issues.json — don't "re-fix":
- API-GW-001 / API-GW-006 (
HttpApiStage) — access/execution logging IS set behindFn::If [EnableApiAccessLogs]; scanner can't resolve the conditional. - API-GW-004 (
WebUIRootMethod,WebUIProxyMethod) — intentional auth-less public SPA static-asset routes; WAF + PRIVATE-endpoint policy compensate. - API-GW-002 (
HttpApi) — REST API in Lambda-proxy mode; the dispatcher validates each body per-field, request validators add nothing for opaque proxy payloads. - LAMBDA-012 (
nested/bedrockkb/template.yaml,StartIngestionJobFunction) — scanner false positive:StartIngestionJobFunctionRolehas exactly one consumer and the check's own fix text names no second function (…sharing role GetAtt:StartIngestionJobFunctionRole with .). - semgrep
npm-missing-minimum-release-age(src/ui/.npmrc) — accepted:npm ci+ committed lockfile resolves nothing from the registry, and the mitigation (min-release-age = 7) needs npm ≥ 11.10, newer than the build toolchain. Revisit when the build npm reaches 11.10. - Various DDB-002 / S3-008 / KMS-007 / EC2-002 / LAMBDA-* on the bastion/KB/feature-platform source templates — reviewed accepted risks.
⚠️ The baseline used to also carry 17 entries on
.aws-sam/*.yamlpaths. Those were deleted (along with 2 more keyed on paths that no longer exist:nested/alb-hosting, deleted outright, andnested/appsync, which is nownested/api-resolvers— the AppSync API it once held was replaced by an API Gateway REST API). They were local-scan pollution and dead paths, not accepted risks. Never add one back; see the next section for why.
Never suppress an .aws-sam/ finding — clean it instead
If a scan reports a pile of HIGH findings in .aws-sam/packaged.yaml /
.aws-sam/idp-main.yaml, you ran a scan over a built tree. It is not a
regression, and the fix is make srt-clean, never a suppression:
- SRT keys suppressions on
(path, resourceType, resourceName, check_id), so an artifact-path entry cannot cover the same resource in the sourcetemplate.yaml. It suppresses only the copy CI never sees. - Worse,
srt fixwrites those entries back asresolved, which is not sticky — the next local scan re-detects them asreopened, which does gate. That is a self-inflicted, recurring CI break.
Since 0.6.7 the tooling enforces this so you don't have to remember:
scripts/srt/ci_paths.pyclassifies each finding by whether its path is git-tracked (= present in CI's checkout; thesrt_security_reviewjob hasneeds: [], so no build precedes it). It fails closed — ifgit ls-filescan't be run, everything gates.scripts/srt/run.pyprints two tables: the gating🔴 OPEN HIGH PRIORITY SECURITY ISSUES(tracked files only) and a non-blockingℹ️ LOCAL-ONLY FINDINGS (gitignored files - NOT in CI). Only the first affects the exit code.scripts/srt/fix.pydrops gitignored-path findings before writing the committed baseline, somake srt-fixcan no longer re-pollute it.scripts/srt/tests/test_ci_paths.pyfails if any entry on an untracked path lands inscripts/srt/issues.json, or if asuppressedentry lacks asuppressionReason. Runs in CI viamake test-packages-cicd.
So a local table showing only LOCAL-ONLY findings is a pass. make srt-clean
still makes the tree match CI exactly if you want a clean run.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

