From d35f36a5a64cd7fd169ebcd790ff9426b90d555f Mon Sep 17 00:00:00 2001 From: Remi Antczak <140408771+remigiusz-antczak@users.noreply.github.com> Date: Fri, 13 Nov 2026 16:31:51 +0100 Subject: [PATCH 1/2] Tool hub: route pmd and solhint through review_checks.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds pmd (Java, one file per run, built-in category/java/security.xml ruleset only, SARIF, exit 4 = violations) and solhint (Solidity, one file per run, throwaway solhint:recommended config so a project .solhint.json that can load plugins is never read, SARIF). Both are NOT CHECKED when missing and not run on a crash, empty or wrong-shape output, a result with no location, or a non-zero exit with no row (PMD exit 5 and 1 are always not run). Flags come from the fetched PMD CLI reference and solhint README; solhint exit codes, the SARIF shapes, the PMD sarif format name and the bundled security ruleset path are marked unverified in tool-hub.md. Tests: 38/38 (hub-pmd-solhint 17, hub-tf-ansible 21) size-budget-raise: .claude/skills/deep-code-review/references/tool-hub.md 56593→57908 hub rows for pmd and solhint Co-Authored-By: Claude Opus 5.5 --- .claude/skills/deep-code-review/INDEX.md | 2 +- .../deep-code-review/references/tool-hub.md | 2 + .../deep-code-review/scripts/review_checks.sh | 20 +++-- SHA256SUMS | 6 +- changelog.d/hub-pmd-solhint.md | 3 + docs/INDEX.md | 2 +- docs/standards-index.md | 2 + .../review-checks-hub-pmd-solhint.sh | 2 + scripts/size-budgets.tsv | 2 +- scripts/test-review-checks-hub-pmd-solhint.sh | 84 +++++++++++++++++++ 10 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 changelog.d/hub-pmd-solhint.md create mode 100644 scripts/ci-tests.d/review-checks-hub-pmd-solhint.sh create mode 100755 scripts/test-review-checks-hub-pmd-solhint.sh diff --git a/.claude/skills/deep-code-review/INDEX.md b/.claude/skills/deep-code-review/INDEX.md index c5a604520..9e51fadcb 100644 --- a/.claude/skills/deep-code-review/INDEX.md +++ b/.claude/skills/deep-code-review/INDEX.md @@ -138,7 +138,7 @@ Generated by `scripts/skill_index.py` (do not hand-edit; rerun it after changing | `references/testing-ui.md` | the target renders a UI or ships browser / E2E specs. | 4868 | | `references/threat-modeling.md` | a change adds a trust boundary, an auth path, a data flow to a new party, an agent or tool capabili… | 2574 | | `references/time-date-correctness.md` | reviewing anything that stores, computes, schedules, or renders timestamps, durations, recurring ev… | 4809 | -| `references/tool-hub.md` | a review should lean on external scanners via the tool hub (workflows, Python, Go, SBOM/lockfiles,… | 14148 | +| `references/tool-hub.md` | a review should lean on external scanners via the tool hub (workflows, Python, Go, SBOM/lockfiles,… | 14477 | | `references/ux-components.md` | the target or diff renders one concept in more than one place: a shared component or design token,… | 7235 | | `references/ux-dataviz.md` | the target or diff renders a chart, sparkline, heat-map or calendar grid, a KPI / metric delta, a c… | 2787 | | `references/ux-gates.md` | a UI change is claimed verified on screenshot evidence, the project's auto-merge or CI policy gates… | 3756 | diff --git a/.claude/skills/deep-code-review/references/tool-hub.md b/.claude/skills/deep-code-review/references/tool-hub.md index b595163c9..f34c5522a 100644 --- a/.claude/skills/deep-code-review/references/tool-hub.md +++ b/.claude/skills/deep-code-review/references/tool-hub.md @@ -67,6 +67,8 @@ The agent sandbox denies installs and most network, so the owner provisions scan | `devskim` | Multi-language source (Microsoft DevSkim, MIT), one changed file per run (`analyze --source-code` takes a file: `AnalyzeCommand.cs` has a single-file branch); rows from the SARIF results; wired only once installed | `devskim analyze --source-code FILE --file-format sarif`; SARIF to stdout (`-O` unset, `Console.Out`); without `-E` the exit is 0 whatever it finds, and `ExitCode.cs` makes errors negative (`CriticalError` -2, `ArgumentParsingError` -3), so any non-zero exit, empty output or a document without `runs[].results` is not run. `--file-format` is passed because the writer factory falls back to `text` when it is empty | verified for flags, exit codes and license (wiki Analyze Command; source at 7f8e5e24f6: options in `BaseAnalyzeCommandOptions.cs`, exit codes, `SarifWriter.cs`; README: MIT), not for the SARIF shape. Egress: no HTTP client, update or telemetry code in `DevSkim-DotNet` `*.cs` (grep); its NuGet dependencies (CommandLineParser, LibGit2Sharp, Sarif.Sdk, ApplicationInspector, Newtonsoft.Json) were not audited, so egress by a dependency is `unverified`; the SARIF help URIs are text. The SARIF shape (`runs[].results[]`) is stub-tested only, not verified: no real DevSkim output was fetched or run, so a real report may differ | route-only | | `tfsec` | Terraform `.tf` files, one directory per changed file (tfsec scans directories, not files): run from the file's directory, rows kept only for the changed file; no module download; wired only once installed. Upstream says engineering attention moves to Trivy, so this row is a stopgap | `tfsec . --format sarif --no-colour --soft-fail --no-module-downloads --exclude-downloaded-modules`; `--soft-fail` suppresses the error code, so any non-zero exit, empty output or a document without `runs[].results` is not run | verified for flags only (usage guide and README, fetched 2026-11-13: `--format` lists sarif, `--soft-fail`, `--no-module-downloads`, `--exclude-downloaded-modules`, exit status non-zero on findings). Not verified: the SARIF shape and uri form (stub-tested only; a mismatched path form drops rows, never reads as a finding), egress and license. Rows overlap `checkov` and `kics` | route-only | | `ansible-lint` | Ansible-looking YAML in a diff (a `roles/`, `tasks/`, `handlers/` or `playbooks/` path, or a file with `hosts:` and `tasks:` or `roles:`), changed files in one call; a changed `.ansible-lint` or `ansible.cfg` is `NOT CHECKED` (config is code); wired only once installed | `ansible-lint --offline --nocolor -q -f sarif FILES`; `--offline` disables requirements.yml installation and schema refresh. Exit codes are not documented (usage page), so a non-zero exit with no row is not run, never clean; a row for a file outside the changed list is also not run | verified for flags (usage page, fetched 2026-11-13: `--offline`, `-q`, `--nocolor`, `-f` choices include sarif). Not verified: exit codes, the SARIF shape, egress and license. The page contradicts itself on whether `-f json` is codeclimate or SARIF, so Perun passes `sarif` explicitly | route-only | +| `pmd` | Java `.java` files in a diff, one file per run; wired only once installed | `pmd check --no-cache --no-progress -R category/java/security.xml -f sarif -d FILE`: only PMD's built-in security ruleset, never a project ruleset (it can name custom classes). Exit 4 = violations, 5 = recoverable error (not run), anything else with no row is not run, never clean | verified for flags `check`, `-d`, `-R`, `-f`, `--no-cache`, `--no-progress` and the exit-code table (CLI reference, fetched 2026-11-13). Not verified: that `sarif` is the format name (the page links to the formats page only), that `category/java/security.xml` ships in the distribution, the SARIF shape, egress and license | route-only | +| `solhint` | Solidity `.sol` files in a diff, one file per run; wired only once installed | `solhint --config TMPCFG -f sarif --noPoster --disc FILE` with a throwaway config of `solhint:recommended`: a project `.solhint.json` can load plugins (code) and is never read. A non-zero exit other than 1, or a non-zero exit with no row, is not run, never clean | verified for flags `-f` (formatters include sarif), `--config`, `--noPoster`, `--disc`, MIT license (README, fetched 2026-11-13). Not verified: exit codes, the SARIF shape, that `solhint:recommended` is a valid `extends` value, egress | route-only | | `bundler-audit` | Ruby lockfiles: a changed `Gemfile.lock`, one per run, against the local ruby-advisory-db only; rows on the lockfile for each unpatched gem and insecure source; with no local db (`BUNDLER_AUDIT_DB` or `~/.local/share/ruby-advisory-db`) it is NOT CHECKED, because the tool would download one; wired only once installed | `bundle-audit check DIR --gemfile-lock Gemfile.lock --format json`, no `--update`; exit 1 means vulnerable (`cli.rb`: `exit(1) if report.vulnerable?`) but also every error, so exit 0 must give no rows, exit 1 must give rows, and anything else, empty output or a wrong shape is not run | verified for flags, `Database.exists?` and default paths, JSON shape (`Report#to_h`, `UnpatchedGem#to_h`, `InsecureSource#to_h`) and license GPL-3.0-or-later (README and source, fetched 2026-11-13); the binary name `bundle-audit` is from the README, not from the gemspec. Egress: the check downloads a db only when none exists (guarded here); no other network code was read. Stub-tested only: no real report was run | route-only | | `cfn-lint` | CloudFormation templates: changed `.yaml .yml .json .template` files that name `AWSTemplateFormatVersion`, in one call; Error and Warning rows, Informational dropped; wired only once installed | `cfn-lint --format json -- FILES`; exit is a bitwise OR of 2 error, 4 warning, 8 informational (project docs), so 0, 2, 4, 6, 8, 10, 12 and 14 are runs and any other exit, empty output or a wrong shape is not run | verified for exit codes, `--format json` and license MIT-0 (repository page) and the JSON keys (`formatters/json.py`), fetched 2026-11-13. Egress: not audited, `unverified` (a spec download on a normal run was not ruled out). Stub-tested only | route-only | | `guarddog` | npm packages a changed `package-lock.json` newly adds (name@version absent from the merge-base lock; a bump counts) and that are installed under `node_modules` at the locked version (the installed `package.json` says so); `hasInstallScript` ones first, then at most 25 and about 300 s in all (`REVIEW_GUARDDOG_BUDGET`), the rest named in a `not-checked` row; not under `--full`; not a `hub=` row | `guarddog npm scan --output-format json DIR` on existing in-repo dirs only (it fetches a non-directory argument as a registry name), only when `guarddog --version` says 3.x; `--no-sandbox` (behind a dead proxy) only after its sandbox fails to start (nested); never `verify`; leads: `threat-*` rules only, each tagged `[heuristic]`; a rule that errors is a `not-checked` row and the other rules' hits stay; a newly added lock entry with `hasInstallScript` is a `package-lock` lead of its own | verified (`--help`, 3.2.0 source, real run 2026-10-30); the install-hook rules (`threat-npm-preinstall-script`, `threat-process-hooks`) match `*/package.json`, a nested one, so a package's own root `package.json` hook is never flagged | route-only | diff --git a/.claude/skills/deep-code-review/scripts/review_checks.sh b/.claude/skills/deep-code-review/scripts/review_checks.sh index 0056a5c3e..8b145ef15 100755 --- a/.claude/skills/deep-code-review/scripts/review_checks.sh +++ b/.claude/skills/deep-code-review/scripts/review_checks.sh @@ -14,7 +14,7 @@ # If that pack errors or hangs to the timeout, that 200-file chunk reruns with the bundled rules alone (the later chunks too, unless an earlier pack run succeeded) and the run says so, so it never reads as a # full clean: `semgrep(bundled-only)` under analyzers ran (and under partial and fixable in the closing line), `semgrep p/default pack ()` under NOT RUN and a not-checked row, with the fix named (a warm # snapshot: provision_tools.sh --print). That is the only report of the gap: no separate "missing tools" row. -# Tool hub: zizmor, actionlint, bandit, ruff-security (ruff check --select S), gosec, govulncheck, grype, syft (SBOM inventory, counted not scored), checkov, hadolint, kube-linter, kube-score, kubescape (NSA and CIS frameworks, local artifacts only), tflint, tfsec (Terraform, SARIF, no module download), ansible-lint (Ansible, offline, SARIF), staticcheck (Go, offline), cargo-deny and cargo-audit (Rust, offline, local advisory DB only), brakeman, mobsfscan (Android/iOS source), psalm (PHP taint, local psalm.xml only), detect-secrets (changed files, no baseline, no verification, values never printed), njsscan (Node.js), sobelow (Elixir Phoenix, local source, no update check), flawfinder, cppcheck (C/C++, no build) and devskim (multi-language), eslint-security (the project's own local eslint only), kics (IaC), retire (retire.js: vulnerable vendored JS libraries, local advisory repo only), licensee (license inventory, counted not scored), cosign (verify-blob offline against a repo cosign.pub) (snyk-agent-scan is unverified, skipped) run from one registry +# Tool hub: zizmor, actionlint, bandit, ruff-security (ruff check --select S), gosec, govulncheck, grype, syft (SBOM inventory, counted not scored), checkov, hadolint, kube-linter, kube-score, kubescape (NSA and CIS frameworks, local artifacts only), tflint, tfsec (Terraform, SARIF, no module download), ansible-lint (Ansible, offline, SARIF), pmd (Java security ruleset, offline, SARIF) and solhint (Solidity, built-in recommended rules only, SARIF), staticcheck (Go, offline), cargo-deny and cargo-audit (Rust, offline, local advisory DB only), brakeman, mobsfscan (Android/iOS source), psalm (PHP taint, local psalm.xml only), detect-secrets (changed files, no baseline, no verification, values never printed), njsscan (Node.js), sobelow (Elixir Phoenix, local source, no update check), flawfinder, cppcheck (C/C++, no build) and devskim (multi-language), eslint-security (the project's own local eslint only), kics (IaC), retire (retire.js: vulnerable vendored JS libraries, local advisory repo only), licensee (license inventory, counted not scored), cosign (verify-blob offline against a repo cosign.pub) (snyk-agent-scan is unverified, skipped) run from one registry # (`hub=`); a matching changed file with the tool missing prints "NOT CHECKED: (install: )" on stderr, never a silent clean. # Built-in, always on, no install: invisible_chars.py flags NUL/C0 control characters and bidi/zero-width/tag characters in changed text files (tool `invisible-chars`, with line and col; # rows under fixture/test paths carry `[likely-fixture]`; third_party/, Pods/, bower_components/ and *.min.js are skipped; a `not-checked` row is unchecked surface). @@ -317,7 +317,7 @@ if kind == "cppcheck": # XML, not JSON: hits; errors: rule -> why it did not run (its key stays in results, empty). A rule error costs that rule only: the other hits stay and a not-checked row names it @@ -613,7 +613,7 @@ elif kind == "semgrep": ps = sorted({pfx(f) for f in fs} - {""}, key=len, reverse=True) cid = lambda i: next((i[len(q):] for q in ps if isinstance(i, str) and i.startswith(q)), i) rows = [(r["path"], r["start"]["line"], cid(r.get("check_id")), (r.get("extra") or {}).get("message", "")) for r in d["results"]] -elif kind in ("codeql", "flawfinder", "devskim", "tfsec", "ansible-lint"): # SARIF: ruleId, uri, startLine and the query's message text (never source); results with no location raise: unparseable, never dropped +elif kind in ("codeql", "flawfinder", "devskim", "tfsec", "ansible-lint", "pmd", "solhint"): # SARIF: ruleId, uri, startLine and the query's message text (never source); results with no location raise: unparseable, never dropped for run in d["runs"]: for r in run["results"]: p = r["locations"][0]["physicalLocation"] @@ -963,6 +963,8 @@ hub=( 'psalm;verified;batch;\.php$;route-only;composer global require vimeo/psalm' # taint analysis, whole project per the root psalm.xml, rows kept for changed files; psalm.xml is code: not run when the diff changes it or composer.json 'cosign;verified;each;(^|/)[^/]+\.(sig|bundle)$|(^|/)\.sigstore(/|$);route-only;brew install cosign' # verify-blob offline, no finding rows: only a .bundle with a cosign.pub beside it or at the root and its signed blob is checked, else NOT CHECKED 'tfsec;verified;each;\.tf$;route-only;brew install tfsec' # one directory per run (it scans directories, not files): run from the file's directory with --no-module-downloads, SARIF, --soft-fail; only rows for the changed file are kept. Winding down upstream in favour of trivy, still shipped + 'pmd;verified;each;\.java$;route-only;brew install pmd' # one file per run, the built-in category/java/security.xml ruleset only (a project ruleset can name custom classes and is never loaded), --no-cache, SARIF on stdout; exit 4 = violations, 5 = recoverable error (not run) + 'solhint;verified;each;\.sol$;route-only;npm install -g solhint' # one file per run with a throwaway config of solhint:recommended only (a project .solhint.json can load plugins = code and is never read), SARIF on stdout, --disc (no update check) 'ansible-lint;verified;batch;\.ya?ml$;route-only;pipx install ansible-lint' # only Ansible-looking YAML (roles/tasks/handlers/playbooks paths, or hosts: with tasks:/roles:); --offline (no requirements.yml install, no schema refresh), SARIF 'snyk-agent-scan;unverified;each;(^|/)(\.mcp\.json|mcp[^/]*\.json|SKILL\.md)$;route-only;uvx snyk-agent-scan' ) @@ -1002,6 +1004,8 @@ hubcmd() { flawfinder) cmd=(flawfinder --sarif --quiet "$@") ;; cppcheck) cmd=(cppcheck --xml-version=2 --quiet "$@") ;; tfsec) cmd=(bash -c 'cd "$1" && shift && exec "$@"' _ "${1%/*}" tfsec . --format sarif --no-colour --soft-fail --no-module-downloads --exclude-downloaded-modules) ;; # --soft-fail: exit 0 whatever it finds (docs: it suppresses the error code), so any other exit is a crash + pmd) cmd=(pmd check --no-cache --no-progress -R category/java/security.xml -f sarif -d "$1"); okrc="4" ;; # exit 0 none, 4 violations, 5 recoverable error, 1 exception, 2 usage (PMD CLI reference); a non-zero exit with no row is never clean (guard below) + solhint) printf '{"extends":"solhint:recommended"}\n' >"$td/solhint.json"; cmd=(solhint --config "$td/solhint.json" -f sarif --noPoster --disc "$1"); okrc="1" ;; # exit codes are not documented on the README: a non-zero exit with no row is never clean (guard below) ansible-lint) cmd=(ansible-lint --offline --nocolor -q -f sarif "$@"); okrc="1 2" ;; # exit codes are not documented: a non-zero exit with no row is never clean (guard below) devskim) cmd=(devskim analyze --source-code "$@" --file-format sarif) ;; njsscan) cmd=(njsscan --json "$@"); okrc="1" ;; # JSON to stdout without -o; exit 1 = an ERROR rule matched or errors (-w would add WARNING; not used) @@ -1035,13 +1039,13 @@ while IFS=';' read -r hn hs hm hre _ hh; do brakeman) grep -qiE "^[[:space:]]*gem[[:space:]]+['\"]rails['\"]" Gemfile 2>/dev/null || hf= ;; esac [ -n "$hf" ] || continue - [ "$hs" != verified ] || case $hn in syft|licensee|detect-secrets|njsscan|sobelow|flawfinder|cppcheck|devskim|kubescape|retire|tfsec|ansible-lint) ;; *) wired+=" $hn" ;; esac # syft and licensee are inventories, not scanners: never wired or ran; detect-secrets (matches every file) and njsscan are wired only once installed (below), as provision_tools.sh does not install them, so a missing one is NOT CHECKED, never "fixable" + [ "$hs" != verified ] || case $hn in syft|licensee|detect-secrets|njsscan|sobelow|flawfinder|cppcheck|devskim|kubescape|retire|tfsec|ansible-lint|pmd|solhint) ;; *) wired+=" $hn" ;; esac # syft and licensee are inventories, not scanners: never wired or ran; detect-secrets (matches every file) and njsscan are wired only once installed (below), as provision_tools.sh does not install them, so a missing one is NOT CHECKED, never "fixable" nc() { echo "NOT CHECKED: $hn ($1)" >&2; add "$hn" "" 0 not-checked "$1"; } if [ "$hs" != verified ]; then nc "$hs flags: skipped by default"; continue; fi hb=$hn; [ "$hn" != ruff-security ] || hb=ruff; [ "$hn" != bundler-audit ] || hb=bundle-audit; [ "$hn" != eslint-security ] || hb=./node_modules/.bin/eslint command -v "$hb" >/dev/null || { nc "install: $hh"; missing+=" $hn"; miss "$hn" "install: $hh"; continue; } hubtool=$hn - case $hn in detect-secrets|njsscan|sobelow|flawfinder|cppcheck|devskim|tfsec|ansible-lint) wired+=" $hn" ;; esac + case $hn in detect-secrets|njsscan|sobelow|flawfinder|cppcheck|devskim|tfsec|ansible-lint|pmd|solhint) wired+=" $hn" ;; esac if [ "$hn" = sobelow ] && [ "$full" = 0 ] && [ -n "$(changed '(^|/)(mix\.exs|\.sobelow-conf)$')" ]; then nc "mix.exs or .sobelow-conf changed in this diff: its config is code, not run"; continue; fi # zizmor, actionlint, bandit and hadolint are light (single-file static checks), so they are intentionally unleased. case $hn in grype|checkov|gosec|govulncheck|staticcheck|kics) lease_take || { skip "$hn" "heavy lease full"; continue; } ;; esac @@ -1095,7 +1099,7 @@ while IFS=';' read -r hn hs hm hre _ hh; do if [ "$hn" = tfsec ] && grep -v '^[[:space:]]*[][{},"]' "$jf" | grep -qiE 'error|fail|cannot|unable|invalid|panic'; then skip tfsec "$f: tfsec reported an error on stderr; the scan may be incomplete"; continue; fi [ "$hn" != staticcheck ] || [ "$rc" = 0 ] || grep -q '[^[:space:]]' "$jf" || { skip staticcheck "exit $rc with no output"; break; } # exit 1 and nothing printed is a setup failure, not a clean run # a failing exit with no row is a crash (cargo-deny exit 1 is also its advisories bit): not a finding, never clean - if sjson "$hn" "$jf" >"$tsv" && { case $hn in cargo-deny|cargo-audit|mobsfscan|retire|ansible-lint) [ "$rc" = 0 ] || [ -s "$tsv" ] ;; sobelow|bundler-audit) case "$([ "$rc" = 0 ] && echo z)$([ -s "$tsv" ] && echo r)" in z|r) ;; *) false ;; esac ;; njsscan) if [ "$rc" = 0 ]; then ! grep -q $'^[^\t]*\t[^\t]*\t[^\t]*\tERROR: ' "$tsv"; else grep -q $'^[^\t]*\t[^\t]*\t[^\t]*\tERROR: ' "$tsv"; fi ;; psalm) case "$([ "$rc" = 0 ] && echo z)$([ -s "$tsv" ] && echo r)" in z|r) ;; *) false ;; esac ;; esac; }; then + if sjson "$hn" "$jf" >"$tsv" && { case $hn in cargo-deny|cargo-audit|mobsfscan|retire|ansible-lint|pmd|solhint) [ "$rc" = 0 ] || [ -s "$tsv" ] ;; sobelow|bundler-audit) case "$([ "$rc" = 0 ] && echo z)$([ -s "$tsv" ] && echo r)" in z|r) ;; *) false ;; esac ;; njsscan) if [ "$rc" = 0 ]; then ! grep -q $'^[^\t]*\t[^\t]*\t[^\t]*\tERROR: ' "$tsv"; else grep -q $'^[^\t]*\t[^\t]*\t[^\t]*\tERROR: ' "$tsv"; fi ;; psalm) case "$([ "$rc" = 0 ] && echo z)$([ -s "$tsv" ] && echo r)" in z|r) ;; *) false ;; esac ;; esac; }; then case " $ran " in *" $hn "*) ;; *) ran+=" $hn" ;; esac if [ "$hm" = batch ]; then printf '%s\n' "$hf" >"$td/hf"; nraw=0 nout=0 @@ -1121,7 +1125,7 @@ while IFS=';' read -r hn hs hm hre _ hh; do while IFS=$'\t' read -r _ l r m; do add "$hn" "$f" "$l" "$r" "$m"; done <"$tsv" fi fi - elif [ "$hn" = ansible-lint ] && [ "$rc" != 0 ]; then skip "$hn" "exit $rc with no row, or unparseable output" + elif case $hn in ansible-lint|pmd|solhint) [ "$rc" != 0 ] ;; *) false ;; esac; then skip "$hn" "exit $rc with no row, or unparseable output" else skip "$hn" "unparseable output"; fi [ "$hm" != batch ] || break done <<<"$([ "$hm" = batch ] && echo x || printf '%s\n' "$hf")" diff --git a/SHA256SUMS b/SHA256SUMS index 93a931f81..c8ee16117 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -206,7 +206,7 @@ d98f3e4380da3496061ba63be7beebe75017ab4ee1734eda9a3e798e19007b0e .claude/skills 92d22cc5d0a60ba6bdb1f4a9b597823dec5b8412cec09a5be6cf93b3973f4226 .claude/skills/contribution/scripts/prefile_check.sh 18f20db537ab784460ad33cf218f7a01ac0a172fc38413f14c0e19e1ce6821cc .claude/skills/contribution/scripts/share_learning.py 8f0f9f0e2714befe6eb815489ed05c96cb3f0b7c3bfe964be1f2d04f1d914dca .claude/skills/deep-code-review/INDEX-scripts.md -ec2a644bd46d42d42a27d40ec7affdf654a228a2376cc83abcd3a086b33dbc50 .claude/skills/deep-code-review/INDEX.md +0475a7e34f837095449ad7d1d0f086b993a85c81bdcdf3131f26484c14f5e97b .claude/skills/deep-code-review/INDEX.md c409fd76bcf137e160bf9bbe07ab54dba186db2857d07e47fed82e53fef877ad .claude/skills/deep-code-review/SKILL.md 1da2bea6a03e0da49cc3323745a49bc7b1085c61d9dc6afa9fcc06e890349131 .claude/skills/deep-code-review/VERSION f79acffb8481dcdd30278614ab18cc3895ddec4f65c60957a1b6f1b6ae28c6ae .claude/skills/deep-code-review/evals/evals.json @@ -343,7 +343,7 @@ a0ed7ad061b7e60230601ee9b38a00400841d6ddf3af386edbd4b34a981c9798 .claude/skills 8581f0023aedc9e0a4dece61cb2ea876ca9ab57f6acda63ed16c9b54494a1bc8 .claude/skills/deep-code-review/references/testing-ui.md 68df4819a34cbe23756eb19e9b513b9edcd675ad55da7d8c7624d95b124a9744 .claude/skills/deep-code-review/references/threat-modeling.md cf5218579b77d07ca49349165ab6d64c94b0145f61a4438cb09898a414793c68 .claude/skills/deep-code-review/references/time-date-correctness.md -c4e804739dd1410eb9089d4186c00cbd4cd800dfc1edef1e5d78f440a0e86c9b .claude/skills/deep-code-review/references/tool-hub.md +fd5907b8cbb15736b2281d9fb3b57ab4c7e16f594853c04683beacc1acff9472 .claude/skills/deep-code-review/references/tool-hub.md bfda9dd8f0d1718725e0fb8c2d6890f4fc2742c9a0d7993112ecf459a3af9f9c .claude/skills/deep-code-review/references/ux-components.md 5e69c5a0c0ab8d94079f2f08e026bc0e700369c76cd7dfeee6e5c7c5c2f020bb .claude/skills/deep-code-review/references/ux-dataviz.md 68c40fe7134afac5fae125f107726136a911c67c1d4abdf0e4c627aee6751713 .claude/skills/deep-code-review/references/ux-gates.md @@ -414,7 +414,7 @@ fc322d684cd388d211b34e6c896f4aea05e0fef451d984dd11edab2e7a2082bb .claude/skills 1a61b499457ec5739350f0d1cd1c506e787406fa11be2a1520977cdcc727748a .claude/skills/deep-code-review/scripts/provision_tools.sh e1d1d2eab715ef280b8c211a9da15ebe6b87969de89d7028d7f1cc82d64fc1f0 .claude/skills/deep-code-review/scripts/reaper_lint.py 7849fac82d7d6bb3f8e178ebf3149504feec70ea09c6ef8e21c8ce294c290b5d .claude/skills/deep-code-review/scripts/report_contract_lint.py -36eaed3be73cdaa5ef957ff5aa108938113e8a22347e30cb864d42488e177ec6 .claude/skills/deep-code-review/scripts/review_checks.sh +5179f6a23b1019a84b93cde6384a7777ccf1a4882eafd6d7ebfdfaba9dff7249 .claude/skills/deep-code-review/scripts/review_checks.sh 8c87c02a050a975e453b52ecacbaf01481c7134466a9c67feaf409d22e36d9f7 .claude/skills/deep-code-review/scripts/review_feedback.py fc5a897a11098726503bd003ec21a2c4fa873a11408c11490981ac1db5a0f382 .claude/skills/deep-code-review/scripts/route_auth_map.py 859c67d6a6a781c873f47d5662d403da2321da53e6994ca3d0ccdbf74afd39ac .claude/skills/deep-code-review/scripts/score_review.py diff --git a/changelog.d/hub-pmd-solhint.md b/changelog.d/hub-pmd-solhint.md new file mode 100644 index 000000000..4519e1d55 --- /dev/null +++ b/changelog.d/hub-pmd-solhint.md @@ -0,0 +1,3 @@ +### Added +- `review_checks.sh` tool hub routes `pmd` (Java, one file per run, PMD's built-in security ruleset only, SARIF) and `solhint` (Solidity, one file per run, a throwaway `solhint:recommended` config so a project `.solhint.json` that can load plugins is never read, SARIF). Both are `NOT CHECKED` when missing and `not run` on a crash, empty or wrong-shape output or a non-zero exit with no row; neither is in `provision_tools.sh`. Flags are from the fetched upstream docs; solhint exit codes, the SARIF shapes and the PMD `sarif` format name are marked unverified in `tool-hub.md`. +- size-budget-raise: .claude/skills/deep-code-review/references/tool-hub.md 56593→57908 hub rows for pmd and solhint diff --git a/docs/INDEX.md b/docs/INDEX.md index 3c1a1fcc2..dfcd6436a 100644 --- a/docs/INDEX.md +++ b/docs/INDEX.md @@ -23,7 +23,7 @@ Generated by `python3 .claude/skills/agentic-delivery/scripts/focus_kit.py docs- | `docs/scoreboard.md` | Perun scoreboard: Generated by scripts/scoreboard.py from committed results | 5143 | | `docs/security-heldout-table-1026/table.md` | Security held-out table, 2026-10-26: Generated by results.py (offline, $0, byte-identical on rerun). | 1847 | | `docs/self-improvement.md` | How Perun improves itself: Perun is improved by running Perun on Perun: its own review skill (deep-code-review), idea attack (idea-critic),… | 1268 | -| `docs/standards-index.md` | Standards index: Every standard the skill relies on, split into what was verified by direct fetch for this release and what is referenced b… | 108235 | +| `docs/standards-index.md` | Standards index: Every standard the skill relies on, split into what was verified by direct fetch for this release and what is referenced b… | 108397 | | `docs/team-install.md` | Team-wide install through a Claude Code plugin marketplace: This repository is its own marketplace (.claude-plugin/marketplace.json, name p… | 478 | | `docs/technical-overview.md` | Technical overview: you want the engineering detail that used to sit in the top-level README.md: the mechanisms table, the full "what you g… | 2288 | | `docs/token-cost-tips.md` | Token cost tips for teams: the biggest savings come from sending less context, using the cheapest model tier that clears its own gate, and… | 2127 | diff --git a/docs/standards-index.md b/docs/standards-index.md index f891a1ed3..8b61be61a 100644 --- a/docs/standards-index.md +++ b/docs/standards-index.md @@ -1995,6 +1995,8 @@ Verification date: **2026-11-05**. Raw-byte sha256 of each fetch and the item id | tfsec — usage guide | https://aquasecurity.github.io/tfsec/latest/guides/usage/ | Fetched 2026-11-13: `--format` (lists json, sarif, others), `--no-colour`, `--soft-fail` ("suppresses error code"), `--no-module-downloads`, `--exclude-downloaded-modules`. Exit codes and the JSON or SARIF field names are not on the page. | | tfsec — README | https://raw.githubusercontent.com/aquasecurity/tfsec/master/README.md | Fetched 2026-11-13: exit status is non-zero if tfsec finds problems; "tfsec will continue to remain available for the time being" and engineering attention is directed at Trivy; no license stated on the page. | | ansible-lint — usage | https://docs.ansible.com/projects/lint/usage/ | Fetched 2026-11-13: `-f` choices `brief,full,md,json,codeclimate,quiet,pep8,sarif`, `--offline` ("Disable installation of requirements.yml and schema refreshing"), `-q`, `--nocolor`, `--profile`, `-s/--strict`. The page contradicts itself on whether `json` is an alias for codeclimate or SARIF; exit codes are not documented. | +| PMD — CLI reference | https://pmd.github.io/pmd/pmd_userdocs_cli_reference.html | Fetched 2026-11-13: `check`, `-d`, `-R` (required), `-f`, `--no-cache`, `--[no-]progress`, `--[no-]fail-on-violation`, `-r`; exit codes 0 none, 1 exception, 2 usage, 4 violations, 5 recoverable error. The page does not list `sarif` as a format name. | +| solhint — README | https://github.com/protofire/solhint/blob/master/README.md | Fetched 2026-11-13: `-f` formatters `stylish, table, tap, unix, json, compact, sarif`, `-c/--config`, `--noPoster`, `--disc`, `--cache`; config `plugins` array; MIT. Exit codes and the JSON or SARIF shape are not on the page. | | OSI — approved licenses list | https://opensource.org/licenses | Fetched 2026-11-12: lists the licenses that comply with the Open Source Definition; no Elastic license entry appears on the page. | | bearer — repository page | https://github.com/Bearer/bearer | Fetched 2026-11-12: code licensed under the Elastic License 2.0; no offering to third parties as a hosted or managed service without approval. Not on the OSI list (next row), so not routed (the LICENSE URL guessed first returned 404; the page's own link is https://github.com/Bearer/bearer/blob/main/LICENSE.txt, not fetched). | | sobelow — README | https://raw.githubusercontent.com/nccgroup/sobelow/master/README.md | Fetched 2026-11-12: `--format`, `--exit` (non-zero status at or above a confidence threshold), `--private` (skip update checks), "All `json` formatted findings contain a `type`, `file`, and `line` key", `mix escript.install hex sobelow`; no full JSON schema or numeric exit code on the page. | diff --git a/scripts/ci-tests.d/review-checks-hub-pmd-solhint.sh b/scripts/ci-tests.d/review-checks-hub-pmd-solhint.sh new file mode 100644 index 000000000..c34830228 --- /dev/null +++ b/scripts/ci-tests.d/review-checks-hub-pmd-solhint.sh @@ -0,0 +1,2 @@ +# review_checks.sh hub routing for pmd (Java) and solhint (Solidity); stub binaries. +bash scripts/test-review-checks-hub-pmd-solhint.sh diff --git a/scripts/size-budgets.tsv b/scripts/size-budgets.tsv index 3860acfa3..67c7cea67 100644 --- a/scripts/size-budgets.tsv +++ b/scripts/size-budgets.tsv @@ -234,7 +234,7 @@ README.md 16118 .claude/skills/deep-code-review/references/small-diff-read-budget.md 526 .claude/skills/deep-code-review/references/app-pentest.md 8135 .claude/skills/deep-code-review/references/supply-chain-check.md 3646 -.claude/skills/deep-code-review/references/tool-hub.md 56593 +.claude/skills/deep-code-review/references/tool-hub.md 57908 .claude/skills/deep-code-review/references/desktop-native-appsec.md 4724 .claude/skills/deep-code-review/references/dynamic-probe.md 2095 .claude/skills/agentic-delivery/references/flow-guards.md 3171 diff --git a/scripts/test-review-checks-hub-pmd-solhint.sh b/scripts/test-review-checks-hub-pmd-solhint.sh new file mode 100755 index 000000000..c81b41b34 --- /dev/null +++ b/scripts/test-review-checks-hub-pmd-solhint.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# review_checks.sh hub routing for pmd (Java) and solhint (Solidity) with stub binaries on a hermetic PATH (no real tool, no network): +# rows keep findings, a missing tool is "NOT CHECKED", and a crash, empty output, wrong-shape output or a non-zero exit with no row is +# "not run", never clean. The fail-open cases (exit 4/1 with an empty results list) fail before the guard in review_checks.sh. +set -euo pipefail +ROOT=$(cd "$(dirname "$0")/.." && pwd) +RC=${REVIEW_CHECKS:-$ROOT/.claude/skills/deep-code-review/scripts/review_checks.sh} +T=$(mktemp -d "${TMPDIR:-/tmp}/hubpms.XXXXXX") && [ -n "$T" ] && [ -d "$T" ] || { echo "no temp dir" >&2; exit 1; } +trap 'cd /; rm -r -- "$T"' EXIT; fail=0 +ok() { echo "ok - $1"; }; bad() { echo "FAIL - $1"; fail=1; } +export PERUN_HEAVY_DIR="$T/heavy" HUB_LOG="$T/hub.log" DCR_CACHE_ROOT="$T/nocache" DCR_USER_BIN= TMPDIR="$T/tmp" HOME="$T/home" +mkdir -p "$T/repo" "$T/bin" "$T/base" "$T/sys" "$T/tmp" "$T/home" && cd "$T/repo" +git init -q . && case "$(git rev-parse --show-toplevel)" in "$(cd "$T" && pwd -P)"/*) ;; *) echo "refusing: repo not under temp dir" >&2; exit 1 ;; esac +G() { git -c user.email=t@example.com -c user.name=t "$@"; } +printf 'x\n' >README.md; G add . && G commit -q -m base && git branch base +mkdir -p src contracts +printf 'class A {}\n' >src/A.java; printf 'pragma solidity ^0.8.0;\n' >contracts/T.sol; printf 'a\n' >notes.txt +G add . && G commit -q -m code +cat >"$T/bin/pmd" <<'S' +#!/usr/bin/env bash +echo "pmd $*" >>"$HUB_LOG" +[ "${HUB_MODE:-}" != crash ] || exit 9 +printf '%s' "$J_pmd" +exit "${PMD_RC:-4}" +S +cat >"$T/bin/solhint" <<'S' +#!/usr/bin/env bash +echo "solhint $*" >>"$HUB_LOG" +[ "${HUB_MODE:-}" != crash ] || exit 9 +[ "$1" != --config ] || echo "cfg: $(cat "$2")" >>"$HUB_LOG" +printf '%s' "$J_sol" +exit "${SOL_RC:-1}" +S +chmod +x "$T/bin/pmd" "$T/bin/solhint"; mkdir "$T/keep"; cp "$T/bin/pmd" "$T/bin/solhint" "$T/keep/" +printf '#!/bin/sh\necho %s\n' "'{\"results\":[],\"errors\":[]}'" >"$T/base/semgrep" +printf '#!/bin/sh\necho %s\n' "'{\"Results\":[]}'" >"$T/base/trivy" +printf '#!/bin/sh\nexit 0\n' >"$T/base/gitleaks" +chmod +x "$T/base/semgrep" "$T/base/trivy" "$T/base/gitleaks" +for b in bash env git grep sed head tail cat rm mkdir mktemp dirname basename python3 perl timeout gtimeout jq true sort uniq paste tr cut wc awk date cp mv ls find touch tee readlink sleep; do + p=$(type -P "$b") || continue; ln -s "$p" "$T/sys/$b" +done +sarif() { printf '{"version":"2.1.0","runs":[{"results":[%s]}]}' "$1"; } +res() { printf '{"ruleId":"%s","message":{"text":"m"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"%s"},"region":{"startLine":%s}}}]}' "$1" "$2" "$3"; } +export J_pmd="$(sarif "$(res HardCodedCryptoKey src/A.java 3)")" +export J_sol="$(sarif "$(res avoid-tx-origin contracts/T.sol 4)")" +run() { PATH="$T/bin:$T/base:$T/sys" bash "$RC" --base base 2>"$T/err" >"$T/out"; } +row() { jq -e --arg t "$1" --arg f "$2" --arg r "$3" 'any(.[]; .tool==$t and .file==$f and .rule==$r)' "$T/out" >/dev/null; } +ran() { grep -qE "analyzers ran:.*\b$1\b" "$T/err"; } +notrun() { grep -q "not run: $1" "$T/err" && ! ran "$1"; } +: >"$HUB_LOG"; run +row pmd src/A.java HardCodedCryptoKey && ran pmd && ok "pmd: exit 4 with a row: row kept, ran" || bad "pmd rows: $(jq -c '[.[]|select(.tool=="pmd")]' "$T/out")" +row solhint contracts/T.sol avoid-tx-origin && ran solhint && ok "solhint: exit 1 with a row: row kept, ran" || bad "sol rows: $(jq -c '[.[]|select(.tool=="solhint")]' "$T/out")" +grep -q 'pmd check --no-cache --no-progress -R category/java/security.xml -f sarif -d ./src/A.java' "$HUB_LOG" && ! grep -q 'notes.txt' "$HUB_LOG" && ok "pmd argv: built-in security ruleset, one file" || bad "pmd argv: $(grep '^pmd' "$HUB_LOG")" +grep -q -- 'solhint --config .* -f sarif --noPoster --disc ./contracts/T.sol' "$HUB_LOG" && grep -q 'cfg: {"extends":"solhint:recommended"}' "$HUB_LOG" && ok "solhint argv: throwaway recommended config, sarif, no update check" || bad "sol argv: $(grep solhint "$HUB_LOG")" +# fail-open regressions: never clean +J_pmd= J_sol= run +notrun pmd && notrun solhint && ok "empty output: not run" || bad "empty" +J_pmd=$' \n' J_sol=$' \n' run +notrun pmd && notrun solhint && ok "whitespace-only output: not run" || bad "whitespace" +J_pmd='{"x":1}' J_sol='{"x":1}' run +notrun pmd && notrun solhint && ok "wrong-shape JSON: not run" || bad "wrong shape" +J_pmd='{"runs":[]}' J_sol='{"runs":[]}' run +notrun pmd && notrun solhint && ok "SARIF with no runs: not run" || bad "no runs" +HUB_MODE=crash run +notrun pmd && notrun solhint && ok "crash: not run" || bad "crash" +PMD_RC=4 SOL_RC=1 J_pmd="$(sarif "")" J_sol="$(sarif "")" run +notrun pmd && notrun solhint && ok "violation exit (4 / 1) with an empty results list: not run, not clean (fail-open guard)" || bad "rc-with-no-row" +PMD_RC=5 J_pmd="$(sarif "$(res HardCodedCryptoKey src/A.java 3)")" run +notrun pmd && ok "pmd: exit 5 (recoverable error) even with a row: not run" || bad "pmd exit5" +PMD_RC=1 J_pmd="$(sarif "")" run +notrun pmd && ok "pmd: exit 1 (exception): not run" || bad "pmd exit1" +SOL_RC=3 J_sol="$(sarif "$(res avoid-tx-origin contracts/T.sol 4)")" run +notrun solhint && ok "solhint: exit 3 (not 0/1): not run" || bad "sol exit3" +PMD_RC=0 SOL_RC=0 J_pmd="$(sarif "")" J_sol="$(sarif "")" run +ran pmd && ran solhint && ! grep -q 'not run: pmd\|not run: solhint' "$T/err" && ok "exit 0 and an empty results list: clean, ran" || bad "clean" +PMD_RC=4 J_pmd="$(sarif "{\"ruleId\":\"x\",\"message\":{\"text\":\"m\"}}")" run +notrun pmd && ok "pmd: a result with no location: not run, never dropped" || bad "no location" +# gates +cp "$T/keep/pmd" "$T/keep/solhint" "$T/bin/"; rm "$T/bin/pmd" "$T/bin/solhint"; run +grep -q 'NOT CHECKED: pmd (install: brew install pmd)' "$T/err" && grep -q 'NOT CHECKED: solhint (install: npm install -g solhint)' "$T/err" && jq -e 'any(.[]; .tool=="pmd" and .rule=="not-checked")' "$T/out" >/dev/null && ok "missing tools: NOT CHECKED with install hint" || bad "missing tools" +cp "$T/keep/pmd" "$T/keep/solhint" "$T/bin/" +git checkout -q -b other base; mkdir docs; printf 'x\n' >docs/a.md; printf '{"plugins":["evil"]}\n' >.solhint.json; G add . && G commit -q -m docs; : >"$HUB_LOG"; run +! grep -q '^pmd\|^solhint' "$HUB_LOG" && ok "no .java or .sol in the diff: neither tool runs (a project .solhint.json alone is never read)" || bad "unrouted" +[ "$fail" = 0 ] From 5e42969388196e6e540e785868f1a01b21ef9b5e Mon Sep 17 00:00:00 2001 From: Remi Antczak <140408771+remigiusz-antczak@users.noreply.github.com> Date: Fri, 13 Nov 2026 16:37:04 +0100 Subject: [PATCH 2/2] Tool hub: solhint canary, project-config test, no-row message test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review fixes for the pmd and solhint routes. solhint now scans a throwaway tx.origin contract first and is not run unless it raises avoid-tx-origin, since the unverified extends value could otherwise load no rules and read as clean. The project-config test now changes a .sol with a plugin-bearing .solhint.json and fails if the tool is run without our --config. The "exit N with no row" message is asserted for pmd and solhint. Each new test fails with its guard removed (canary block, --config, message branch). No PMD canary: a bad ruleset path exits non-zero, which is already not run. Tests: 59/59 (hub-pmd-solhint 21, hub-tf-ansible 21, tool-hub 17) size-budget-raise: .claude/skills/deep-code-review/references/tool-hub.md 56593→58057 hub rows for pmd and solhint Co-Authored-By: Claude Opus 5.5 --- .claude/skills/deep-code-review/INDEX.md | 2 +- .../deep-code-review/references/tool-hub.md | 2 +- .../deep-code-review/scripts/review_checks.sh | 5 +++++ SHA256SUMS | 6 +++--- changelog.d/hub-pmd-solhint.md | 2 +- scripts/size-budgets.tsv | 2 +- scripts/test-review-checks-hub-pmd-solhint.sh | 15 +++++++++++++-- 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.claude/skills/deep-code-review/INDEX.md b/.claude/skills/deep-code-review/INDEX.md index 9e51fadcb..d97661663 100644 --- a/.claude/skills/deep-code-review/INDEX.md +++ b/.claude/skills/deep-code-review/INDEX.md @@ -138,7 +138,7 @@ Generated by `scripts/skill_index.py` (do not hand-edit; rerun it after changing | `references/testing-ui.md` | the target renders a UI or ships browser / E2E specs. | 4868 | | `references/threat-modeling.md` | a change adds a trust boundary, an auth path, a data flow to a new party, an agent or tool capabili… | 2574 | | `references/time-date-correctness.md` | reviewing anything that stores, computes, schedules, or renders timestamps, durations, recurring ev… | 4809 | -| `references/tool-hub.md` | a review should lean on external scanners via the tool hub (workflows, Python, Go, SBOM/lockfiles,… | 14477 | +| `references/tool-hub.md` | a review should lean on external scanners via the tool hub (workflows, Python, Go, SBOM/lockfiles,… | 14514 | | `references/ux-components.md` | the target or diff renders one concept in more than one place: a shared component or design token,… | 7235 | | `references/ux-dataviz.md` | the target or diff renders a chart, sparkline, heat-map or calendar grid, a KPI / metric delta, a c… | 2787 | | `references/ux-gates.md` | a UI change is claimed verified on screenshot evidence, the project's auto-merge or CI policy gates… | 3756 | diff --git a/.claude/skills/deep-code-review/references/tool-hub.md b/.claude/skills/deep-code-review/references/tool-hub.md index f34c5522a..29e3eef33 100644 --- a/.claude/skills/deep-code-review/references/tool-hub.md +++ b/.claude/skills/deep-code-review/references/tool-hub.md @@ -68,7 +68,7 @@ The agent sandbox denies installs and most network, so the owner provisions scan | `tfsec` | Terraform `.tf` files, one directory per changed file (tfsec scans directories, not files): run from the file's directory, rows kept only for the changed file; no module download; wired only once installed. Upstream says engineering attention moves to Trivy, so this row is a stopgap | `tfsec . --format sarif --no-colour --soft-fail --no-module-downloads --exclude-downloaded-modules`; `--soft-fail` suppresses the error code, so any non-zero exit, empty output or a document without `runs[].results` is not run | verified for flags only (usage guide and README, fetched 2026-11-13: `--format` lists sarif, `--soft-fail`, `--no-module-downloads`, `--exclude-downloaded-modules`, exit status non-zero on findings). Not verified: the SARIF shape and uri form (stub-tested only; a mismatched path form drops rows, never reads as a finding), egress and license. Rows overlap `checkov` and `kics` | route-only | | `ansible-lint` | Ansible-looking YAML in a diff (a `roles/`, `tasks/`, `handlers/` or `playbooks/` path, or a file with `hosts:` and `tasks:` or `roles:`), changed files in one call; a changed `.ansible-lint` or `ansible.cfg` is `NOT CHECKED` (config is code); wired only once installed | `ansible-lint --offline --nocolor -q -f sarif FILES`; `--offline` disables requirements.yml installation and schema refresh. Exit codes are not documented (usage page), so a non-zero exit with no row is not run, never clean; a row for a file outside the changed list is also not run | verified for flags (usage page, fetched 2026-11-13: `--offline`, `-q`, `--nocolor`, `-f` choices include sarif). Not verified: exit codes, the SARIF shape, egress and license. The page contradicts itself on whether `-f json` is codeclimate or SARIF, so Perun passes `sarif` explicitly | route-only | | `pmd` | Java `.java` files in a diff, one file per run; wired only once installed | `pmd check --no-cache --no-progress -R category/java/security.xml -f sarif -d FILE`: only PMD's built-in security ruleset, never a project ruleset (it can name custom classes). Exit 4 = violations, 5 = recoverable error (not run), anything else with no row is not run, never clean | verified for flags `check`, `-d`, `-R`, `-f`, `--no-cache`, `--no-progress` and the exit-code table (CLI reference, fetched 2026-11-13). Not verified: that `sarif` is the format name (the page links to the formats page only), that `category/java/security.xml` ships in the distribution, the SARIF shape, egress and license | route-only | -| `solhint` | Solidity `.sol` files in a diff, one file per run; wired only once installed | `solhint --config TMPCFG -f sarif --noPoster --disc FILE` with a throwaway config of `solhint:recommended`: a project `.solhint.json` can load plugins (code) and is never read. A non-zero exit other than 1, or a non-zero exit with no row, is not run, never clean | verified for flags `-f` (formatters include sarif), `--config`, `--noPoster`, `--disc`, MIT license (README, fetched 2026-11-13). Not verified: exit codes, the SARIF shape, that `solhint:recommended` is a valid `extends` value, egress | route-only | +| `solhint` | Solidity `.sol` files in a diff, one file per run; wired only once installed | `solhint --config TMPCFG -f sarif --noPoster --disc FILE` with a throwaway config of `solhint:recommended`: a project `.solhint.json` can load plugins (code) and is never read. A canary scan of a throwaway tx.origin contract must raise avoid-tx-origin first, else not run (the unverified `extends` value could load no rules). A non-zero exit other than 1, or a non-zero exit with no row, is not run, never clean | verified for flags `-f` (formatters include sarif), `--config`, `--noPoster`, `--disc`, MIT license (README, fetched 2026-11-13). Not verified: exit codes, the SARIF shape, that `solhint:recommended` is a valid `extends` value, egress | route-only | | `bundler-audit` | Ruby lockfiles: a changed `Gemfile.lock`, one per run, against the local ruby-advisory-db only; rows on the lockfile for each unpatched gem and insecure source; with no local db (`BUNDLER_AUDIT_DB` or `~/.local/share/ruby-advisory-db`) it is NOT CHECKED, because the tool would download one; wired only once installed | `bundle-audit check DIR --gemfile-lock Gemfile.lock --format json`, no `--update`; exit 1 means vulnerable (`cli.rb`: `exit(1) if report.vulnerable?`) but also every error, so exit 0 must give no rows, exit 1 must give rows, and anything else, empty output or a wrong shape is not run | verified for flags, `Database.exists?` and default paths, JSON shape (`Report#to_h`, `UnpatchedGem#to_h`, `InsecureSource#to_h`) and license GPL-3.0-or-later (README and source, fetched 2026-11-13); the binary name `bundle-audit` is from the README, not from the gemspec. Egress: the check downloads a db only when none exists (guarded here); no other network code was read. Stub-tested only: no real report was run | route-only | | `cfn-lint` | CloudFormation templates: changed `.yaml .yml .json .template` files that name `AWSTemplateFormatVersion`, in one call; Error and Warning rows, Informational dropped; wired only once installed | `cfn-lint --format json -- FILES`; exit is a bitwise OR of 2 error, 4 warning, 8 informational (project docs), so 0, 2, 4, 6, 8, 10, 12 and 14 are runs and any other exit, empty output or a wrong shape is not run | verified for exit codes, `--format json` and license MIT-0 (repository page) and the JSON keys (`formatters/json.py`), fetched 2026-11-13. Egress: not audited, `unverified` (a spec download on a normal run was not ruled out). Stub-tested only | route-only | | `guarddog` | npm packages a changed `package-lock.json` newly adds (name@version absent from the merge-base lock; a bump counts) and that are installed under `node_modules` at the locked version (the installed `package.json` says so); `hasInstallScript` ones first, then at most 25 and about 300 s in all (`REVIEW_GUARDDOG_BUDGET`), the rest named in a `not-checked` row; not under `--full`; not a `hub=` row | `guarddog npm scan --output-format json DIR` on existing in-repo dirs only (it fetches a non-directory argument as a registry name), only when `guarddog --version` says 3.x; `--no-sandbox` (behind a dead proxy) only after its sandbox fails to start (nested); never `verify`; leads: `threat-*` rules only, each tagged `[heuristic]`; a rule that errors is a `not-checked` row and the other rules' hits stay; a newly added lock entry with `hasInstallScript` is a `package-lock` lead of its own | verified (`--help`, 3.2.0 source, real run 2026-10-30); the install-hook rules (`threat-npm-preinstall-script`, `threat-process-hooks`) match `*/package.json`, a nested one, so a package's own root `package.json` hook is never flagged | route-only | diff --git a/.claude/skills/deep-code-review/scripts/review_checks.sh b/.claude/skills/deep-code-review/scripts/review_checks.sh index 8b145ef15..4106ce9b1 100755 --- a/.claude/skills/deep-code-review/scripts/review_checks.sh +++ b/.claude/skills/deep-code-review/scripts/review_checks.sh @@ -1078,6 +1078,11 @@ while IFS=';' read -r hn hs hm hre _ hh; do fi continue fi + if [ "$hn" = solhint ]; then # canary: the config's `extends` value is unverified, so a config that loads no rules would read as clean; the throwaway tx.origin contract must raise avoid-tx-origin first + hubcmd solhint "$td/canary.sol"; printf 'pragma solidity ^0.8.0;\ncontract C { function f() public view returns (bool) { return tx.origin == msg.sender; } }\n' >"$td/canary.sol" + run_one solhint "${cmd[@]}" || continue + grep -qE '"ruleId"[[:space:]]*:[[:space:]]*"avoid-tx-origin"' "$out" || { skip solhint "canary: the throwaway config raised no avoid-tx-origin row, so its rules may not be loaded"; continue; } + fi if [ "$hn" = psalm ]; then hubcmd psalm; elif [ "$hm" = batch ]; then hubcmd "$hn" "${targets[@]}"; else hubcmd "$hn" "./$f" fi diff --git a/SHA256SUMS b/SHA256SUMS index c8ee16117..5ee845ff2 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -206,7 +206,7 @@ d98f3e4380da3496061ba63be7beebe75017ab4ee1734eda9a3e798e19007b0e .claude/skills 92d22cc5d0a60ba6bdb1f4a9b597823dec5b8412cec09a5be6cf93b3973f4226 .claude/skills/contribution/scripts/prefile_check.sh 18f20db537ab784460ad33cf218f7a01ac0a172fc38413f14c0e19e1ce6821cc .claude/skills/contribution/scripts/share_learning.py 8f0f9f0e2714befe6eb815489ed05c96cb3f0b7c3bfe964be1f2d04f1d914dca .claude/skills/deep-code-review/INDEX-scripts.md -0475a7e34f837095449ad7d1d0f086b993a85c81bdcdf3131f26484c14f5e97b .claude/skills/deep-code-review/INDEX.md +a75815dc92ed543faca15c2a3b3017a5e27cc3cc464e08bd419ba5b3539df732 .claude/skills/deep-code-review/INDEX.md c409fd76bcf137e160bf9bbe07ab54dba186db2857d07e47fed82e53fef877ad .claude/skills/deep-code-review/SKILL.md 1da2bea6a03e0da49cc3323745a49bc7b1085c61d9dc6afa9fcc06e890349131 .claude/skills/deep-code-review/VERSION f79acffb8481dcdd30278614ab18cc3895ddec4f65c60957a1b6f1b6ae28c6ae .claude/skills/deep-code-review/evals/evals.json @@ -343,7 +343,7 @@ a0ed7ad061b7e60230601ee9b38a00400841d6ddf3af386edbd4b34a981c9798 .claude/skills 8581f0023aedc9e0a4dece61cb2ea876ca9ab57f6acda63ed16c9b54494a1bc8 .claude/skills/deep-code-review/references/testing-ui.md 68df4819a34cbe23756eb19e9b513b9edcd675ad55da7d8c7624d95b124a9744 .claude/skills/deep-code-review/references/threat-modeling.md cf5218579b77d07ca49349165ab6d64c94b0145f61a4438cb09898a414793c68 .claude/skills/deep-code-review/references/time-date-correctness.md -fd5907b8cbb15736b2281d9fb3b57ab4c7e16f594853c04683beacc1acff9472 .claude/skills/deep-code-review/references/tool-hub.md +5c85f8a768571b26e93629d621e95f1da908239c57655f92dfcac1dcb8990531 .claude/skills/deep-code-review/references/tool-hub.md bfda9dd8f0d1718725e0fb8c2d6890f4fc2742c9a0d7993112ecf459a3af9f9c .claude/skills/deep-code-review/references/ux-components.md 5e69c5a0c0ab8d94079f2f08e026bc0e700369c76cd7dfeee6e5c7c5c2f020bb .claude/skills/deep-code-review/references/ux-dataviz.md 68c40fe7134afac5fae125f107726136a911c67c1d4abdf0e4c627aee6751713 .claude/skills/deep-code-review/references/ux-gates.md @@ -414,7 +414,7 @@ fc322d684cd388d211b34e6c896f4aea05e0fef451d984dd11edab2e7a2082bb .claude/skills 1a61b499457ec5739350f0d1cd1c506e787406fa11be2a1520977cdcc727748a .claude/skills/deep-code-review/scripts/provision_tools.sh e1d1d2eab715ef280b8c211a9da15ebe6b87969de89d7028d7f1cc82d64fc1f0 .claude/skills/deep-code-review/scripts/reaper_lint.py 7849fac82d7d6bb3f8e178ebf3149504feec70ea09c6ef8e21c8ce294c290b5d .claude/skills/deep-code-review/scripts/report_contract_lint.py -5179f6a23b1019a84b93cde6384a7777ccf1a4882eafd6d7ebfdfaba9dff7249 .claude/skills/deep-code-review/scripts/review_checks.sh +1d543ac76c32f79ae5a2adb371e5c17539c68bda8bcd196b567e19de44d08324 .claude/skills/deep-code-review/scripts/review_checks.sh 8c87c02a050a975e453b52ecacbaf01481c7134466a9c67feaf409d22e36d9f7 .claude/skills/deep-code-review/scripts/review_feedback.py fc5a897a11098726503bd003ec21a2c4fa873a11408c11490981ac1db5a0f382 .claude/skills/deep-code-review/scripts/route_auth_map.py 859c67d6a6a781c873f47d5662d403da2321da53e6994ca3d0ccdbf74afd39ac .claude/skills/deep-code-review/scripts/score_review.py diff --git a/changelog.d/hub-pmd-solhint.md b/changelog.d/hub-pmd-solhint.md index 4519e1d55..5a7c44e8a 100644 --- a/changelog.d/hub-pmd-solhint.md +++ b/changelog.d/hub-pmd-solhint.md @@ -1,3 +1,3 @@ ### Added - `review_checks.sh` tool hub routes `pmd` (Java, one file per run, PMD's built-in security ruleset only, SARIF) and `solhint` (Solidity, one file per run, a throwaway `solhint:recommended` config so a project `.solhint.json` that can load plugins is never read, SARIF). Both are `NOT CHECKED` when missing and `not run` on a crash, empty or wrong-shape output or a non-zero exit with no row; neither is in `provision_tools.sh`. Flags are from the fetched upstream docs; solhint exit codes, the SARIF shapes and the PMD `sarif` format name are marked unverified in `tool-hub.md`. -- size-budget-raise: .claude/skills/deep-code-review/references/tool-hub.md 56593→57908 hub rows for pmd and solhint +- size-budget-raise: .claude/skills/deep-code-review/references/tool-hub.md 56593→58057 hub rows for pmd and solhint diff --git a/scripts/size-budgets.tsv b/scripts/size-budgets.tsv index 67c7cea67..357f12c90 100644 --- a/scripts/size-budgets.tsv +++ b/scripts/size-budgets.tsv @@ -234,7 +234,7 @@ README.md 16118 .claude/skills/deep-code-review/references/small-diff-read-budget.md 526 .claude/skills/deep-code-review/references/app-pentest.md 8135 .claude/skills/deep-code-review/references/supply-chain-check.md 3646 -.claude/skills/deep-code-review/references/tool-hub.md 57908 +.claude/skills/deep-code-review/references/tool-hub.md 58057 .claude/skills/deep-code-review/references/desktop-native-appsec.md 4724 .claude/skills/deep-code-review/references/dynamic-probe.md 2095 .claude/skills/agentic-delivery/references/flow-guards.md 3171 diff --git a/scripts/test-review-checks-hub-pmd-solhint.sh b/scripts/test-review-checks-hub-pmd-solhint.sh index c81b41b34..74b5ba9ee 100755 --- a/scripts/test-review-checks-hub-pmd-solhint.sh +++ b/scripts/test-review-checks-hub-pmd-solhint.sh @@ -28,6 +28,10 @@ cat >"$T/bin/solhint" <<'S' echo "solhint $*" >>"$HUB_LOG" [ "${HUB_MODE:-}" != crash ] || exit 9 [ "$1" != --config ] || echo "cfg: $(cat "$2")" >>"$HUB_LOG" +# without --config the real tool would read the project's .solhint.json (plugins = code): the stub flags that as a finding +if [ "$1" != --config ] && [ -f .solhint.json ]; then printf '{"runs":[{"results":[{"ruleId":"plugin-loaded","message":{"text":"m"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"contracts/T.sol"},"region":{"startLine":1}}}]}]}]}'; exit 1; fi +# the canary scan (a throwaway contract in the review temp dir): a rule row, or none when the config loads no rules +case "${*: -1}" in */canary.sol) if [ "${CANARY:-ok}" = ok ]; then printf '{"runs":[{"results":[{"ruleId":"avoid-tx-origin","message":{"text":"m"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"canary.sol"},"region":{"startLine":2}}}]}]}]}'; else printf '{"runs":[{"results":[]}]}'; fi; exit 1 ;; esac printf '%s' "$J_sol" exit "${SOL_RC:-1}" S @@ -48,6 +52,7 @@ row() { jq -e --arg t "$1" --arg f "$2" --arg r "$3" 'any(.[]; .tool==$t and .fi ran() { grep -qE "analyzers ran:.*\b$1\b" "$T/err"; } notrun() { grep -q "not run: $1" "$T/err" && ! ran "$1"; } : >"$HUB_LOG"; run +grep -q 'solhint.*canary.sol' "$HUB_LOG" && ok "solhint: the canary contract is scanned before the changed file" || bad "no canary scan" row pmd src/A.java HardCodedCryptoKey && ran pmd && ok "pmd: exit 4 with a row: row kept, ran" || bad "pmd rows: $(jq -c '[.[]|select(.tool=="pmd")]' "$T/out")" row solhint contracts/T.sol avoid-tx-origin && ran solhint && ok "solhint: exit 1 with a row: row kept, ran" || bad "sol rows: $(jq -c '[.[]|select(.tool=="solhint")]' "$T/out")" grep -q 'pmd check --no-cache --no-progress -R category/java/security.xml -f sarif -d ./src/A.java' "$HUB_LOG" && ! grep -q 'notes.txt' "$HUB_LOG" && ok "pmd argv: built-in security ruleset, one file" || bad "pmd argv: $(grep '^pmd' "$HUB_LOG")" @@ -65,6 +70,12 @@ HUB_MODE=crash run notrun pmd && notrun solhint && ok "crash: not run" || bad "crash" PMD_RC=4 SOL_RC=1 J_pmd="$(sarif "")" J_sol="$(sarif "")" run notrun pmd && notrun solhint && ok "violation exit (4 / 1) with an empty results list: not run, not clean (fail-open guard)" || bad "rc-with-no-row" +CANARY=none run +notrun solhint && grep -q 'canary: the throwaway config raised no avoid-tx-origin row' "$T/err" && ! row solhint contracts/T.sol avoid-tx-origin && ok "solhint: canary raises no row (config loaded no rules): not run, not clean" || bad "canary none" +SOL_RC=1 J_sol="$(sarif "")" CANARY=none run +notrun solhint && ok "solhint: canary silent and an empty real scan: not run, never clean" || bad "canary empty" +PMD_RC=4 SOL_RC=1 J_pmd="$(sarif "")" J_sol="$(sarif "")" run +grep -q 'pmd.*exit 4 with no row' "$T/err" && grep -q 'solhint.*exit 1 with no row' "$T/err" && ok "the skip names the exit with no row" || bad "no-row message: $(grep 'not run' "$T/err")" PMD_RC=5 J_pmd="$(sarif "$(res HardCodedCryptoKey src/A.java 3)")" run notrun pmd && ok "pmd: exit 5 (recoverable error) even with a row: not run" || bad "pmd exit5" PMD_RC=1 J_pmd="$(sarif "")" run @@ -79,6 +90,6 @@ notrun pmd && ok "pmd: a result with no location: not run, never dropped" || bad cp "$T/keep/pmd" "$T/keep/solhint" "$T/bin/"; rm "$T/bin/pmd" "$T/bin/solhint"; run grep -q 'NOT CHECKED: pmd (install: brew install pmd)' "$T/err" && grep -q 'NOT CHECKED: solhint (install: npm install -g solhint)' "$T/err" && jq -e 'any(.[]; .tool=="pmd" and .rule=="not-checked")' "$T/out" >/dev/null && ok "missing tools: NOT CHECKED with install hint" || bad "missing tools" cp "$T/keep/pmd" "$T/keep/solhint" "$T/bin/" -git checkout -q -b other base; mkdir docs; printf 'x\n' >docs/a.md; printf '{"plugins":["evil"]}\n' >.solhint.json; G add . && G commit -q -m docs; : >"$HUB_LOG"; run -! grep -q '^pmd\|^solhint' "$HUB_LOG" && ok "no .java or .sol in the diff: neither tool runs (a project .solhint.json alone is never read)" || bad "unrouted" +git checkout -q -b other base; mkdir -p contracts; printf 'pragma solidity ^0.8.0;\ncontract Z {}\n' >contracts/T.sol; printf '{"plugins":["evil"]}\n' >.solhint.json; G add . && G commit -q -m sol; : >"$HUB_LOG"; run +grep -q '^solhint --config ' "$HUB_LOG" && ! grep -q '^solhint -f' "$HUB_LOG" && ! row solhint contracts/T.sol plugin-loaded && ! jq -e 'any(.[]; .rule=="plugin-loaded")' "$T/out" >/dev/null && ok "a .sol diff with a plugin-bearing project .solhint.json: our --config is always passed, the project config is not loaded" || bad "project config loaded: $(grep '^solhint' "$HUB_LOG")" [ "$fail" = 0 ]