Skip to content

fix(auth): serve /brain.html + /brain.js without server auth - #39

Closed
jack-champagne wants to merge 1 commit into
local/amicodefrom
fix/brain-graph-auth
Closed

jack-champagne wants to merge 1 commit into
local/amicodefrom
fix/brain-graph-auth

Conversation

@jack-champagne

Copy link
Copy Markdown
Member

What

The amico brain graph loads /brain.html (+ /brain.js) in an iframe. Like /assets/* and /amicode/widget-frame, an iframe document/sub-resource cannot carry ?auth_token= — so with OPENCODE_SERVER_PASSWORD set (always, under the amicode extension) both /brain.html and /brain.js returned 401, the frame failed to load, and the browser painted the transparent iframe opaque white. That's the "white box instead of the thinking graph."

They're the same public-shell class as the existing exemptions (static renderer, no secrets; session touches arrive via the postMessage bridge) — they were simply missed when c76749add (/assets/*) and ca69ef0c1 (widget-frame) added the auth bypass. Regression since the ?auth_token= auth refactor between amicode.5 and amicode.7.

Change

Add /brain.html + /brain.js to PUBLIC_UI_PATHS (server/shared/public-ui.ts), sibling to the widget-frame exemption. GET-only; the API surface (e.g. /amicode/vaults, /amicode/widgets) stays authed.

Test / verify

  • bun test test/server/httpapi-ui.test.ts → 15 pass (new: brain frame + script served without auth; POST still 401).
  • Built locally, server password set: /brain.html+/brain.js → 200 without auth (were 401); /amicode/vaults still 401. Browser: the thinking graph renders again (was white).

Why separate

Orthogonal to the vault onboarding work (opencode#35 / amicode#183); it unblocks any amicode.7+ release regardless of those.

🤖 Generated with Claude Code

The amico brain graph loads /brain.html (+ /brain.js) in an iframe that can't
carry ?auth_token=; with OPENCODE_SERVER_PASSWORD set (always, under the
amicode extension) both 401'd and the frame painted opaque white. Same
public-shell class as the /assets/* and /amicode/widget-frame exemptions —
they were just missed. Regression since the auth refactor between
amicode.5 and amicode.7.
@jack-champagne

Copy link
Copy Markdown
Member Author

Superseded — the same fix landed on local/amicode as 4f02fc3 (fix(auth): serve the brain document + script without server auth), adding the identical /brain.html + /brain.js exemption. Closing as duplicate; the graph regression is fixed upstream.

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.

1 participant