Skip to content

fix(ci): the Kubescape guard accepts a scan handed to another interpreter #4164

Closed

Description

@devantler

🤖 Generated by the Agentic Engineer (interactive Claude Code session)

Found by Spike #3564.

Evidence

Four ways of handing a scan to another interpreter pass scripts/validate-kubescape-frameworks on main (35031dbb), and they also pass the parser-backed prototype the Spike chose. In each case bash runs an nsa-only scan beside the real ksail workload scan --framework nsa,mitre --compliance-threshold 95 line.

# Shape
1 bash <<'EOF' whose body is ksail workload scan --framework nsa
2 bash <<< 'ksail workload scan --framework nsa'
3 trap 'ksail workload scan --framework nsa' EXIT
4 xargs ksail <<< 'workload scan --framework nsa'

Each result was checked against bash with a stand-in ksail that records its arguments.

Audience and problem

Same gate as #3338: a reduced scan can overwrite the uploaded SARIF while the full invocation satisfies the guard. Neither the current reader nor the parser looks inside text that another command later runs as shell.

Direction

Once the guard is parser-backed (#3579), run the same analysis on text handed to bash/sh through a heredoc or here-string, on trap strings, and on input fed to xargs ksail. Where that text cannot be read, refuse it if it names a scan word, the rule bash -c strings already follow.

Acceptance criteria

  • All four shapes are refused, each by a test that fails today.
  • Controls stay accepted: bash <<'EOF' running echo hello, trap 'rm -f out.txt' EXIT, and the real workflows.
  • Every existing test passes unmodified.

Rough size: S.


Generated by Claude Code

Activity

  1. added theissue type on Sep 24, 2026
  2. moved this to 📥 Backlog in 🌊 Project Boardon Sep 26, 2026
  3. self-assigned this
    on Oct 3, 2026
  4. added 2 commits that reference this issue on Oct 3, 2026
  5. devantler commented on Oct 3, 2026

    @devantler
    ContributorAuthor

    🤖 Generated by the Agentic Engineer

    Delivered by merged PR #4431, reviewed source commit 06d951f.

    All four original interpreter-delegation shapes are refused by regressions and Bash recording witnesses. Ordinary interpreter heredocs, cleanup traps, and the real workflows remain accepted. The same bounded analysis supplies both admission paths, including delegated code and input whose behavior can be proved.

    Acceptance was checked against the original issue body. The original historical test file is unchanged. All 266 test/subtest assertions passed with race detection, including 28 Bash recording witnesses; source CI and protected merge-queue CI passed. Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions