Skip to content

test: feed traversal path to oot update and preclean CLI temp dirs - #63

Merged
kridaydave merged 1 commit into
mainfrom
fix/pr-38-test-traversal-and-tmpdir
Nov 8, 2026
Merged

kridaydave merged 1 commit into
mainfrom
fix/pr-38-test-traversal-and-tmpdir

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

Bugs

  • TST-02: path-traversal test never fed a ../ path to oot update; git probe optional.
  • TST-09: CLI tests never precleaned pid-based temp dirs.

What was wrong

  • tests/update_test.rs:390 test_update_rejects_path_traversal only recorded/updated a valid nested path; the sole hasDotdot assertions lived in if let Ok(...) around a git fsck probe, so Oot validation never ran and missing git skipped it silently.
  • tests/cli_test.rs:51 create_dir_all without prior remove_dir_all on pid-based temp dirs; stale files could poison a later run.

Fix

  • Rewrite the traversal test to hand-craft a tree with a ../escape.txt blob via git hash-object --literally, store a change record pointing at it, and assert oot update --change <id> --force fails naming the traversal path without writing outside the repo. Git is now required via expect, not skipped.
  • Add preclean remove_dir_all before create_dir_all at all 8 cli temp-dir sites.

Verification

CI green (fmt, clippy, tests, release build, adjudication) + rewritten test_update_rejects_path_traversal which exercises Oot validate_tree_path end-to-end (fails if validation is disabled or the file escapes).

@kridaydave kridaydave added the purging Batch purge: bug-fix swarm PRs label Nov 8, 2026
@kridaydave
kridaydave force-pushed the fix/pr-38-test-traversal-and-tmpdir branch from c23efac to 174e2aa Compare November 8, 2026 18:03
…p dirs

TST-02: test_update_rejects_path_traversal never passed a traversal path
to oot update (its hasDotdot probe was optional and asserted git's fsck,
not Oot). Rewrite it to hand-craft a tree with a ../escape.txt blob via
git hash-object --literally, record it, and assert oot update refuses it
without writing outside the repo. Git is now required (expect, not if let).

TST-09: cli_test temp dirs now preclean remove_dir_all before
create_dir_all, so a stale dir can't poison a run.
@kridaydave
kridaydave force-pushed the fix/pr-38-test-traversal-and-tmpdir branch from 174e2aa to 39ae93d Compare November 8, 2026 18:53
@kridaydave
kridaydave merged commit 6e016cf into main Nov 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

purging Batch purge: bug-fix swarm PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant