Skip to content

Tighten local mode directory allowlist and document local-only use - #1677

Open
tynianov1 wants to merge 1 commit into
Thinkmill:mainfrom
tynianov1:chore/local-mode-path-boundary
Open

tynianov1 wants to merge 1 commit into
Thinkmill:mainfrom
tynianov1:chore/local-mode-path-boundary

Conversation

@tynianov1

Copy link
Copy Markdown

The local mode API checks paths against the configured directories with a plain prefix match, so an allowed posts directory also matched posts-evil/x. This changes the check to an exact match or a match on a / boundary. Exact matches keep working for singleton data files like settings.yaml and collection templates.

The local mode docs now say that the local API has no authentication and is for local development only.

Maintainers could also consider limiting the local mode API to loopback requests or development, this PR does not do that.

Refs #1669

Testing: added packages/keystatic/src/api/api-node.test.ts for the sibling prefix case on blob and update. Ran vitest for the keystatic project, tsc, eslint and prettier.

An allowed directory such as posts no longer matches posts-evil/x.
Exact matches (used for singleton data files and templates) still
work. Also note in the local mode docs that the local API has no
authentication and is for local development only.
@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d1074af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@keystatic/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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