Skip to content

fix(security): bound status page historyDays, mask config tokens in replay, JS websocket redirect policy, docs JWT placeholders - #903

Merged
fclairamb merged 20 commits into
mainfrom
security/scan-specs-2026-11-16
Nov 16, 2026
Merged

fclairamb merged 20 commits into
mainfrom
security/scan-specs-2026-11-16

Conversation

@fclairamb

@fclairamb fclairamb commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Fixes for the findings of the security scan of 2026-11-16 (AO1–AO4).

What changed

  • AO2 (Medium), status page historyDays: REST and MCP refuse a legacy historyDays outside 1..90 (422 VALIDATION_ERROR, when historyPeriod is absent). The public view, recentUpdates and the Atom feed clamp the stored value to 1..90. Migration 037_v0_50_3 rewrites out-of-range rows from their history_period. OpenAPI documents the bound.
  • AO1 (Low), session replay: check responses gain redactedConfigKeys (the clear-text credential keys the checker declares). dash0's Configuration card masks those rows with SecretText (ph-no-capture): heartbeat/email token, SMTP delivery_to. The E2E no-capture test now covers the card.
  • AO3 (Low), JS websocket.connect: the handshake now has a redirect policy. It follows at most 10 hops, refuses a wss→ws downgrade, and on a cross-origin hop drops Authorization, Proxy-Authorization, Cookie and any script header holding a check secret. Dropped names are reported in redirect_dropped_secret_headers.
  • AO4 (Low), docs JWT secret: the docs show $(openssl rand -base64 48) instead of literal values. Both strings published so far are treated as placeholders and replaced at boot. A secret shorter than 32 bytes logs a warning.

Breaking changes / operator notes

  • API: historyDays outside 1..90 without historyPeriod is now a 422 instead of being stored.
  • A deployment whose SP_AUTH_JWT_SECRET is one of the two published doc strings gets a new signing secret at the next boot, which logs every user out.
  • JS checks: handshake redirect chains are capped and wss→ws redirects are refused.

Decided by autopilot

  • AO1 (replay mask): server names the credential keys (redactedConfigKeys), the spec's recommended option.
  • AO3 (websocket): custom CheckRedirect reusing the http.* secret-header rule rather than checkerdef.CredentialRedirectPolicy (both allowed by the spec; the latter only matches header names).

🤖 Generated with Claude Code

fclairamb and others added 7 commits November 16, 2026 07:36
… read

The legacy historyDays input was stored unbounded and the public view sized
its window, bucket count and slice from it: a value near the int32 maximum
OOM-killed the API process on every view, a negative one panicked in make.

- REST create/update and the MCP tools refuse historyDays outside 1..90
  (VALIDATION_ERROR, field historyDays) when historyPeriod is absent.
- enrichWithAvailability, buildAvailabilityData and loadRecentUpdates clamp
  the stored value to [1, 90].
- openapi: minimum/maximum on historyDays.

Spec 2026-11-16-01.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Migration 037 (both dialects) replaces a history_days outside 1..90 with the
day count of the row's history_period. In-range rows are untouched.

Spec 2026-11-16-01.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…..90

Export statuspages.ClampHistoryDays and apply it to the feed, like the page's
recentUpdates. OpenAPI: an out-of-range historyDays is 422 VALIDATION_ERROR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… response

redactedConfigKeys lists the config keys whose value is sent in clear but
is a credential (ExportRedactedFields and SecretFields of the checker:
heartbeat/email token, SMTP delivery_to), so dash0 can keep them out of
the session replay (spec 2026-11-16-02).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.85057% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.72%. Comparing base (7a309a5) to head (ab83ccc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ver/internal/handlers/statussubscribers/handler.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #903      +/-   ##
==========================================
+ Coverage   90.71%   90.72%   +0.01%     
==========================================
  Files        1370     1370              
  Lines      140934   141005      +71     
==========================================
+ Hits       127850   127929      +79     
+ Misses      13075    13067       -8     
  Partials        9        9              
Files with missing lines Coverage Δ
server/internal/checkers/checkjs/websocket.go 89.26% <100.00%> (+5.08%) ⬆️
server/internal/config/discord_oauth.go 100.00% <100.00%> (ø)
server/internal/handlers/checks/service.go 90.63% <100.00%> (+0.09%) ⬆️
server/internal/handlers/statuspages/handler.go 93.47% <100.00%> (+0.07%) ⬆️
server/internal/handlers/statuspages/service.go 92.76% <100.00%> (+0.19%) ⬆️
server/internal/mcp/tools_statuspages.go 98.53% <100.00%> (+0.01%) ⬆️
server/internal/systemconfig/systemconfig.go 96.41% <100.00%> (+0.06%) ⬆️
...ver/internal/handlers/statussubscribers/handler.go 93.90% <50.00%> (+0.02%) ⬆️

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fclairamb and others added 9 commits November 16, 2026 07:51
CheckConfigView renders the config keys the check response lists in
redactedConfigKeys (heartbeat/email token, SMTP delivery_to) through
SecretText, so the Configuration card no longer leaks the token #880 hid
in the endpoints card. Other rows stay readable. The design reference
documents the rule (spec 2026-11-16-02).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nect handshake

The JS websocket binding had no CheckRedirect, so coder/websocket followed
handshake redirects with net/http's header policy and no hop limit: a
script header carrying a secret (and Referer) reached any host. The
handshake client now always exists and carries wsRedirectPolicy: 10-hop
cap, wss->ws downgrade refused, Referer, Authorization,
Proxy-Authorization and Cookie dropped on a cross-origin hop, plus the
script's headers the http.* rule drops for a check holding secrets. The
dropped names are reported as redirectDroppedHeaders on the handle and
redirect_dropped_secret_headers in the output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…olders

The configuration docs offered `your-secure-random-secret` and
`your-secure-random-secret-at-least-32-chars` as copy-paste JWT secrets.
Both are now refused by config.IsPlaceholderJWTSecret, so a copy that
reached production is replaced by a generated secret at the next boot
(this ends every current session). The docs now show
`$(openssl rand -base64 48)` and say an unset secret is auto-generated;
a test keeps any known placeholder out of the docs. A non-placeholder
secret shorter than 32 bytes is kept but logged as a warning at startup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e docs are accepted as real signing keys

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fclairamb fclairamb changed the title fix(security): bound status page history, mask config tokens in replay, JS websocket redirect policy, docs JWT placeholders fix(security): bound status page historyDays, mask config tokens in replay, JS websocket redirect policy, docs JWT placeholders Nov 16, 2026
@fclairamb fclairamb added the implemented Every spec of the PR is implemented and its batch gate was green label Nov 16, 2026
fclairamb and others added 3 commits November 16, 2026 08:42
freeTCPPort releases the port before gldap listens, and gldap reports Ready()
even when its listen failed, so a parallel test could take the port and the
login then reached another directory (invalid credentials).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@fclairamb
fclairamb merged commit 6b432e0 into main Nov 16, 2026
39 checks passed
@fclairamb
fclairamb deleted the security/scan-specs-2026-11-16 branch November 16, 2026 20:07
fclairamb added a commit that referenced this pull request Nov 16, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.51.0](v0.50.2...v0.51.0)
(2026-11-16)


### Features

* Pingdom check importer, insights period selector, job retry log levels
([#904](#904))
([7914164](7914164))


### Bug Fixes

* **security:** bound status page historyDays, mask config tokens in
replay, JS websocket redirect policy, docs JWT placeholders
([#903](#903))
([6b432e0](6b432e0))
* **security:** cap the pre-auth body buffer in ServiceSignature
([#894](#894))
([c4da4c5](c4da4c5)),
closes [#892](#892)
* **security:** cross-check SAML NameID namespace (GO-2026-6909)
([#896](#896))
([df0d7b6](df0d7b6))
* **security:** treat known dev JWT secrets as placeholders
([#895](#895))
([1cad98a](1cad98a)),
closes [#892](#892)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge autopilot implemented Every spec of the PR is implemented and its batch gate was green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant