carlos / platform Public

fix-423: console tenant tests assert on rendered content, not the session token

The remote-instance tests assert a page body does not contain readings such
as "v8", "66%" or "27%". Every page carries the 43-character random
session token in its CSRF fields, so a two-character string appears in it
about 1 run in 100. twoBoxes.page now blanks the session token before the
body is returned. The assertions stay page-wide, so a leak anywhere on the
page still fails: with the account check in appFacts.host removed,
TestRemoteMetricsRefuseRejectedReport fails.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 4e75908af559ea030f7535b059f7f1624d672c02 parent b1d00ca
1 file changed, +7 −1
  • internal/console/remoteinstances_test.go +7 −1

CI passed — run details

diff --git a/internal/console/remoteinstances_test.go b/internal/console/remoteinstances_test.go
index 6d7408f8d..0b10e25f4 100644
--- a/internal/console/remoteinstances_test.go
+++ b/internal/console/remoteinstances_test.go
@@ -197,7 +197,13 @@ func (tb *twoBoxes) page(t *testing.T, path string) string {
if status != http.StatusOK {
t.Fatalf("GET %s = %d -> %q\n%s", path, status, loc, body)
}
- return body
+ // Every page carries the session token in its CSRF fields: 43 random
+ // base64url characters. The tests below assert that readings such as
+ // "v8" or "66%" are absent from the page, and a two-character string
+ // turns up in a random 43-character token about 1 run in 100 (#423).
+ // Blank the token, wherever it appears, so only rendered content is
+ // matched. The assertion stays page-wide: a leak anywhere still fails.
+ return strings.ReplaceAll(body, sessionToken(t, tb.fx, tb.browser), "SESSION-TOKEN")
}
// setUp creates the remote instance (and, with local, one on the console's