Skip to content

fix: address open code scanning alerts - #2684

Merged
rdimitrov merged 4 commits into
mainfrom
claude/code-scanning-fixes
Nov 5, 2026
Merged

rdimitrov merged 4 commits into
mainfrom
claude/code-scanning-fixes

Conversation

@rdimitrov

@rdimitrov rdimitrov commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes the open CodeQL code scanning alerts by addressing root causes (no suppression comments added, no alerts dismissed). Alert status will only update once CodeQL re-scans this branch.

Alert Rule Severity File Fix
#17 go/uncontrolled-allocation-size high engine/adapter/memattempt/memattempt.go Truncate ids to the limit first, then size the page from the slice length
#16 go/uncontrolled-allocation-size high adapters/jsonlstore/metalist.go Cap row preallocation at a constant
#15 go/unvalidated-url-redirection medium internal/testutil/identityharness/{oauth,as1,idp}.go Redirect to the registered redirect URI the request matched, never the request's own copy; redirect also refuses non-http(s) or userinfo URLs (CodeQL re-flagged the validation-only fix as #20)
#14 go/incorrect-integer-conversion high adapters/grpcdriver/attemptrepository.go Reject limits outside int32 before converting
#13 go/allocation-size-overflow high perf/cmd/benchtrend/main.go Build output with bytes.Buffer instead of summed make size
#12 go/allocation-size-overflow high internal/adapter/credentialstore/plain_file.go Reject values over MaxValueBytes before allocating
#11 go/allocation-size-overflow high environment/microvm/control/protocol.go Build frame with append instead of summed make size
#10 go/allocation-size-overflow high engine/governance/args.go Drop the 2*len map size hint
#9 go/zipslip high environment/microvm/worktree/worktree.go Extract every entry through an os.Root
#8 go/unsafe-unzip-symlink high environment/microvm/worktree/worktree.go Same: symlinks created via os.Root, later entries cannot traverse them out of the tree
#7 go/unsafe-unzip-symlink high environment/microvm/worktree/worktree.go Same as #8
#6 go/request-forgery critical sdk/typescript/e2e/fixturedaemon/main.go Rebuild request URL from the fixture authority; only the query comes from the request
#5 go/constant-oauth2-state high internal/adapter/mcpbroker/workspace_enrollment.go State held in callbackToken; clearing uses its zero value, not ""
#4 go/constant-oauth2-state high internal/adapter/mcpbroker/auth.go Same as #5
#2 js/incomplete-multi-character-sanitization high apps/web/src/components/shell/top-nav.test.tsx Extract link text with a character scan instead of regex tag stripping (the first regex fix was re-flagged as #19)
#1 js/xss-through-dom high apps/web/src/features/settings/avatar-picker.tsx Decode the stored base64 image data URL (allowlisted image types) into a Blob and render it from a revocable blob: object URL, so stored preference text never reaches img src (a prefix check was re-flagged as #18) (+ unit tests)

Not addressed

  • #3 go/reflected-xss (internal/adapter/server/authn.go:860): false positive. The flagged line is the pass-through Write of tokenDroppingWriter, which forwards bytes handlers already produced. Every handler behind it sets a non-HTML Content-Type (application/json, application/problem+json, text/event-stream, text/plain via http.Error), but CodeQL cannot see the handler's Content-Type at the wrapper's forwarding call. The only ways to silence it would restructure the wrapper to dodge the analyzer, so it is left for a triage decision. It is an alert on main, not one this PR introduces.

Notes

Verification

  • go build ./...: pass
  • go test on touched root packages (environment/microvm/{control,worktree,...}, adapters/grpcdriver, adapters/jsonlstore, internal/adapter/{credentialstore,mcpbroker}, internal/testutil/..., perf/...): pass, except environment/microvm/guestexec, which fails identically without this change (tests refuse to run as root in this sandbox)
  • cd engine && go test ./governance/... ./adapter/memattempt/...: pass
  • go test ./internal/testutil/identityharness/: pass (after the Model switch: optional context carryover into the new session #20 change)
  • cd apps && pnpm install --frozen-lockfile, then cd web && npx vitest run src/features/settings src/components/shell/top-nav.test.tsx: 17 files, 89 tests pass
  • npx biome check web/src/features/settings web/src/components/shell: clean
  • pnpm typecheck (apps/web): no errors in touched files; it fails on pre-existing apps/server errors (the @stacklok-oss/mecatl-sdk package is not built in this sandbox)
  • task lint, task test:race and the offline demo were not run: the sandbox has no task, and golangci-lint is built with Go 1.25 (< 1.27.3). CI covers these.

https://claude.ai/code/session_01PxAB5heFXcxfMzwYXYTzer


Generated by Claude Code

Bound allocation sizes, validate redirect and request targets, extract
archives through os.Root, avoid fixed OAuth state values, and tighten web
avatar and test sanitization.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PxAB5heFXcxfMzwYXYTzer
The stored avatar text shares the preference store with display names,
so render it from a blob: URL built from the decoded image bytes instead
of placing the stored string in the img src.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PxAB5heFXcxfMzwYXYTzer
@rdimitrov
rdimitrov merged commit 12907be into main Nov 5, 2026
47 checks passed
@rdimitrov
rdimitrov deleted the claude/code-scanning-fixes branch November 5, 2026 12:49
@rdimitrov rdimitrov mentioned this pull request Nov 9, 2026
4 of 14 tasks
This was referenced Nov 11, 2026
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.

3 participants