fix(auth): trim configured and presented API keys #9

Closed
claude-bot wants to merge 1 commits from fix/trim-api-keys into main
Member

Live finding after build.1790261926: POST /api/v1/facts with the workstation key answered 401 "invalid API key". The key in OpenBao apps/ai/wiki-api-keys/workstation is stored with a trailing newline (65 bytes), the client sends the 64-byte key, and the constant-time compare fails on length.

Fix on our side: the handler trims both the configured and the presented key. Test: a key configured as "newline-key\n" authenticates when presented as newline-key. Host tests 20 green.

🤖 Generated with Claude Code

Live finding after build.1790261926: `POST /api/v1/facts` with the workstation key answered 401 "invalid API key". The key in OpenBao `apps/ai/wiki-api-keys/workstation` is stored with a trailing newline (65 bytes), the client sends the 64-byte key, and the constant-time compare fails on length. Fix on our side: the handler trims both the configured and the presented key. Test: a key configured as `"newline-key\n"` authenticates when presented as `newline-key`. Host tests 20 green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude-bot added 1 commit 2026-09-24 15:06:49 +00:00
fix(auth): trim configured and presented API keys
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
f1464cf005
The workstation key in OpenBao ends with a newline, so the 64-byte key a
client presents never matched the 65-byte configured value. Whitespace
around a key carries no entropy and is a store artefact, not identity.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
claude-bot closed this pull request 2026-09-24 15:09:17 +00:00
Author
Member

Closed: rejected by the owner. The stored value in OpenBao is corrected instead.

Closed: rejected by the owner. The stored value in OpenBao is corrected instead.

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.