Skip to content

fix(local-runtime): stop leaking stack traces through HTTP JSON - #568

Merged
hetaoBackend merged 1 commit into
mainfrom
fix/codeql-stack-trace-exposure
Oct 31, 2026
Merged

hetaoBackend merged 1 commit into
mainfrom
fix/codeql-stack-trace-exposure

Conversation

@hetaoBackend

@hetaoBackend hetaoBackend commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Clears the open CodeQL alert js/stack-trace-exposure on main (packages/local-runtime/src/api/host-helpers.ts json() sink). Stack-shaped and Error-derived payloads could reach HTTP clients through that helper and through TaskError.details.

  • json() uses a replacer that drops stack keys and turns Error values into { name, message }.
  • normalizeTaskError no longer embeds error.stack in details (TaskError is returned over HTTP).
  • Feishu questionnaire failure responses return a stable QUESTIONNAIRE_SUBMIT_FAILED code; the user-facing toast was already generic.
  • Agent create and cron 5xx responses return a generic client message; short single-line 4xx validation text is kept.
  • Cron schedule assertion wraps unknown scheduler failures as Invalid cron schedule and logs the detail server-side.

Validation

  • pnpm typecheck PASS on this branch (Node 24.22.2).
  • Manual check: JSON.stringify with the new replacer omits details.stack and serializes nested Error without frames.
  • NOT RUN yet on GitHub: CodeQL re-analysis on this PR head (expected to close alert 94 once it runs).

Publication and contribution checks

  • No credentials or private material.
  • Behaviour change is limited to HTTP error payload shape for failure paths; success paths unchanged.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

CodeQL js/stack-trace-exposure on main: json() was a sink for Error-derived
payloads. Drop stack keys (and Error instances) in the JSON replacer, stop
embedding error.stack in TaskError details, return stable client text for
5xx / feishu questionnaire failures, and keep only short single-line
validation messages on 4xx cron responses.
@hetaoBackend
hetaoBackend marked this pull request as ready for review October 31, 2026 01:38
@hetaoBackend
hetaoBackend merged commit c6c7f28 into main Oct 31, 2026
13 checks passed
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.

1 participant