Skip to content

refactor(core): align filesystem containment helper - #277

Merged
nicko-ai merged 3 commits into
devfrom
codex/core-filesystem-upstream-align
Jun 20, 2026
Merged

refactor(core): align filesystem containment helper#277
nicko-ai merged 3 commits into
devfrom
codex/core-filesystem-upstream-align

Conversation

@nicko-ai

@nicko-ai nicko-ai commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Issue for this PR

N/A - upstream-alignment cleanup for filesystem containment. Review found and fixed a Windows sibling-boundary bug in the helper.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Aligns the fork filesystem containment helpers around resolved path-boundary checks instead of broad string prefix checks.

This covers AppFileSystem.contains, Filesystem.contains, and overlap checks so parent/sibling escapes are rejected while valid child names beginning with two dots, such as ..config, still stay inside the parent. The latest update also rejects Windows root-relative sibling prefix collisions such as /project versus /project-other/file.

How did you verify your code works?

  • cd packages/core && bun test test/filesystem/filesystem.test.ts
  • cd packages/opencode && bun test --timeout 30000 test/file/path-traversal.test.ts
  • cd packages/core && bun run typecheck
  • cd packages/opencode && bun run typecheck
  • git diff --check
  • Local path.win32 simulation reproduced the old /project versus /project-other/file false positive and confirmed the new boundary predicate rejects it while preserving /project/..config children.
  • Pre-push hook: bun turbo typecheck

Screenshots / recordings

N/A - no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- use upstream separator-aware contains predicate shape

- cover boundary path containment cases
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Route overlap checks through the separator-aware containment helper in both core and opencode utilities.

Cover child names beginning with dot-dot plus sibling and parent boundary cases.
@nicko-ai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f10678ec9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/opencode/src/util/filesystem.ts Outdated
- compare resolved parent boundaries for contains checks

- cover Windows root-relative sibling collisions in core and opencode tests
@nicko-ai
nicko-ai merged commit b059cff into dev Jun 20, 2026
14 checks passed
@nicko-ai
nicko-ai deleted the codex/core-filesystem-upstream-align branch June 25, 2026 02:20
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.

1 participant