Skip to content

fix(review): a review's scanners leave out the rules that never gave a valid finding here - #2508

Merged
dan-petty merged 2 commits into
mainfrom
fix/1024-review-scanner-rule-exclusions
Oct 28, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/1024-review-scanner-rule-exclusions

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A review's kube-linter scan excludes dangling-service, and its Semgrep scan excludes python.lang.security.audit.non-literal-import.non-literal-import and python.lang.security.audit.exec-detected.exec-detected by rule id. In the labelled reviews of this repository, every finding of these rules was false:

  • dangling-service: 12 candidates in S3 to S5 and 17 labelled findings in S11 to S21. A review runs kube-linter on one manifest at a time, so kube-linter does not see the pods that a Service selects in a sibling file or a Helm release (fix(security): kube-linter findings carry their own check, message and manifest file, and scan reports keep each one #1045 measured that one run over all manifests still reports it for Helm-deployed pods).
  • non-literal-import: 21 candidates in S3 to S5 and 4 labelled findings in S11 to S21. The imported names came from literals, static maps or __getattr__.
  • exec-detected: 1 candidate in S5, a test that runs a documented snippet.

What changes:

  • The exclusions use each tool's own mechanism: kube-linter's checks.exclude in the config that a review hands it, and Semgrep's --exclude-rule flag. The repository holds only the rule ids, never registry rule text.
  • Each exclusion is an entry of a table beside its adapter, with its reason: _REVIEW_EXCLUDED_CHECKS in security/kubelinter.py and _REVIEW_EXCLUDED_RULES in security/semgrep.py. build_semgrep_cmd gets an exclude_rules parameter, and only a review's isolated scan of materialized targets passes it.
  • logger-credential-disclosure stays enabled, because one of its findings was valid (commands/config.py:514, the secrets-audit defect of fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022).
  • A scan outside a review, such as devops scan sast or devops k8s security-audit, runs every rule of its config.
  • CONST_REVIEW_SCAN_KUBELINTER_CONFIG leaves config/constants.py, because one module reads it. The dead non-literal-import suppression on telemetry/memory_profiler.py in .devops/review.toml is deleted, and docs/SELF_IMPROVEMENT.md names the two tables.
  • A replay test applies the exclusions that a review's scans are handed to the labelled S3 to S5 candidates (a new trimmed fixture, each label citing its section of the S5 evaluation) and to the S11 to S21 labels of feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138. It drops no valid finding.
  • The Semgrep run of the adapter contract suite is recorded again with the real Semgrep 1.179.0 and the new command.

Closes #1024

Change: openspec/changes/archive/2026-10-28-1024-review-scanner-rule-exclusions/

…a valid finding here

A review's kube-linter scan excludes `dangling-service`, and its Semgrep
scan excludes `non-literal-import` and `exec-detected` by rule id. In the
labelled reviews of this repository (S3 to S5 and S11 to S21) every
finding of these rules was false. A review runs kube-linter on one
manifest at a time, so kube-linter does not see the pods that a Service
selects in a sibling file or a Helm release.

Each exclusion is an entry of a table beside its adapter, with its
reason. `logger-credential-disclosure` stays, because one of its findings
was valid. A scan outside a review runs every rule. The dead
`non-literal-import` suppression in `.devops/review.toml` is deleted, and
the Semgrep run of the adapter contract suite is recorded again.
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence:

  • uv run devops ci fail-to-pass --base origin/main: 7 failed on base and pass on the branch:
    • the 4 new tests in tests/security/test_review_rule_exclusions.py but test_a_semgrep_scan_outside_a_review_leaves_out_no_rule, which passed on base, because it holds the scope;
    • the 3 review command tests in tests/test_security_semgrep.py;
    • test_review_scanners_are_handed_devops_owned_config_and_ignore_files in tests/test_review_untrusted_tree.py.
  • The full uv run devops ci passed every gate before the rebase. The test gate took 5m 39s on a loaded host, over the 5-minute budget; perf(ci): the startup-import tests start 56 interpreters and take 204 s of the suite's 2,423 s #2369, perf(ci): each test shard collects only its own test files #2371 and perf(ci): measure coverage and branch cost #2373 cover the speed of the suite.
  • After the rebase onto 0137f23: the 110 tests of the scanner, isolation and contract files pass.
  • The new tests take 0.01 to 0.03 s each, offline, through the scanner fake.
  • Real tools (2026-10-28): kube-linter 0.8.3 on k8s/llm/profiles/services.yaml gave 16 dangling-service with checks: {} and 0 with the review config. A review's isolated Semgrep 1.179.0 scan of a file with an exec, an import of a variable name and a logged password reported the three rules before the change, and only logger-credential-disclosure after it.

Pending a person:

@dan-petty
dan-petty marked this pull request as ready for review October 28, 2026 19:18
@dan-petty
dan-petty merged commit fe953ac into main Oct 28, 2026
18 checks passed
@dan-petty
dan-petty deleted the fix/1024-review-scanner-rule-exclusions branch October 28, 2026 19:39
dan-petty pushed a commit that referenced this pull request Oct 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.11.0](v0.10.1...v0.11.0)
(2026-10-28)


### Features

* **monitoring:** the roadmap Service's identity refusals, failing and
stalled jobs, restarts, and GitHub and model request volume raise alerts
([#2496](#2496))
([0137f23](0137f23)),
closes [#2472](#2472)
* **service:** roadmap-service runs at one replica, and each model call
in the cluster is sent at most two times
([#2500](#2500))
([2d32dae](2d32dae)),
closes [#2494](#2494)


### Bug Fixes

* **cli:** every command reports a DevOpsCLIError through one exit seam
([#2502](#2502))
([eadd55f](eadd55f)),
closes [#2487](#2487)
* **github:** pr monitor waits until the checks settle and names every
blocker, and pr ready reads the merge-readiness verdict
([#2498](#2498))
([43326ea](43326ea))
* **k8s:** a pod that does not call the Kubernetes API mounts no service
account token
([#2522](#2522))
([305d3ba](305d3ba))
* **k8s:** the cloudflared tunnel replicas prefer different nodes and
keep one up through a drain
([#2499](#2499))
([d4edaf6](d4edaf6)),
closes [#1023](#1023)
* **k8s:** the grafana, prometheus, argo cd and loki clients dial
through the egress-checked factory, and their pre-flight address checks
go ([#2497](#2497))
([e7ca1d5](e7ca1d5))
* **monitoring:** the roadmap Service alerts count a series that starts
in the hour, and a lane of a new pod can stall
([#2514](#2514))
([c7692b2](c7692b2)),
closes [#2505](#2505)
* **review:** a review's scanners leave out the rules that never gave a
valid finding here
([#2508](#2508))
([fe953ac](fe953ac))
* **roadmap:** a refine round leaves an outside account issue to a
person, and refine neutralizes comment openers, www links and
cross-repository references
([#2507](#2507))
([e6230dc](e6230dc)),
closes [#2478](#2478)
* **sandbox:** the metrics scrape and the whitelist NetworkPolicy
resolve each host one time, through the egress check
([#2521](#2521))
([7c01426](7c01426))
* **security:** the subprocess environment guard refuses the zsh and
interpreter keys that make a child run code
([#2510](#2510))
([459621a](459621a))
* **service:** a restart keeps the halt, the budget window and the
failure ledger, and a rate limit or a suspended installation stops every
worker ([#2515](#2515))
([3630de1](3630de1)),
closes [#2474](#2474)


### Code Refactoring

* **config:** settings resolve in one declared order through
pydantic-settings sources
([#2518](#2518))
([6a5447a](6a5447a)),
closes [#2445](#2445)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(review): the review's scanner config drops the rules that never produced a valid finding on this repository

1 participant