Skip to content

fix(security): close GitHub code scanning alerts - #223

Merged
cursor[bot] merged 3 commits into
mainfrom
santosh/fix-code-scanning-alerts-cc20
Sep 9, 2026
Merged

fix(security): close GitHub code scanning alerts#223
cursor[bot] merged 3 commits into
mainfrom
santosh/fix-code-scanning-alerts-cc20

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

Clears the open GitHub code scanning alerts from gosec + trivy + CodeQL in a single PR.

The latest security workflow on main uploaded 93 gosec findings and 13 trivy advisories. Local gosec -exclude G104 ./services/... is now 0 issues. JS/Go dependency advisories that had a patch are bumped; the one Docker Engine CVE that cannot be bumped via go get is documented in .trivyignore.

PR CI then reported 3 new high CodeQL alerts (go/path-injection on the skills installer). Those reads now go through os.OpenRoot and only the constant names skill.toml / skill.json.

A focused review approved the change. Follow-up: confine BACKUP_TEST_SCRIPT to the working tree (basename-only was bypassable) and add a skill.json-only install test.

Related issue

Closes the open code-scanning alerts on main. They auto-close when this SARIF upload replaces the previous one (after merge, or on this PR’s security job).

Changes

Real remediations

  • Bound intint32/uint32 conversions (db, e2b frame length, docker memory peak)
  • Quote + validate retention SQL identifiers; keep #nosec G201 only after that
  • Detach fire-and-forget work with context.WithoutCancel (audit, secrets, LLM cache, key touch, docker cleanup/stop)
  • Allowlist backup-restore-test.sh under the process working directory before exec
  • Serve transformed storage bytes with X-Content-Type-Options: nosniff
  • Tighten CLI MkdirAll to 0o750; write new .env files as 0o600
  • Confine local skill installs to os.OpenRoot + canonical manifest names (CodeQL go/path-injection)

Dependency patches (trivy)

  • golang.org/x/crypto v0.55.0v0.56.0 (CVE-2026-56855, CVE-2026-78662)
  • pnpm overrides: hono@4.12.34, @hono/node-server@1.19.15, qs>=6.16.0, body-parser>=2.3.0, prismjs>=1.30.0, postcss-selector-parser>=7.1.3

Documented false positives

  • CLI/operator file paths and git/goose/tsc wrappers (G304/G204/G703)
  • Env-var names and public OAuth URLs (G101)
  • Demo-seed RNG (G404)
  • Legacy webhook sha1 HMAC (G505) — still required for GitHub-style sha1= signatures
  • github.com/docker/docker CVE-2026-33997 — daemon plugin install flaw; the Go module is deprecated and frozen at v28.5.2. We only use it as a client.

Test plan

  • gosec -exclude G104 ./services/... → 0 issues
  • Unit tests for touched packages (db, retention, webhooks, connections, config, sandbox, server, CLI, skills, backup-test resolver)
  • go build for services/runtime/cmd/af-stack and services/cli/cmd/af-stack
  • Focused code review: approve (no blocking bugs)
  • CI green on the review follow-up commit
  • Code scanning tab on this PR shows the previous alerts as fixed

Notes for reviewers

GitHub code scanning alerts close automatically when a later analysis no longer contains them. This token cannot dismiss alerts via the API (403). After merge, the scheduled/push security workflow on main is what flips them to Fixed.

github.com/docker/docker cannot be go get’d to Engine 29.3.1 (module frozen; v29 lives under github.com/moby/moby/{client,api}). A full SDK migration is a separate breaking change and still would not ship the daemon plugin-install path.

Open in Web Open in Cursor 

Remediate the findings uploaded to code scanning (93 gosec + 13 trivy):
bound integer conversions, quote retention identifiers, detach
background work with context.WithoutCancel, allowlist the backup-test
script, and patch x/crypto plus workspace JS advisories. False-positive
gosec hits on CLI/operator paths and env-var names are annotated so the
next SARIF upload is empty. Docker Engine CVE-2026-33997 is ignored
with justification — we only consume the frozen client module.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Santosh kumar <santoshkumarradha@users.noreply.github.com>
Comment thread services/runtime/internal/skills/installer.go Fixed
Comment thread services/runtime/internal/skills/installer.go Fixed
Comment thread services/runtime/internal/skills/installer.go Fixed
CodeQL flagged the three ReadFile sites in installLocal as path
injection (user-controlled source). Read only skill.toml / skill.json
through os.OpenRoot so the basename is a constant and sibling files
cannot be opened.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Santosh kumar <santoshkumarradha@users.noreply.github.com>
@santoshkumarradha
santoshkumarradha marked this pull request as ready for review September 9, 2026 15:55
Review follow-up: resolve BACKUP_TEST_SCRIPT under the working tree
(basename-only was bypassable) and add a json-only local skill install
test so the OpenRoot confinement path is covered for both manifests.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Santosh kumar <santoshkumarradha@users.noreply.github.com>
@cursor
cursor Bot merged commit 1212495 into main Sep 9, 2026
31 checks passed
@cursor
cursor Bot deleted the santosh/fix-code-scanning-alerts-cc20 branch September 9, 2026 16:47
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