altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

fix: pre-release security and resource cleanup fixes for tracing

Open anandgupta42 opened this issue 8 months ago • 0 comments

Description

Three issues found during pre-release review of v0.4.0 → v0.5.0 changes:

  1. XSS in trace viewer (viewer.ts:200): t.summary.status is inserted into HTML without the e() escape function, while all other fields are properly escaped. An attacker with local file access could inject script via crafted trace JSON.

  2. Trace viewer server never gracefully shut down (trace.ts): The await new Promise(() => {}) keeps the process alive but there's no SIGINT/SIGTERM handler to explicitly close the Bun server on Ctrl+C.

  3. Silent temp file accumulation (tracing.ts:631): When atomic rename fails and cleanup also fails, orphaned .tmp.* files accumulate silently with no diagnostic logging.

Impact

  • Issue 1: Security (XSS) — low practical risk since viewer is localhost-only, but should be fixed
  • Issue 2: Resource cleanup — server socket not explicitly closed on exit
  • Issue 3: Disk space — orphaned temp files with no visibility

All three are minimal fixes (1-2 lines each).

anandgupta42 avatar Mar 16 '26 22:03 anandgupta42