Skip to content

fix(security): clear CodeQL residual #11/#7/#1/#3#66

Merged
cocofhu merged 3 commits into
mainfrom
fix/codeql-residual-11-7-1-3
Jul 26, 2026
Merged

fix(security): clear CodeQL residual #11/#7/#1/#3#66
cocofhu merged 3 commits into
mainfrom
fix/codeql-residual-11-7-1-3

Conversation

@cocofhu

@cocofhu cocofhu commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

Clear the four CodeQL alerts that remained open on main after PR #55 by fixing sinks (not dismissing/suppressing):

Alert Severity Sink (pre-fix) Fix in this PR
#11 Command built from user-controlled sources Critical server/internal/sandbox/ssh.go sess.Start / Run on bare string Typed safeCmd; run/runInput/openTerminal only accept validated argv; render() re-validates+quotes at sink; Exec via newSafeCmd; scripts via ExecScript (bash/sh -s + stdin) so bodies never reach Start/Run
#7 Incorrect conversion between integer types High engine.go int32(n) in SetAutoRetryMax autoRetryMaxatomic.Int64; only n<0→0; no MaxInt32 product clamp; boundary tests
#1 Client-side XSS High chat_view.js img.src = url after boolean check sanitizeImageURL returns safe string; only return value assigned to img.src
#3 Client-side URL redirect Medium Same sink as #1 Same sanitize path

Also: safe_image_url MIME whitelist tightened (png/jpeg/gif/webp; reject svg+xml); node --test hooked into ci-sandbox (static-js job). Does not regress #55 TOFU / quoteShellPath / host-key pinning.

Test plan

Acceptance (page verification)

  1. Merge this PR to main and wait for Security / CodeQL on main.
  2. Visit code-scanning alerts; filter or search by numbers 11, 7, 1, 3.
  3. Expect each to be Closed / not Open. If any remain Open, do not dismiss/suppress — iterate sink-side code instead.

Made with Cursor

Introduce typed safeCmd with sink-side validate+quote for SSH Start/Run,
store autoRetryMax as atomic.Int64, and sanitize image URLs before img.src.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread sandbox-gateway/sandbox/web/static/js/ui/chat_view.js Fixed
Comment thread sandbox-gateway/sandbox/web/static/js/ui/chat_view.js Fixed
AgentBot and others added 2 commits July 26, 2026 02:08
Rebuild data: image URLs via charset copy so img.src never receives the
original tainted string; update SetExecHook tests to match script bodies
on stdin after bash -s migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cocofhu
cocofhu merged commit d87f902 into main Jul 26, 2026
12 checks passed
@cocofhu
cocofhu deleted the fix/codeql-residual-11-7-1-3 branch July 26, 2026 07:51
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