Repository navigation
fix(tier3): flag destructive rm targets supplied by xargs - #231
Conversation
|
Implemented the symlink follow-up in #232, ready for review. Both graders now withhold cleanup exemptions for paths that may traverse an intermediate entry below the trusted #232 depends on #230 and #231; merge order is #230 → #231 → #232. Validation: 1,142 focused security tests passed on rerun, lint passed, and wheel/source-distribution builds passed. The initial timing-test threshold failure and full-suite limitations are documented in #232. |
chrisknvidia
left a comment
There was a problem hiding this comment.
Reviewed on top of #230. The xargs detection works, and host and Harbor agree on all the xargs cases I probed. ls /workspace | xargs rm -rf, ls /workspace | xargs -I{} rm -rf /tmp/{}, xargs option values and help forms all behave as described. tests/tier3 passes (5155 tests), and ruff check is clean.
One non-blocking point is inline: common /tmp cleanup through xargs now scores as critical. CI hasn't run on this head yet; the workflow runs are waiting on maintainer approval.
rng1995
left a comment
There was a problem hiding this comment.
Automated review: 1 findings (0 P1, 1 P2, 0 P3); 1 posted inline.
Reviewed at 9e9eb33. The finding was checked at bd08c50; 9e9eb33 only merges main and does not change checks.py, templates/eval.py or the tests. The CHANGELOG tradeoff that @chrisknvidia asked for is in bd08c50 and reads accurately. This branch does not contain #230's cbb196b, so the here-string fix and anything else that changes in #230 need to come in before this lands; a trial merge of the two heads is clean. The case-terminator and comment issues reported on #230 hit the shared operand loop here as well.
Carry forward the latest NVIDIA#230 and NVIDIA#231 fixes. Recognize interpreter stdin documents and pipelines, common shell startup options, pathlib symlink calls and literal subprocess argv. Preserve comment boundaries and apply link evidence in order for plain sequences while retaining conservative compound-command handling. Validation: 806 deletion/symlink regressions and 5,773 Tier 3 tests passed on Python 3.12 and 3.13. Both graders' 16 rm helpers match; Ruff, package builds and source/distribution OSS scans passed. The full suite reaches an unrelated AF_UNIX test blocked by this workspace's socket permissions. Signed-off-by: YMuskrat <[email protected]>
Reconcile PR NVIDIA#231 with the cleanup grading fixes already merged through NVIDIA#230 and NVIDIA#232. The merged tree exactly matches NVIDIA/main at 387213d, preserving both the xargs detection and symlink-evidence handling. Validation: 806 host/verifier deletion regressions, Ruff, wheel/sdist builds, and OSS source/distribution scans passed on Python 3.12. Signed-off-by: YMuskrat <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Reviewed all prior inline review threads, replies, review submissions, and Conversation comments, including the requested conflict resolution. Verified the bounded fallback retains operandless xargs rm detection after tokenizer/size/depth/token-budget bail-outs, and the CHANGELOG explicitly documents the scoped-cleanup tradeoff. These implementation changes and regressions are already present on main through the previously merged work; this PR now has an actually empty Git diff, rather than missing file metadata. The latest e5337f5 main merge is clean and preserves both histories. Validation: 941 focused host/bundled security tests passed; Ruff and whitespace checks passed. The latest main merge changed rubric evaluation and CI registration only; the reviewed security code and tests are byte-identical. Approval applies to e5337f5 as a redundant branch with no remaining code delta.
Summary
printf '%s\n' /workspace/data | xargs rm -rf /tmp/cachepreviously received a passing security score because the written deletion target was under/tmp.xargscan append targets from standard input, so that exemption does not establish that every deletion target is temporary.Both the host checker and standalone Harbor verifier now flag recognized destructive
rminvocations launched throughxargs, including invocations with no written target. The check understands common options, replacement forms, executable paths, and transparent wrappers. It distinguishes option values and help requests from the launched command, and preserves the cleanup exemption for a separate directrmcommand.Operandless
xargs rmdetection survives tokenizer failures and size/depth/token limits through a bounded fallback, including quoted executable spellings. Its bounded command span avoids unbounded backtracking on long repeated input.Input contents are not evaluated, so stdin-dependent launches are assessed conservatively. A fast prefilter keeps unrelated actions out of the additional parser while preserving quoted and escaped executable spellings.
Follow-up to the xargs review note on #230. Depends on #230: this branch contains its prerequisite commits and should merge afterward. The xargs-only diff is separate from those prerequisites.
The symlink follow-up is implemented in #232, which depends on this PR and #230. It preserves ordinary nested cleanup without link evidence; its remaining conservative policy tradeoff is documented there. Merge order: #230 → #231 → #232.
Verification
python -m ruff check src testspassedtests/embedding/test_catalog.py::TestCatalogPersistence::test_load_rejects_socket_catalogbecause this workspace rejectssocket.AF_UNIXcreation withPermissionError: [Errno 1] Operation not permitted. Full-suite success is not claimed.Release Impact
CHANGELOG.md