Skip to content

Fix Sonar path-injection findings - #14

Merged
chrisknvidia merged 7 commits into
mainfrom
fix/christopherk/sonar-path-validation
Jul 15, 2026
Merged

chrisknvidia merged 7 commits into
mainfrom
fix/christopherk/sonar-path-validation

Conversation

@chrisknvidia

@chrisknvidia chrisknvidia commented Jul 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • create host-side bridge credential files from secure system file descriptors with private permissions and randomized names
  • make custom Dockerfile rebasing a pure content transformation, with file I/O retained at the two validated staging call sites
  • add regression coverage for generated tasks, native Harbor tasks, no-FROM content, and bridge credential uploads

Why

The first real Sonar analysis of main reported two pythonsecurity:S2083 findings:

  • src/skillevaluator/tier3/harbor/local_agents.py
  • src/skillevaluator/tier3/harbor/adapter.py

The changes narrow the path trust boundaries without changing remote credential filenames or staged Dockerfile behavior.

Verification

  • real internal Sonar analysis completed successfully
  • Sonar quality gate: OK
  • Sonar open issues after analysis: []
  • PR CI passed on Python 3.12 and Python 3.13
  • package build, metadata validation, wheel install smoke test, OSS boundary scan, macOS and Windows Tier 2, macOS Tier 3 contract, native Windows fail-closed, and Gitleaks passed
  • affected suites: 170 passed, 1 deselected
  • focused credential regression: 1 passed
  • local full suite reached 2,899 passed, 7 skipped, 3 deselected; its two isolated timing/state failures passed when rerun
  • Ruff check, Ruff format check, and git diff check passed
  • generated and native task outputs preserve custom Dockerfile layers while rebasing onto the configured eval image

The first Python 3.13 CI attempt hit the known timing-sensitive bridge worker assertion. Its complete job rerun passed.

@chrisknvidia
chrisknvidia merged commit 8e684f9 into main Jul 15, 2026
16 of 17 checks passed
@chrisknvidia
chrisknvidia deleted the fix/christopherk/sonar-path-validation branch August 1, 2026 03:01
chrisknvidia added a commit that referenced this pull request Oct 1, 2026
The Hermes launch regex could split each `--x` token two ways, so a long
run of flags backtracked exponentially (CodeQL py/redos alert #14). It ran
on every command before the launch, including Harbor's MCP heredoc, where
a plugin MCP URL is plugin text. 40 repeated flags hung the run inside
Harbor's event loop.

The Claude Code, Codex, and OpenCode patterns had the same scoping
problem: task MCP args with `claude --verbose` (or `codex exec`,
`opencode --model=`) took the one-shot setup and `--plugin-dir`, and the
real launch then ran without the plugin, silently.

Now each wrapper only rewrites Harbor's launch command: the launcher (the
text before ` -- `) must be one line, the pattern is anchored at a
shell-command boundary, and the flag tokens match one way only. Claude
Code also needs Harbor's `--print` launch shape. A run whose launch never
appears, or that shows a second launch, raises NativeLaunchError instead
of running the with-plugin arm without the plugin.

Tests run Harbor's real run() for all four agents with a recording fake
environment and hostile task MCP text, and time the CodeQL input shape
and a plugin MCP URL payload in a child process.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
(cherry picked from commit 685aaf54f4f1caa528937477e55a0a8e45ab4bf2)
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