Skip to content

fix(pm-stack): the console is the gate for the whole public hostname - #12412

Merged
dezren39 merged 2 commits into
mainfrom
claude/pm-console-gate
Nov 22, 2026
Merged

dezren39 merged 2 commits into
mainfrom
claude/pm-console-gate

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Why

The first plan for the public hostname sent /console to the console and every other path straight to the dashboard, with Cloudflare Access as the only check in front of the dashboard. Three paths bypass Access so a phone can fetch them before sign-in. The dashboard resolves dot segments itself, so whether /icons/../attention could reach it unsigned depended on how the edge normalises a path before matching it. The dashboard has no sign-in of its own and it accepts writes. Nothing was exposed yet; this closes the gap before it is.

What changes

  • The whole hostname goes to the console. /console is served there. Every other path is passed to the dashboard only for a verified owner, using the parsed path that was checked.
  • Five install files are public: /manifest.webmanifest and four icons. They are matched exactly, read-only, and nothing the caller sent goes with the request.
  • A write from another site is refused before it reaches the dashboard.
  • expose.py writes one tunnel rule for the host, with no path, ahead of every other rule. The Access cookie is SameSite=Lax and HttpOnly.
  • PM_CONSOLE_DASHBOARD_URL (default http://127.0.0.1:4870) must be loopback http with no path; empty serves /console alone.

Evidence

Check Result
cd pm-stack/console && bun test 32 pass
python3 -m unittest discover -s pm-stack/console/scripts -p 'test_*.py' 7 pass
Property: 4,000 generated path spellings, unsigned the dashboard is asked only for one of five literal URLs
Faults planted in the gate and the route change 26 of 26 caught
The real server in front of a stand-in dashboard passthrough, server-sent events, a 3 MB body and a redirect work; unsigned /icons/../attention, /icons/%2e%2e/attention and /icons/icon-192.png/../../attention are 401; a cross-site write is 403; a stopped dashboard is 502

Not exercised here: the real edge. That check follows deployment, with the route written last.

Undo

Revert this PR. The console then serves /console only, as in #12360.

Refs #12360, #9077.


Generated by Claude Code


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • New Features
    • The public hostname now serves the dashboard at / for verified owners, while /console continues to serve the console. Selected install assets remain publicly accessible.
    • Android builds can be distributed as unsigned APKs or signed and attached to a release when signing credentials are configured.
  • Bug Fixes
    • Dashboard requests are restricted to local services, and cross-site write requests are rejected.
  • Documentation
    • Updated deployment, access, and Android signing guidance, including manual signing and certificate verification.

The exposure plan sent /console to the console and every other path
straight to the dashboard, with Cloudflare Access as the only check in
front of it. Three paths bypass Access (the install manifest, its
icons, the Android asset links), and the dashboard resolves dot
segments itself, so whether /icons/../attention reached the dashboard
unsigned depended on how the edge normalises a path before it matches
one. The dashboard has no sign-in of its own and accepts writes.

The whole hostname now goes to the console. /console is served here.
Every other path is passed to the dashboard only for a verified owner,
using the parsed path that was checked. Five install files are public,
matched exactly, read-only, with nothing the caller sent passed along.
Writes from another site are refused before they reach the dashboard.
Redirects, streamed answers and large bodies pass through.

- config: PM_CONSOLE_DASHBOARD_URL (default http://127.0.0.1:4870);
  loopback http with no path, or empty to serve /console alone.
- expose.py: one tunnel rule for the host, with no path, ahead of every
  other rule; an earlier two-rule layout is replaced. The Access
  application's cookie is SameSite=Lax and HttpOnly, and drift in
  either is put back.

Tests: 32 bun tests and 7 Python tests. A seeded property sends 4,000
generated path spellings unsigned and checks the dashboard is asked
only for one of five literal URLs. 26 planted faults in the gate and
the route change are all caught. Run for real in front of a stand-in
dashboard: passthrough, server-sent events, a 3 MB body, a redirect,
401 for unsigned dot-segment paths, 403 for a cross-site write, 502
when the dashboard is down.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
@dezren39
dezren39 requested a review from a team as a code owner November 22, 2026 05:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T05:03:17.985116Z de39547 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.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The console now routes the public hostname through its owner gate to dashboard paths and selected public assets. The Android workflow supports signed and unsigned builds, with host-side signing and certificate fingerprint verification.

Changes: Shared-host dashboard access

Layer / File(s) Summary
Dashboard URL configuration
pm-stack/console/src/config.ts, pm-stack/console/test/console.test.ts, pm-stack/console/README.md
Configuration adds a nullable dashboard URL, defaults it to a loopback address, and rejects invalid or non-loopback values. Tests cover accepted and rejected values, and the README documents the setting.
Host-wide tunnel and Access settings
pm-stack/console/scripts/expose.py, pm-stack/console/scripts/test_expose.py, pm-stack/PORTS.md, pm-stack/README.md
The tunnel routes the hostname to the console. The Access application receives cookie settings, and setup replaces prior host routes when needed. Tests cover route replacement and cookie-setting updates.
Shared-host request routing
pm-stack/console/src/server.ts, pm-stack/console/test/console.test.ts, pm-stack/console/README.md
The server proxies dashboard requests for verified owners and permits unauthenticated requests only for exact public install-file paths. It filters request and response data, rejects cross-site writes, and returns errors for oversized bodies or upstream failures. Tests cover routing and proxy behavior.

Android APK signing and release

Layer / File(s) Summary
Host-side signing and fingerprint check
pm-stack/console/android/sign.sh, pm-stack/console/android/README.md
The script signs an APK with the configured keystore and checks its certificate against signing-fingerprint.txt. The README documents host-side signing and verification.
Build artifacts and conditional release upload
.github/workflows/pm-console-android.yml
The workflow uploads signed and unsigned APK artifacts under different names. It attaches APKs to a release only when publishing is enabled and the build is signed.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant ConsoleServer
  participant Dashboard
  Browser->>ConsoleServer: Request public install file
  ConsoleServer->>Dashboard: GET allowlisted path without caller headers
  Dashboard-->>ConsoleServer: Install-file response
  ConsoleServer-->>Browser: Install-file response
  Browser->>ConsoleServer: Request dashboard path as verified owner
  ConsoleServer->>Dashboard: Proxy path, query, and filtered request data
  Dashboard-->>ConsoleServer: Dashboard response
  ConsoleServer-->>Browser: Filtered response
Loading
sequenceDiagram
  participant AndroidWorkflow
  participant APKArtifact
  participant Operator
  participant SignScript
  participant Apksigner
  participant FingerprintFile
  AndroidWorkflow->>APKArtifact: Upload signed or unsigned APK
  Operator->>SignScript: Provide input APK and signing paths
  SignScript->>Apksigner: Sign APK with configured keystore
  Apksigner-->>SignScript: Signed APK and certificate digest
  SignScript->>FingerprintFile: Compare expected certificate fingerprint
  SignScript-->>Operator: Report success or remove mismatched output
Loading

Possibly related issues

  • developing-today/code#1182 — The change routes the public hostname through the console’s verified-owner gate, matching the issue’s requested public dashboard access. The issue’s off-tailnet verification is not shown as completed.
  • developing-today/code#1184 — The PR implements the epic’s child scope for one public URL behind an owner gate.

Possibly related PRs

Suggested reviewers: claude

Merge Risk: Low · up to 8ecfa

The whole-host owner gate works as described. Three small proxy issues should be fixed before or soon after merge: query strings reach the dashboard on public install files, connection-nominated headers pass through, and a disconnected client can leave brief upstream work running. None of them lets an unauthenticated user reach a protected dashboard path.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The workflow failed outright without signing secrets in the repository.
The key stays on the pm-stack host instead: the workflow builds an
unsigned APK and keeps it as an artifact, and sign.sh on the host signs
it and checks the certificate against signing-fingerprint.txt. The
password is read by apksigner from its file and is never an argument,
an environment value or output. With the secrets set, the workflow
still signs and publishes by itself.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
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.

2 participants