Skip to content

fix(tier3): flag destructive rm targets supplied by xargs - #231

Merged
rng1995 merged 6 commits into
NVIDIA:mainfrom
YMuskrat:fix/tier3-xargs-cleanup-grading
Oct 29, 2026
Merged

rng1995 merged 6 commits into
NVIDIA:mainfrom
YMuskrat:fix/tier3-xargs-cleanup-grading

Conversation

@YMuskrat

@YMuskrat YMuskrat commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

printf '%s\n' /workspace/data | xargs rm -rf /tmp/cache previously received a passing security score because the written deletion target was under /tmp. xargs can 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 rm invocations launched through xargs, 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 direct rm command.

Operandless xargs rm detection 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

  • Familiar with the contributing guidelines
  • 424 host/verifier deletion/xargs regression cases passed on Python 3.12 and 3.13
  • 5,391 Tier 3 tests passed on Python 3.12
  • OSS source scan passed
  • python -m ruff check src tests passed
  • Wheel and source-distribution builds passed
  • Deletion regressions inspect command strings without executing deletion commands
  • Full default-suite pass: on the combined branch it stopped at tests/embedding/test_catalog.py::TestCatalogPersistence::test_load_rejects_socket_catalog because this workspace rejects socket.AF_UNIX creation with PermissionError: [Errno 1] Operation not permitted. Full-suite success is not claimed.
  • Latest GitHub workflows await maintainer approval
  • No credentials, private datasets, or proprietary benchmark content added

Release Impact

  • Updated CHANGELOG.md

@YMuskrat

Copy link
Copy Markdown
Contributor Author

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 /tmp root. This intentionally also flags legitimate nested cleanup and child operands with trailing slashes; the policy tradeoff is explicit in the PR and changelog.

#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 chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@YMuskrat
YMuskrat requested a review from chrisknvidia October 27, 2026 09:47

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

YMuskrat added a commit to YMuskrat/SkillEvaluator that referenced this pull request Oct 28, 2026
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]>
@YMuskrat
YMuskrat requested a review from rng1995 October 28, 2026 07:34
@rng1995

rng1995 commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

@YMuskrat - Please resolve merge conflicts. These conflicts have arisen due to merging of your other MRs: #232 and #230. Once conflicts have been addressed, we can merge the PR. Thanks for your contribution!

YMuskrat and others added 3 commits October 28, 2026 20:29
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
rng1995 enabled auto-merge October 29, 2026 21:12
@rng1995
rng1995 disabled auto-merge October 29, 2026 21:20
@rng1995
rng1995 enabled auto-merge October 29, 2026 21:20

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rng1995
rng1995 merged commit 0c3e55c into NVIDIA:main Oct 29, 2026
17 checks passed
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.

3 participants