Skip to content

security: harden loopback OAuth callback and require token for API listeners - #2292

Open
martin-forge wants to merge 2 commits into
callumalpass:mainfrom
martin-forge:martin-forge/harden-oauth-callback-and-listener
Open

security: harden loopback OAuth callback and require token for API listeners#2292
martin-forge wants to merge 2 commits into
callumalpass:mainfrom
martin-forge:martin-forge/harden-oauth-callback-and-listener

Conversation

@martin-forge

@martin-forge martin-forge commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Problem

An empty API token currently permits unauthenticated requests. The OAuth callback also searches for a free port before binding it and inserts callback error text into its HTML response.

Solution

Generate and save a strong token before starting the API/MCP listener, and reject requests when no token is configured. Let the OS allocate the OAuth port, register the callback before opening the browser, accept each pending callback once, and return fixed HTML with restrictive headers. Follow-up to the loopback protection in #1923.

Testing

  • Focused API/CORS, OAuth callback, credential storage and revocation tests pass.
  • npm run lint and npm run build:test pass.
  • Reloaded the standalone build in a disposable Obsidian vault; no captured errors.
  • GitHub CI: full test suite and build passed.

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