[Repo Assist] test: add regression test for findFiles parent-escape bug (PR #94)#111
Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
Draft
Conversation
Add a todo-marked test that demonstrates findFiles can escape above the
parent workspace root when 'directory' is a relative path (e.g. '..') that
resolves above parent, and a matching config file exists there.
The test is marked { todo: ... } so it fails with exit code 0 on master
(documenting the known bug) and will pass once PR #94 is merged.
This complements the existing boundary test (which uses '.', not '..') and
PR #76's outside-parent test (which uses an absolute path and a file that
does not exist, rather than a relative path and a file that does).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated draft PR from Repo Assist, an AI assistant.
Summary
Adds a regression test to
test/unit.test.jsthat documents a confirmed bug infindFiles: whendirectoryis a relative path that resolves aboveparent(e.g.".."), the function escapes the workspace root boundary and can return a config file that lives above the parent directory.The test is marked
{ todo: "Known bug — fixed by PR #94" }so it:npm run test:unitstill passes)What the test shows
The config file at
tmpRoot/relative-escape-sentinel.xmlis abovetmpRoot/ws-escape(the parent/workspace root), yet the current code finds it whendirectory = "..".How this differs from existing tests
"."(starts at parent)"/tmp"(absolute, outside)".."(relative, goes up)Test Status
npm run test:unitnode --check test/unit.test.jsRelates to: PR #94 (fix: prevent findFiles from escaping parent when directory is outside workspace)