Skip to content

fix(security): kube-linter findings carry their own check, message and manifest file, and scan reports keep each one (#1045) - #1471

Merged
dan-petty merged 1 commit into
release/v0.2.30from
fix/1045-kube-linter-finding-identity
Oct 9, 2026
Merged

dan-petty merged 1 commit into
release/v0.2.30from
fix/1045-kube-linter-finding-identity

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

kube-linter puts Check and Remediation next to Diagnostic, but the adapter read the check from inside Diagnostic. Because of that, every kube-linter finding since v0.1.8 had the title [kube-linter-check] K8s Security Lint Warning, and a directory scan located every finding at the directory itself. Every finding of a scan got the same fingerprint, so devops scan report kept 1 of the 7 reports over k8s/ at da50329, and a review merged different checks on one object into one candidate.

  • Adapter (security/kubelinter.py):
    • The title is [<check>] <message>, so the check becomes the rule id and the SARIF ruleId.
    • The fix is kube-linter's Remediation, or the template when there is none.
    • The location is <manifest from Object.Metadata.FilePath>:<Kind>/<namespace>/<name>, or <Kind>/<name> when there is no namespace. No default namespace is guessed.
    • The category is the class named by the check or the message; when neither names one, it is security_misconfiguration.
  • Identity (security/normalization.py):
    • The fingerprint includes the symbol when there is one. A finding without a symbol keeps its old fingerprint (pinned in a test).
    • correlation_key includes the symbol.
    • split_location reads path:start-end and :<line> as lines, so those never become symbols.
  • Display:
    • format_k8s_lint_table escapes its location, title and fix cells. Before, Rich read [no-anti-affinity] as a markup tag and dropped it, so devops k8s lint never named the check.
    • In devops scan report --json, each cluster entry carries its symbol, so two objects with one message are no longer identical entries.
  • Re-scope (issue update of 2026-10-09):

Tests

  • New fixture tests/fixtures/kubelinter/k8s-da50329.json: the 7 reports from kube-linter lint k8s --format json (4 checks, 3 files), trimmed, with FilePath made relative.
  • tests/test_security_kubelinter.py:
    • Each finding's title, location, category and fix.
    • build_report keeps 7 findings in 7 clusters with 7 distinct JSON entries, under 4 rule ids, and to_sarif declares 4 rules.
    • The review consolidation keeps all 7.
  • tests/test_security_sarif.py:
    • The fingerprint with and without a symbol, and a pinned fingerprint for a finding without one.
    • Line ranges.
    • Two Popeye issues on two resources are both kept.
    • Findings on different objects form separate clusters.
  • tests/test_output.py: the kube-linter table renders [no-anti-affinity].
  • tests/test_secops.py and tests/test_consolidation_security_scanner_base.py use the real report shape, and the contract test checks for no-read-only-root-fs.
  • Every new test failed on the base code. The tests run offline and call no kube-linter binary.

To check by hand

  • devops k8s lint k8s/cloudflared/deployment.yaml names no-anti-affinity.
  • devops scan report k8s --scanner kubelinter lists one row per report under its own check:
    • 7 rows under 4 rule ids at da50329;
    • 6 under 4 on the current tree, because the pyroscope alias is gone.

Notes

  • Every finding located by an object name (Trivy, Pluto, Popeye, Dive, kube-linter) gets a new fingerprint and SARIF partialFingerprints value once. A fingerprint suppression of one of these must be recorded again, and a suppression by rule kube-linter-check must now name the check. The project is pre-1.0, so changelog.d/1045.md records this and no migration is added.
  • CONST_SARIF_FINGERPRINT_KEY stays devopsCli/v1 because test(security): pin the finding fingerprint and run-store digest to literal values #855 has not landed.

Closes #1045

…d manifest file, and scan reports keep each one (#1045)
@dan-petty
dan-petty merged commit c58079f into release/v0.2.30 Oct 9, 2026
8 checks passed
@dan-petty
dan-petty deleted the fix/1045-kube-linter-finding-identity branch October 9, 2026 04:41
dan-petty added a commit that referenced this pull request Oct 9, 2026
* chore(review): suppress the logger-credential rule on vault_lease.py's token-path warning (#1456)

* docs(service): subscribe each webhook to issues, pull_request, milestone and release only (#1457)

Step 8 of the roadmap Service setup and AGENTS.md listed Issues, Pull requests
and Milestones (AGENTS.md also push). The Service treats release published as a
reprioritize hint, and every other event only starts extra rounds (#1386).
The 8 live hooks were switched to these four events on 2026-10-09.

* fix(docs): the docs check validates the options inside optional-group brackets such as [-v <ver>] (#1299) (#1458)

* fix(mcp): fastmcp's debug log of tool calls never records argument values (#899) (#1459)

FastMCP logs every tools/call and prompts/get with its arguments at DEBUG on fastmcp.server.mixins.mcp_operations, so FASTMCP_LOG_LEVEL=DEBUG wrote a vault_set call's key_values to stderr. ArgumentValueLogFilter on that logger replaces each mapping argument with <redacted>, keeping the record and the tool or prompt name; the whole mapping goes, since an undeclared parameter's name is the caller's own text. #862's RejectedInputLogFilter on fastmcp.server.server is removed: since fastmcp 4.0.11 FastMCP logs a refusal's error count and types, never the input, so it matched nothing. The fastmcp_log fixture now captures every FastMCP logger at DEBUG.

* fix(security): a sandbox workspace never holds the user's ssh agent or X11 socket (#1384) (#1463)

* feat(telemetry): sandbox egress port scoping, collector lane & in-container trace context (#702) (#1465)

* refactor(ci): one nesting metric module shared by the pre-commit hook and the scanner (#773) (#1466)

devops_cli.core.code_metrics is now the one copy of the nesting and
complexity metric. It is stdlib only and imports nothing from devops_cli.
The structural-invariants hook runs it with --max-depth 5 and loads no
scanner and no pydantic-ai. devops scan complexity, MCP scan_complexity,
the inspection hotspots and devops ai spec read it too.

- Nesting counts the function body as depth 1, as CI already did, so
  5 nested blocks now fail at commit. The six test functions that sat at
  depth 6 are flattened.
- Complexity is Ruff C901's McCabe count. It equals ruff on all 18,000
  functions in src/ and tests/, and flags the same 54 functions in src/
  at a cap of 10.
- One whole-tree test, test_the_source_tree_keeps_its_structural_invariants,
  parses src/ once through _parse_src().
- The parity test and the hook's subprocess spawns are gone.

Removed: devops_cli.security.structural_invariants, analyze_file_complexity
and FileComplexityReport.

* fix(ai): a web_fetch budget cut inside a code block closes the fence before the truncation note and boundary tag (#1298) (#1462)

* feat(review): review tools install from a tools lock with exact versions, binary checksums and hashed Python requirements, and every review records them (#1142) (#1467)

* fix(security): mask_secrets masks every GitHub token prefix, ghu_, ghs_ and ghr_ included (#1398) (#1464)

* fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean (#1022) (#1461)

* fix(cli): `devops branches create` creates the branch instead of failing on `checkout -b --` (#900) (#1460)

* fix(security): kube-linter findings carry their own check, message and manifest file, and scan reports keep each one (#1045) (#1471)

* feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines (#1138) (#1472)

* feat(release): v0.2.30

---------

Co-authored-by: Daniel Petty <[email protected]>
Co-authored-by: dan-petty-bot <[email protected]>
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.

1 participant