Skip to content

Fix data-root path boundary checks#11

Open
bittoby wants to merge 1 commit into
aglover1221:mainfrom
bittoby:fix/path-boundary-guards
Open

Fix data-root path boundary checks#11
bittoby wants to merge 1 commit into
aglover1221:mainfrom
bittoby:fix/path-boundary-guards

Conversation

@bittoby
Copy link
Copy Markdown
Contributor

@bittoby bittoby commented May 21, 2026

Summary

Fixes data-root path boundary checks so sibling directories with the same string prefix as PRODUCT_MCP_DATA_DIR are not treated as inside the data root.

What Changed

  • Added a shared isPathInsideRoot() helper using path.relative().
  • Replaced unsafe startsWith(REPO_ROOT/DATA_DIR) checks in source, extraction, audit, and schema-generation path resolution.
  • Added tests for sibling-prefix escapes and valid in-root paths.

Validation

  • npm test
  • npm run build

Fixes #10

@bittoby bittoby closed this May 21, 2026
@bittoby bittoby force-pushed the fix/path-boundary-guards branch from ca79db3 to 4b40ef3 Compare May 21, 2026 17:07
@bittoby bittoby reopened this May 21, 2026
@bittoby bittoby force-pushed the fix/path-boundary-guards branch from 44a80d2 to d8a81f9 Compare May 21, 2026 17:14
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.

Fix data-root path boundary checks

1 participant