Skip to content

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

Merged
callumalpass merged 1 commit into
callumalpass:mainfrom
martin-forge:martin-forge/harden-oauth-callback-and-listener
Sep 13, 2026
Merged

callumalpass merged 1 commit 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

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.

This change generates and saves a strong token before starting the API/MCP listener, and rejects requests when no token is configured. It lets the OS allocate the OAuth port, registers the callback before opening the browser, accepts each pending callback once, and returns fixed HTML with restrictive headers. It follows the loopback protection in #1923.

Validation:

  • Focused API/CORS and OAuth callback tests pass (8 tests).
  • ESLint on changed sources and npm run build:test pass.
  • Reloaded the standalone build in a disposable Obsidian vault; no captured errors.

Rebased onto current main with the release-note conflict resolved. The implementation and regression tests are unchanged by the rebase.

@martin-forge
martin-forge force-pushed the martin-forge/harden-oauth-callback-and-listener branch from ab9bbd2 to 4ae127f Compare September 11, 2026 10:53
@callumalpass
callumalpass merged commit 139d0fe into callumalpass:main Sep 13, 2026
2 checks 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.

2 participants