Skip to content

fix: require bearer token auth on /trigger endpoint#11

Merged
mcheemaa merged 1 commit intoghostwright:mainfrom
jeffklassen:fix/trigger-endpoint-auth
Mar 31, 2026
Merged

fix: require bearer token auth on /trigger endpoint#11
mcheemaa merged 1 commit intoghostwright:mainfrom
jeffklassen:fix/trigger-endpoint-auth

Conversation

@jeffklassen
Copy link
Copy Markdown
Contributor

@jeffklassen jeffklassen commented Mar 31, 2026

Summary

  • Adds bearer token authentication to the /trigger endpoint, reusing the existing AuthMiddleware from the MCP module
  • Requires operator scope (same as phantom_ask), returning 401 for missing/invalid tokens and 403 for insufficient scope
  • Adds 5 tests covering all auth scenarios (no header, invalid token, read-only, operator, admin)

Closes #9

Test plan

  • All 794 tests pass (789 existing + 5 new)
  • Typecheck clean (tsc --noEmit)
  • Lint clean (biome check)
  • Verify manually: curl -X POST http://localhost:3100/trigger -d '{"task":"test"}' -H 'Content-Type: application/json' returns 401
  • Verify manually: same request with valid operator bearer token returns 200

The /trigger endpoint accepted unauthenticated requests, allowing
anyone with network access to port 3100 to submit arbitrary tasks
and deliver responses to any Slack channel or user.

Reuse the existing MCP AuthMiddleware to require operator scope,
consistent with how /mcp and /webhook are protected.

Closes ghostwright#9
@mcheemaa mcheemaa self-requested a review March 31, 2026 12:35
Copy link
Copy Markdown
Member

@mcheemaa mcheemaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix, good test coverage. Thank you for catching this and putting together the PR. Merging now.

@mcheemaa mcheemaa merged commit 31379ac into ghostwright:main Mar 31, 2026
1 check 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.

Unauthenticated /trigger endpoint allows remote task injection

2 participants