fix: bind dashboard to loopback and escape HTML in trace rendering#27
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26ae34dced
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const url = require('url'); | ||
| const { once } = require('events'); | ||
|
|
||
| const TRACE_FILE = path.resolve('C:/PersonalRepo/.planning/traces.jsonl'); |
There was a problem hiding this comment.
Resolve traces from the checkout or configuration
When npm run dashboard-web is used outside the author's C:\PersonalRepo layout, this personal absolute path prevents the dashboard from reading the local trace file; in this Linux checkout, for example, Node resolves it under the repo as .../C:/PersonalRepo/.planning/traces.jsonl, so /data always errors and the web dashboard never shows traces. Derive the trace path from the repo root or an environment variable instead of hard-coding a machine-specific location.
Useful? React with 👍 / 👎.
| res.writeHead(500); | ||
| res.end('Error reading trace file'); |
There was a problem hiding this comment.
Return an empty JSON feed before traces exist
When the trace file has not been created yet, readLastLines() rejects with ENOENT and this branch returns a plain-text 500, but the browser client always calls await resp.json(). That makes the initial/no-traces state fail with a parse error on every poll instead of rendering an empty dashboard; handle missing files by returning [] with application/json.
Useful? React with 👍 / 👎.
26ae34d to
45cc1f9
Compare
Rescues a local-master commit (26ae34d, parallel Gemini session) stranded by branch protection: security hardening for the swarm dashboard — loopback-only bind + HTML escaping in trace rendering (data-exposure/XSS prevention). Diff vs master shows only the new fix; the base commit e85554a landed via PR #26.
🤖 Generated with Claude Code