Repository navigation
fix(ci): forward the client Host through the dev-server proxy - #39
Closed
michielbdejong wants to merge 1 commit into
Closed
michielbdejong wants to merge 1 commit into
michielbdejong wants to merge 1 commit into
Conversation
The notion lane's live tier failed with "Authentication failed:
Unauthorized. Error checking authentication headers. Incorrect signature
for auth headers", on the very first authenticated request the installer
makes (`requireInstallationServer` -> `GET /did?subject=...`).
The cause is in this repo, in the proxy half of dev-server.mjs. It sent
every proxied request upstream with `host` rewritten to the upstream's
`host:port`. atomic-server derives the origin it answers a request under
from `Host` (server/src/context.rs::RequestContext::new; with
ATOMIC_DOMAIN=localhost every host is "served here", so the header wins
over the configured origin), and that origin is the message signed auth
headers are verified against (lib/src/authentication.rs, `message =
format!("{} {}", subject, timestamp)`). @tomic/lib signs the URL it is
about to fetch, which is built from the store's serverUrl — the
dev-server. So the client signed `http://localhost:19141/did?subject=...`
and atomic-server rebuilt `http://localhost:19140/did?subject=...`; the
ports differ, the signature does not verify, and every authenticated
request through the proxy is a 401.
Forwarding the header unchanged makes the proxy transparent: with
ATOMIC_SERVER_CHECKOUT=/tmp/atomic-server-pin the server now logs
`RequestContext { origin: "http://localhost:19141" }` and
`run-lane.mjs notion --tier live` passes 5 files / 21 tests, where it
previously failed 1.
Not a regression from the per-lane CI rework: it arrived with the
dev-server itself in 458f169, and no CI run since has reached the "Live
test: notion" step — every one failed at an earlier step — so it has
never been observed until the lane split let the notion lane run on its
own.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
michielbdejong
enabled auto-merge
September 22, 2026 13:29
Contributor
Author
|
This PR was merged into #38 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The failure
node integrations/tooling/run-lane.mjs notion --tier live— CI's "Lane: notion (live,e2e)" — fails inintegrations/notion/atomic.live.test.ts:It fails on the very first authenticated request the installer makes:
install()→requireInstallationServer(store, drive)→GET {serverUrl}/did?subject=….Root cause
In this repo, in
integrations/tooling/dev-server.mjs. The proxy half sent every request upstream with theHostheader rewritten to the upstream'shost:port:Two upstream facts make that fatal:
Host(server/src/context.rs::RequestContext::new). WithATOMIC_DOMAIN=localhost,host_is_served_herereturns true for every host, so the header wins over the configured origin.lib/src/authentication.rs::check_auth_signaturerecomputesmessage = format!("{} {}", subject, timestamp)from the server-side URL.@tomic/libsigns the URL it is about to fetch, built from the store'sserverUrl— the dev-server (browser/lib/src/client.ts,url = ${baseUrl}/did?subject=…thensignRequest(url, …)). So the client signshttp://localhost:19141/did?subject=…, the proxy hands atomic-server aHostoflocalhost:19140, the server rebuildshttp://localhost:19140/did?subject=…, the ports differ, and the Ed25519 check fails. Every authenticated request through the proxy is a 401 —/did,/commit,/plugin-secret, all of them.Evidence, with the stack up on the notion lane's ports:
ATOMIC_NOTION_TEST_SERVER=http://localhost:19141): the auth error above.…=http://localhost:19140, same running server, only the proxy bypassed): the auth error is gone entirely and the test runs on throughrequireInstallationServerand/plugin-secret.RequestContext { origin: "http://localhost:19141" }and the lane passes.Pre-existing, not a regression from the lane split
It arrived with the dev-server itself, in 458f169 ("host plugins over HTTP instead of embedding them in atomic-server"), which repointed the live tier from atomic-server directly (
:9883) to the proxy. It has never been observed because no CI run since has reached theLive test: notionstep — every run on that workflow failed at an earlier step, and the runs that went green had the whole integration job path-filtered out. #37's per-lane split is simply the first thing that let the notion lane get there.The fix
Forward
Hostunchanged, which is what a transparent proxy should do and what the file's own docstring promises ("a single URL behaves like one atomic-server that happens to host this repo's plugin catalog"). Plus a regression test indev-server.test.mjsasserting the upstream sees the client'sHost.Verification
node integrations/tooling/run-lane.mjs notion --tier live→Test Files 5 passed (5),Tests 21 passed (21),notion: live passed(was 1 file / 1 test failing).node --test integrations/tooling/dev-server.test.mjs→ 6/6.node integrations/tooling/certify.mjs --layer js→ passed.oxlintandoxfmt --checkoverintegrations→ clean (only the pre-existingno-consolewarnings).Not verified: the e2e tiers do not run to completion in this local environment (
pets --tier e2etimes out inpage.waitForURL). That failure is identical with and without this change — checked by running it onbbb995calone and onbbb995c+ this commit — so this is neutral for e2e, but CI is where e2e gets its real check.🤖 Generated with Claude Code