feat(mcp): add GHOST_URL_LOCK env var to lock the OAuth login form#4
Open
titouanmathis wants to merge 1 commit into
Open
feat(mcp): add GHOST_URL_LOCK env var to lock the OAuth login form#4titouanmathis wants to merge 1 commit into
titouanmathis wants to merge 1 commit into
Conversation
… a specific Ghost URL When GHOST_URL_LOCK is set: - The /authorize form pre-fills the Ghost site URL field with the locked value and marks it as readonly, so users only need to supply their Staff Access Token. - A lock notice (🔒) is shown explaining the server is restricted to a specific Ghost instance. - POST /authorize enforces the lock server-side: the submitted ghostUrl is silently replaced with the lock value, preventing bypass via crafted requests. - The startup log mentions the locked URL when the server starts in admin mode. Adds parseGhostUrlLock() to flags.ts following the same convention as the other flag helpers. Tests cover GET and POST /authorize in both locked and unlocked states. Closes #3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Implements #3.
When
GHOST_URL_LOCKis set, the OAuth/authorizelogin form:readonlyso the user cannot change it.The lock is also enforced server-side on
POST /authorize: ifGHOST_URL_LOCKis set, the submittedghostUrlis silently replaced with the env value, preventing bypass via crafted requests.Example
GHOST_URL_LOCK=https://conversion.ghost.io \ OAUTH_SECRET=$(openssl rand -hex 32) \ npx ghost-mcp-serverChanges
packages/mcp/src/flags.tsparseGhostUrlLock()packages/mcp/src/oauth.tsrenderLoginForm; enforce server-side on POSTpackages/mcp/src/server.tspackages/mcp/src/oauth.test.ts/authorizein locked/unlocked statespackages/mcp/README.mdGHOST_URL_LOCKin the env table and admin mode sectionCHANGELOG.mdTest plan
🤖 Generated with Claude Code