Skip to content

Send no Authorization header to the LLM when api_key is unset (#420) - #428

Merged
cboettig merged 2 commits into
mainfrom
fix/420-auth-header
Nov 3, 2026
Merged

cboettig merged 2 commits into
mainfrom
fix/420-auth-header

Conversation

@cboettig

@cboettig cboettig commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Closes #420.

The agent and the transcriber sent Authorization: Bearer … on every LLM request, even with no key (the transcriber sent Bearer EMPTY). A header set by the page replaces the browser's saved basic-auth credentials, so a deployment behind nginx auth_basic that proxies /api/llm/ got 401 on every request (boettiger-lab/bosl-high-seas#85).

Both now send the header only when api_key is a non-blank string. The rule is in a new app/llm-auth.js, used by agent.js and transcriber.js. The deployment guide says to leave api_key out when a same-origin proxy injects the real key.

Apps that set a key are unchanged. The one visible change is that the transcriber no longer sends Bearer EMPTY when no key is set.

Tests: test/llm-auth.test.js. The transcriber test that asserted the EMPTY fallback now asserts that no header is sent.

A header set by the page replaces the browser's saved basic-auth
credentials, so a deployment behind nginx auth_basic that proxies
/api/llm/ got 401 on every request. The agent and the transcriber now
send Authorization only when api_key is a non-blank string.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 72.11% 9834 / 13637
🔵 Statements 72.09% 9836 / 13643
🔵 Functions 76.5% 368 / 481
🔵 Branches 84.81% 2373 / 2798
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
app/agent.js 96.97% 87.73% 91.83% 96.97% 97-99, 116-117, 142, 277-279, 286-287, 301-305, 382-387, 397-398, 466-467, 935-936, 1007-1008, 1183-1185
app/llm-auth.js 100% 100% 100% 100%
app/transcriber.js 100% 100% 100% 100%
Generated in workflow #328 for commit 20963e0 by the Vitest Coverage Report Action

@cboettig
cboettig merged commit 0885396 into main Nov 3, 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.

LLM requests always send an Authorization header, which breaks basic-auth deployments

1 participant