Skip to content

test: add additional bypass parity coverage#3

Merged
steipete merged 1 commit intomainfrom
test/additional-bypass-parity
May 6, 2026
Merged

test: add additional bypass parity coverage#3
steipete merged 1 commit intomainfrom
test/additional-bypass-parity

Conversation

@jesse-merhi
Copy link
Copy Markdown
Member

Summary

  • add bypass parity tests for helper surfaces not covered by the first OpenClaw read/write PR
  • cover archive path validation/output staging, temp filename and temp file helpers, local file URL parsing, install path containment, directory walking, trash allowed-root checks, and JSON store adapter lock/update flow
  • assert traversal, absolute/archive path, Windows/UNC-looking path, encoded separator, symlink walk, trash outside-root, and no-outside-write behavior

Validation

  • pnpm test test/additional-bypass-parity.test.ts
  • pnpm check

Notes

This is test-only. No production changes were required by the additional bypass checks.

Copilot AI review requested due to automatic review settings May 6, 2026 00:01
@jesse-merhi jesse-merhi force-pushed the test/additional-bypass-parity branch from 3780b7f to 34e9a4f Compare May 6, 2026 00:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Vitest suite intended to extend bypass/parity coverage across several helper “surfaces” (archive path handling, temp helpers, local file URLs, install path containment, directory walking, trash root checks, and JSON store lock/update flow) without changing production code.

Changes:

  • Introduces additional-bypass-parity.test.ts covering a variety of traversal/escape payloads and “no outside write/read” assertions.
  • Adds new test cases for archive entry validation/output resolution/staging, temp file helpers, file URL parsing, install-path containment, directory walking symlink behavior, trash allowed-root enforcement, and JSON store update flow under locking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +54 to +58
for (const payload of ARCHIVE_ESCAPE_PAYLOADS) {
expect(() => validateArchiveEntryPath(payload), `validate ${payload}`).toThrow();
await expect(
prepareArchiveOutputPath({ destDir: layout.base, relativePath: payload, originalPath: payload }),
).rejects.toThrow();
it("sanitizes temp file names and keeps temp file helpers inside their created directory", async () => {
const layout = await makeTempLayout("fs-safe-temp");
expect(sanitizeTempFileName("../../evil.txt")).toBe("evil.txt");
expect(sanitizeTempFileName("..\\evil.txt")).toBe("..-evil.txt");
Comment on lines +131 to +134
expect(followed.entries.some((entry) => entry.path.startsWith(layout.outside))).toBe(false);

const syncFollowed = walkDirectorySync(layout.base, { symlinks: "follow", maxEntries: 20 });
expect(syncFollowed.entries.length).toBeLessThanOrEqual(20);
@jesse-merhi jesse-merhi force-pushed the test/additional-bypass-parity branch from 34e9a4f to 52e326d Compare May 6, 2026 00:09
@steipete steipete force-pushed the test/additional-bypass-parity branch from 52e326d to f68a681 Compare May 6, 2026 00:33
Copy link
Copy Markdown
Contributor

@steipete steipete left a comment

Choose a reason for hiding this comment

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

Reviewed against current main after the temp workspace surface cleanup. No blocking issues found; this is test-only bypass/parity coverage and local pnpm check is green.

@steipete steipete merged commit c70178e into main May 6, 2026
@steipete steipete deleted the test/additional-bypass-parity branch May 6, 2026 00:33
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