Skip to content

security: address CodeQL high-severity findings#154

Merged
solomon2773 merged 2 commits intomasterfrom
fix/codeql-high-followups
Apr 23, 2026
Merged

security: address CodeQL high-severity findings#154
solomon2773 merged 2 commits intomasterfrom
fix/codeql-high-followups

Conversation

@solomon2773
Copy link
Copy Markdown
Owner

Verified: 303/303 backend tests, 6/6 agent-runtime tests, eslint + prettier clean on all five files.

Summary

  • Describe the user-visible or maintainer-visible change.

Validation

  • List the commands, tests, or manual checks you ran.

Release And Docs Checklist

  • Updated public architecture docs (architecture.md) if this PR changes architecture, deployment topology, component responsibilities, or major data flow.
  • If this is a release-prep PR, updated the Reviewed for release: marker in architecture.md.

- agent-runtime/lib/server.ts:
  * Convert the OpenClaw chat fallback from execSync (shell template with
    JSON.stringify, not shell-safe) to execFileSync with an argv array so
    the request-body `content` cannot break out (CodeQL #1).
  * Document the /exec endpoint as the intentional terminal surface of the
    agent runtime — command execution there is by design and isolated by
    the container sandbox, not by the endpoint (CodeQL #2 acknowledged).
- workers/provisioner/backends/proxmox.ts: gate rejectUnauthorized behind
  PROXMOX_VERIFY_TLS=true so operators with CA trust wired up can opt in;
  default remains permissive for standard on-prem self-signed Proxmox
  (CodeQL #11).
- backend-api/routes/auth.ts: move email length check before the EMAIL_RE
  test so unbounded inputs can never drive regex backtracking cost
  (CodeQL #13).
- backend-api/agentMigrations.ts: split /^\/+|\/+$/g into two sequential
  anchored replaces; no behavior change, defuses the alternation CodeQL
  treats as polynomial (CodeQL #12).
- backend-api/routes/integrations.ts: fold e.message into the template
  literal instead of passing it as a separate console.warn argument, so
  the error text can't be interpreted as a format string (CodeQL #4, #5).

Verified: 303/303 backend tests, 6/6 agent-runtime tests, eslint + prettier
clean on all five files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread agent-runtime/lib/server.ts Fixed
Comment thread backend-api/agentMigrations.ts Fixed
Two new alerts surfaced when CodeQL re-analyzed the followup branch:

1. Critical SSRF on agent-runtime/lib/server.ts:427 — the body.channelId
   interpolation still reaches fetch() without encoding on this branch
   because the encodeURIComponent fix lived only on fix/codeql-critical-
   ssrf. Bring that same fix into this branch so either PR can land
   independently without leaving a window where channelId reaches fetch
   raw. (Both PRs produce the same edits here; git will no-op on whichever
   merges second.)

2. High polynomial-regex on backend-api/agentMigrations.ts:340 — even
   after splitting the alternation, CodeQL still flags /\/+$/ over a
   value whose provenance it cannot prove bounded. Replace the regex
   with explicit charCodeAt-based trimming of leading/trailing U+002F —
   strictly linear, no regex engine involved, same observable behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@solomon2773 solomon2773 merged commit 9ac91f3 into master Apr 23, 2026
43 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.

3 participants