Skip to content

Dashboard: automatic browser access, no token entry - #296

Merged
Coding-Dev-Tools merged 10 commits into
mainfrom
fix/automatic-browser-access-main
Nov 1, 2026
Merged

Coding-Dev-Tools merged 10 commits into
mainfrom
fix/automatic-browser-access-main

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Why

The dashboard asked a person to type ENGRAPHIS_API_TOKEN into a web form whenever the deployment had a token configured. A deployment secret does not belong in a browser, and a single-user node should not gate its own human surface with a credential prompt.

What changed

Browsers never enter a token. The remote sign-in dialog and the window.prompt() exchange are gone.

Automatic access is the default. POST /api/auth/local-session mints the HttpOnly session for any same-origin browser request that reaches the deployment:

  • the dashboard's custom X-Engraphis-Browser-Session header is required;
  • Origin must exactly match a published Host: loopback, any literal address, a single-label/mDNS name (.local, .home.arpa), or the host in ENGRAPHIS_DASHBOARD_URL;
  • forwarding headers are honored only from a proxy listed in ENGRAPHIS_FORWARDED_ALLOW_IPS, and X-Forwarded-Proto decides the scheme behind that proxy.

Public hostnames must be configured (the Railway template already sets ENGRAPHIS_DASHBOARD_URL), which keeps DNS rebinding out.

Machine clients are unchanged. /api/* and /mcp still require Authorization: Bearer ENGRAPHIS_API_TOKEN.

Hardened mode is one switch away. ENGRAPHIS_BROWSER_AUTO_SESSION=0 restores the token gate and enables one-time links:

  • POST /api/auth/link (bearer-protected) mints a code signed with the token plus a per-process epoch;
  • engraphis-dashboard --link prints the link;
  • the code travels only in a URL fragment, is single use, expires in 15 minutes, and redeems at POST /api/auth/handoff for a 12-hour session;
  • a restart invalidates outstanding links.

Security posture

This deliberately changes the decision recorded in PR #270. That decision was: with a token configured, no automatic session, because every signal the browser path reads (Origin, Sec-Fetch-Site, the marker header) is writable by a raw loopback tunnel, so the token is the only reliable gate. This PR keeps that reasoning but makes the trade explicit and configurable: the deployment's network reachability becomes the dashboard boundary by default, and operators who expose the port to an untrusted network set ENGRAPHIS_BROWSER_AUTO_SESSION=0 to get the previous behavior plus click-to-enter links. API and MCP credentials are unaffected either way. SECURITY.md, docs/CONFIGURATION.md, docs/DOCKER.md, docs/HOSTING_RAILWAY.md, docs/AGENT_CONNECT.md, and .env.example document the change and the exposure warning.

Evidence artifact

docs/benchmark-evidence/offline-fixtures-automatic-browser-access-20261031.json is a fresh immutable export. The registry binds SHA-256 hashes of every public Python source file, and this change touches three of them, so the previous artifact no longer matched the tree. The three fixture results are byte-identical to the 1.7.11 artifact; only provenance and the source manifest changed. BENCHMARKS.md, README.md, and both rendered SVGs/PNGs were refreshed to the new digest.

Verification

  • python -m pytest tests/ -q
  • npx playwright test tests/e2e/ledger.spec.js tests/e2e/commercial.spec.js --project=chromium (136 passed)
  • python -m pytest tests/test_local_browser_access.py tests/test_local_auth_browser_session.py tests/test_dashboard_auth_placement.py tests/test_start_dashboard.py tests/test_benchmark_evidence.py -q
  • ruff check ., python scripts/externalize_dashboard_assets.py
  • Live smoke: mint a link with --link, redeem for an HttpOnly cookie, authenticated /api/bootstrap 200, replay 401.

Relationship to other PRs

Nothing merged, deployed, or released.

Bump the Pi test host to @earendil-works/pi-coding-agent 1.4.0 and pin the
patched undici and minimatch leaves with package.json overrides. The shrinkwrap
now resolves to fixed versions, so the post-install leaf repair and its version
assertions are neither needed nor valid.

Verified locally: npm ci --ignore-scripts, npm run verify, npm run
test:integration, npm audit --omit=dev, and npm audit --no-package-lock
--include=dev all pass with zero vulnerabilities.
Remove the browser token form and the window.prompt() token exchange. The
dashboard mints its HttpOnly session for any same-origin browser request that
reaches it: loopback, a literal address, a single-label/mDNS name, or the host
in ENGRAPHIS_DASHBOARD_URL, still gated by the custom browser header, an exact
Origin/Host match, and a trusted-proxy check for forwarding headers.

Machine clients and /mcp still require Authorization: Bearer
ENGRAPHIS_API_TOKEN. ENGRAPHIS_BROWSER_AUTO_SESSION=0 restores the hardened
token gate with one-time links: POST /api/auth/link (bearer-protected) and
engraphis-dashboard --link mint a single-use code, signed with the token plus
a per-process epoch, delivered in a URL fragment, valid for 15 minutes, and
redeemed at POST /api/auth/handoff for a 12-hour session.

Re-export the offline evidence artifact because the registry binds the hashes
of every public Python source file, and refresh both rendered images.
The release-floor test pinned the removed post-install repair. It now checks the
overrides and dev-host pin that make the lock itself resolve patched minimatch
and undici, and that CI no longer rewrites node_modules before auditing.
The lock resolves the patched leaves through package.json overrides, so the
development steps no longer rewrite the installed host.
Keep the file byte-compatible with the repository copy so the dependency-repair
documentation change reviews as prose only.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T09:18:01.853901Z
We couldn’t complete this review. Comment @codex review to try again.
757f994 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

CodeQL py/stack-trace-exposure flagged the /api/auth/link error path. The value
is already validated at startup; return the constant message instead.
The evidence registry binds the SHA-256 of every public Python source file. The
stack-trace-exposure fix changed engraphis/dashboard_app.py after the previous
export, so the pinned artifact no longer matched the tree. This immutable export
records the final source manifest; the three fixture results are unchanged.

Updated the registry constants, benchmark guide, README checksum prefix, and
both rendered SVG/PNG pairs.
@Coding-Dev-Tools
Coding-Dev-Tools merged commit 173a570 into main Nov 1, 2026
30 checks passed
@Coding-Dev-Tools
Coding-Dev-Tools deleted the fix/automatic-browser-access-main branch November 1, 2026 09:08
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