fix(analyzer): cover indirect shell truthiness across Python execution surfaces - #497
Conversation
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Manual Review Needed at head c986c3e4da2e7f6cee623ca2eac298a61a99a107.
The current PR is too large and cross-cutting for a reliable approval in this review run: it adds 16,613 lines across 25 files, including new ~1,900-line Python dataflow and source-decoding implementations, and changes artifact classification, scan budgets/completeness, CLI/reporting behavior, and multiple analyzers. Green CI is not a substitute for a complete architectural and security review.
Please split the original shell-truthiness fix from (1) Python encoding/shebang and platform-command parsing, and (2) scan-budget/output/reporting changes, with each change independently documented and tested. No approval should be inferred from this comment. Observable CI is green, but the PR is currently BEHIND and an authorized full current-head review remains required before merge.
Summary
.py,.pyw, trusted extensionless Python shebangs, nested artifacts, and transitive scansshell=values while preserving conservative behavior for dynamic, ambiguous, or effectful codeenvlaunch forms that can execute the scanned artifact, including explicit-i,PYTHONINSPECT, bare-cpath execution, bare-m, GNU/Darwin option differences, and clear-environment orderingSupported contract
The AST companion follows bounded, source-ordered facts for direct
subprocessreceivers and imported callables. It handles straight-line assignments, safe protocol/finalizer cases, relevant function/class binding effects, and repeated trusted calls. Imports, arbitrary calls, mutation, rebinding, deletion, and other effects invalidate facts when safety cannot be proved.Python source eligibility is no longer extension-only. Definite Python sources are analyzed; definite non-Python sources stay out of the Python AST path; runtime-dependent sources are still analyzed conservatively but publish
python_source_ambiguousand incomplete status. Invalid source encodings similarly fail closed withpython_source_decode_error.Recursive aggregation now distinguishes work that was not scanned from scanned results omitted only for bounded output. Child failures remain fatal at ledger caps 1 and 2, aggregate risk survives record/serialization caps in every format, and machine-readable stdout is report-only.
Verification
Candidate:
c986c3e4da2e7f6cee623ca2eac298a61a99a107envexecution matrices: 25/25 each; native and Docker PTY, explicit-i,PYTHONINSPECT, and exact bare-c/-mexecution probes passedunaccounted_worktwine check, isolated Python 3.14 install, 82-package dependency check,compileall, and import/version checks passedgit diff --checkpassed; multiple independent review passes found no remaining actionable findingRemaining verification limits
--no-llm/use_llm=False.--env0-frombehavior.origin/maincontrol timed out identically (60.193s versus 60.178s for the branch), while all other MCP server tests, direct public MCP scans, and server construction passed. The exact-head GitHubtest-unitjob passed on its clean runner.Fixes #475