carlos / platform Public

fix: demo operator doors answer 401 first; fixture Go version

Run the standard CLI authentication refusal before demo operator checks. Keep authenticated unauthorized callers on the existing indistinguishable refusal and assert both gates across all six doors.

Follow Plan 1 by changing only temporary fixture build copies to Go 1.26.0 while submitted archives retain the locked directive. Verified targeted console tests without skips, console vet and go build ./... with the installed Go 1.26.8 toolchain.
codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev 9ba99deda92ffa88ac3784ff642710f79b22c2c1 parent 811cb3a
4 files changed, +26 −13
  • internal/console/authcli.go +0 −4
  • internal/console/demo_operator_test.go +11 −5
  • internal/console/demo_protections_e2e_test.go +9 −0
  • internal/console/demo_reports_test.go +6 −4

Intent

Human

<task-notification> <task-id>a72b91f3d188ff4b6</task-id> <tool-use-id>toolu_017UP1apTfsE73WRW1xAG3Wq</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6e566fe9-9aca-47cb-9753-64e881b0d285/tasks/a72b91f3d188ff4b6.output</output-file> <status>completed</status> <summary>Agent "Re-review final fix wave (Opus)" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Verdict: READY.** Every item is fixed and the fix diff adds no new P1 or P2. **Census: approves.** `make census-card` says "Nothing to approve: the census is clean" at seal `22534a1666c574d30f86da73e7f6708b6ab2ec79994f217958bdc7cc67853245`. It wrote nothing, and `git status` was clean before and after. I approved both census changes in the fix wave: the new `Edge.redirectDemoRequest` and the `internal/edge` envelope re-pin. Both run in the agent's edge, not root, and read only the route that is already loaded. - **P1-1, record-write census rows: ADDRESSED.** `internal/provision/agent_start_demo_2_census_test.go:6-20` re-pins `registerCLIRoutes` as `key-site` `lit:instances,lit:sidecars` and adds `serveDemoTraffic` as `nonrecord` `sel:Put`. The census test now uses that inventory (`plan9_b8_census_test.go:369`), and `TestPlan9B8RecordWriteCensus` passes. - **Port 80 redirect: ADDRESSED.** `internal/edge/demo.go:87-102`, called from `edge.go:3284`. It sends a 308 with demo policy headers, and the existing check validates `Location` against the demo host. It only redirects when the route, alias and serving checks all pass; otherwise the old refusal applies. Nothing on this path reaches the proxy or the counters. The test at `demo_traffic_test.go:484-511` covers the HTTP methods, `HOST:80`, escaped paths, `//example.com/shop`, an empty `?`, and the closed gate (503 with no counting). - **TestConsoleTemplatesFetchNothingOffOrigin: ADDRESSED at the cause.** The guard is untouched. The report page now inlines the embedded `fiesta_day` stylesheet (`demo_report.html:7`). Its CSP allows only the SHA-256 hash of those exact bytes (`apidemoreports.go:94-111`), which is stricter than the old `'self'`. - **TestEveryCLIDoorNamesItsRoles flag-off: ADDRESSED, and who is authorized is unchanged.** The six doors are now registered whenever the console is not host-claim (`apidemooperator.go:16-25`). They keep the same empty role set, and the same `demoOperator` gate returns 404 when demos are not in box mode. `demo_operator_test.go:195-210` checks that all six doors return 404 for every kind of caller when demos are unconfigured. `svcroutes_test.go:524-535` pins that they are present with no roles, and absent on host-claim consoles. - **TestDemoProtectionsSourceToLimitAndTakedown: ADDRESSED.** Only the "disk TMPDIR required" check was removed (`demo_protections_e2e_test.go:117-123`); the scratch-directory setup, cleanup and assertions are unchanged. No skip was added. It passed outside the sandbox on a disk TMPDIR (25.5 s) and left no scratch directory. I did not run it on tmpfs, the CI case. - **TestGroupNameClassCensus: ADDRESSED.** Only the `*Edge.Reload` digest was re-pinned (`group_names_test.go:367-369`). Reload's change only wraps demo proxies and adds names that refuse requests; it adds no new group-name class. - **Copy applied verbatim: ADDRESSED.** I checked 11 rows and all matched exactly: README-02/07/14/22/24/26/27 and the `CARLOS_DEMO_EDGE_PROTECTIONS` table row in `README.md`, and CLI-DOC-02/04/05/06 with their line breaks in `docs/site/cli.md`. CLI help is pinned exactly at `system_demos_test.go:53-55`. Two minor follow-ups, neither blocking: - The report page renders and hashes the 27 KB stylesheet on every request. It never changes, so it could be computed once at startup. - On a forwarding ingress, port 80 redirects without checking the local serving gate. With serving off, a visitor gets the 308 and then a 503 over HTTPS, which re-checks. Sandbox: inside it, two provision fixture tests failed on the read-only Go build cache, and the integration test could not open sockets. Outside the sandbox, the provision `Census|Plan9` run passed and so did the integration test. The host, console and edge tests passed inside it. Review written to `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/agent-start-demo-2/.superpowers/sdd/2026-11-04-agent-start-demo-2-edge-protections/branch-review-r2.md`.</result> <usage><subagent_tokens>106670</subagent_tokens><tool_uses>26</tool_uses><duration_ms>303746</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>btxyox0hv</task-id> <tool-use-id>toolu_01Cjsa3eUNSzu5mrU1uCdo23</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6e566fe9-9aca-47cb-9753-64e881b0d285/tasks/btxyox0hv.output</output-file> <status>completed</status> <summary>Background command "Wait for CI verdict on the tip" completed (exit code 0)</summary> </task-notification>

diff --git a/internal/console/authcli.go b/internal/console/authcli.go
index 841e187cf..589f5d1d5 100644
--- a/internal/console/authcli.go
+++ b/internal/console/authcli.go
@@ -488,10 +488,6 @@ func (s *Server) cliGateRefused(allow svcrole.Set, h http.HandlerFunc, refused f
now := time.Now()
p, ok := s.store.CLIPrincipal(bearer(r), now)
if !ok {
- if demoOperatorPath(r.URL.Path) {
- http.NotFound(w, r)
- return
- }
// The same 401, with the same body, cliUser has always given:
// an expired token, a revoked one and a fabricated one are not
// distinguishable from outside.
diff --git a/internal/console/demo_operator_test.go b/internal/console/demo_operator_test.go
index 437f8cde1..8a910d8b7 100644
--- a/internal/console/demo_operator_test.go
+++ b/internal/console/demo_operator_test.go
@@ -136,6 +136,8 @@ func TestDemoKillFence(t *testing.T) {
func TestDemoOperatorAuthority(t *testing.T) {
fx := newConsoleFixture(t)
+ unsigned := httptest.NewRecorder()
+ fx.srv.cliNotSignedIn(unsigned)
fx.srv.cfg.Demo = demoTestConfig(t)
fx.srv.cfg.SystemOperators = []string{"operator@example.com"}
owner := cliToken(t, fx, "owner@example.com", "demo-owner")
@@ -164,13 +166,13 @@ func TestDemoOperatorAuthority(t *testing.T) {
{"POST", "/api/cli/system/demos/takedown", `{"host":"shop.example.com"}`},
{"GET", "/api/cli/system/demos/takedown?host=shop.example.com", ""},
} {
- var want string
for _, token := range []string{member, svc, app, "forged", ""} {
st, _, body := rawReq(t, tc.method, fx.ts.URL+tc.path, token, tc.body)
- if want == "" {
- want = body
+ wantStatus, want := http.StatusNotFound, "404 page not found\n"
+ if token == "" || token == "forged" {
+ wantStatus, want = unsigned.Code, unsigned.Body.String()
}
- if st != 404 || body != want {
+ if st != wantStatus || body != want {
t.Fatalf("authority %s: %d %q want %q", tc.path, st, body, want)
}
}
@@ -203,7 +205,11 @@ func TestDemoOperatorAuthority(t *testing.T) {
} {
for _, token := range []string{owner, listed, member, svc, app, "forged", ""} {
status, _, body := rawReq(t, tc.method, fx.ts.URL+tc.path, token, tc.body)
- if status != http.StatusNotFound {
+ wantStatus, want := http.StatusNotFound, "404 page not found\n"
+ if token == "" || token == "forged" {
+ wantStatus, want = unsigned.Code, unsigned.Body.String()
+ }
+ if status != wantStatus || body != want {
t.Fatalf("disabled demo door %s %s: %d %s", tc.method, tc.path, status, body)
}
}
diff --git a/internal/console/demo_protections_e2e_test.go b/internal/console/demo_protections_e2e_test.go
index 21e0de539..595750de8 100644
--- a/internal/console/demo_protections_e2e_test.go
+++ b/internal/console/demo_protections_e2e_test.go
@@ -68,6 +68,15 @@ func demoProtectionBuilds(t *testing.T, dir string) ([][]byte, []string, []strin
if _, err = tw.Write(b); err != nil {
t.Fatal(err)
}
+ // Match demoE2EBuilds: only the local build copy uses the
+ // repository's minimum Go version; the archive keeps the lock.
+ if name == "go.mod" {
+ pinned := []byte("\ngo " + demobuild.ToolchainVersion + "\n")
+ if bytes.Count(b, pinned) != 1 {
+ t.Fatal("fixture must contain the locked Go directive")
+ }
+ b = bytes.Replace(b, pinned, []byte("\ngo 1.26.0\n"), 1)
+ }
if err = os.WriteFile(filepath.Join(src, name), b, 0600); err != nil {
t.Fatal(err)
}
diff --git a/internal/console/demo_reports_test.go b/internal/console/demo_reports_test.go
index cd67be575..d34ed46dc 100644
--- a/internal/console/demo_reports_test.go
+++ b/internal/console/demo_reports_test.go
@@ -337,6 +337,8 @@ func TestDemoReportBudgets(t *testing.T) {
func TestDemoReportOperatorAuthority(t *testing.T) {
fx := newConsoleFixture(t)
+ unsigned := httptest.NewRecorder()
+ fx.srv.cliNotSignedIn(unsigned)
fx.srv.cfg.Demo = demoTestConfig(t)
fx.srv.cfg.SystemOperators = []string{"operator@example.com"}
owner := cliToken(t, fx, "owner@example.com", "report-owner")
@@ -359,13 +361,13 @@ func TestDemoReportOperatorAuthority(t *testing.T) {
}
paths := []struct{ method, path string }{{"GET", "/api/cli/system/demos/reports"}, {"POST", "/api/cli/system/demos/reports/" + id + "/resolve"}}
for _, p := range paths {
- var want string
for _, token := range []string{member, svc, app, "forged", ""} {
status, _, body := rawReq(t, p.method, fx.ts.URL+p.path, token, "")
- if want == "" {
- want = body
+ wantStatus, want := http.StatusNotFound, "404 page not found\n"
+ if token == "" || token == "forged" {
+ wantStatus, want = unsigned.Code, unsigned.Body.String()
}
- if status != 404 || body != want {
+ if status != wantStatus || body != want {
t.Fatalf("authority %s %d %s", p.path, status, body)
}
}