Skip to content

Harden dashboard server and CI pipeline#3

Merged
astrobyte-dev merged 1 commit into
mainfrom
claude/confident-dijkstra-JdsaH
May 28, 2026
Merged

Harden dashboard server and CI pipeline#3
astrobyte-dev merged 1 commit into
mainfrom
claude/confident-dijkstra-JdsaH

Conversation

@astrobyte-dev

Copy link
Copy Markdown
Owner

Summary

Defense-in-depth hardening for the localhost dashboard server (which can run arbitrary Tidal/SC code via /cmd) plus a CI supply-chain pin. One commit, +37 / −7 across 3 files.

mcp/src/dashboard.ts

  • Add security headers to every response: X-Content-Type-Options: nosniff, X-Frame-Options: DENY, and a CSP (default-src 'self', style-src 'self' 'unsafe-inline', connect-src 'self', object-src 'none', frame-ancestors 'none').
  • Make the loopback guard fail closed: a missing Host header is now rejected (was previously allowed through).
  • Cap concurrent /clock SSE connections at 8 (429 beyond that) to prevent unbounded setInterval accumulation; counter decremented on connection close.
  • Reject non-application/json bodies on /cmd with 415 (empty content-type still allowed).
  • Log server errors to stderr instead of swallowing them silently.

mcp/src/track.ts

  • Escape regex metacharacters in the param name inside applyParam before building the RegExp, preventing regex-injection / malformed matches.

.github/workflows/ci.yml

  • Pin actions/checkout (v4.2.2) and actions/setup-node (v4.4.0) to commit SHAs.

Test plan

  • npm ci clean
  • npm run build clean (tsc)
  • npm test — all 31 tests pass
  • CSP verified compatible: dashboard.html loads all scripts via <script src>, has no inline event handlers, no external resources; EventSource/fetch are same-origin
  • Content-type guard compatible with frontend (dashboard.js already sends application/json)

https://claude.ai/code/session_01G8QLPJGNExEePDLtCsukBJ


Generated by Claude Code

- dashboard.ts: add Content-Security-Policy, X-Content-Type-Options,
  X-Frame-Options headers to every response
- dashboard.ts: fix DNS-rebinding guard to fail-closed (empty/absent
  Host header was previously allowed through)
- dashboard.ts: cap concurrent SSE /clock connections at 8 to prevent
  unbounded timer accumulation
- dashboard.ts: enforce application/json Content-Type on /cmd POST
- dashboard.ts: log server errors to stderr instead of silently dropping
- track.ts: escape param string before constructing RegExp in applyParam
  to prevent regex injection / ReDoS from untrusted POST bodies
- ci.yml: pin actions/checkout and actions/setup-node to full commit
  SHAs to protect against mutable tag supply-chain attacks

https://claude.ai/code/session_011GALMvXr1b8uKfPy17fxxK
Copilot AI review requested due to automatic review settings May 28, 2026 10:03
@astrobyte-dev
astrobyte-dev merged commit adb8509 into main May 28, 2026
1 of 2 checks passed
@astrobyte-dev
astrobyte-dev deleted the claude/confident-dijkstra-JdsaH branch May 28, 2026 10:04
@astrobyte-dev
astrobyte-dev removed the request for review from Copilot May 28, 2026 10:24
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