softwaremill / softwaremill/chimp
Security logic result is unavailable to tools forcing a second header read
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 102
- Forks
- 10
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 16
Description
Hello, I run an MCP server that proxies an internal HTTP API: every tool forwards the caller's bearer token upstream, so the token is both the gate and an input to each tool.
prependSecurity handles the gate well. But per docs/server/transport.md#security:
The result of the security logic does not reach the tool logic. If a tool needs data from the caller, read the request headers with handleWithHeaders (or serverLogic with headers).
So each tool re-reads the Authorization header and re-handles the missing-token case the gate already rejected (unreachable branch in every tool), and header parsing lives in two places that can drift apart.
Tapir's serverSecurityLogic covers this by deriving a typed principal once and handing it to the main logic. Do you think it would make sense to add an equivalent for Chimp, or is there a recommended pattern I've missed?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docs/server/transport.md#security and compare prependSecurity with the documented handleWithHeaders and serverLogic patterns. Determine how a typed result from security logic could reach tool logic without a second Authorization-header read. Done means the supported pattern or API is documented and the redundant missing-token handling is no longer required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- authentication, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100