Skip to content

Claude/harden openclaw security c hy hc - #44226

Closed
CMApex wants to merge 3 commits into
openclaw:mainfrom
CMApex:claude/harden-openclaw-security-cHyHc
Closed

CMApex wants to merge 3 commits into
openclaw:mainfrom
CMApex:claude/harden-openclaw-security-cHyHc

Conversation

@CMApex

@CMApex CMApex commented Mar 12, 2026

Copy link
Copy Markdown

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

claude added 2 commits March 12, 2026 16:11
- Replace execSync with execFileSync in cli-credentials.ts to prevent
  shell injection via CODEX_HOME or keychain service names. The account
  value (derived from an env var) was interpolated into a shell command
  string; now passed safely as an argv array element.

- Convert scripts/update-clawtributors.ts run() helper from execSync
  (shell string) to execFileSync (binary + args array). Inputs like
  seedCommit and rootCommit from JSON config / git output were
  interpolated directly into shell commands.

- Fix icacls call in audit.test.ts to use execFileSync, preventing
  path injection on Windows.

- Add X-Frame-Options: DENY to setDefaultSecurityHeaders() so all
  gateway HTTP responses deny framing by default (clickjacking
  protection). The control UI already set this; now it applies
  globally. Handlers that serve framed content can override.

https://claude.ai/code/session_01UZ2Bf7rHM151gogeybi3Fn
…dentity

- Add Content-Type validation to readJsonBodyOrError(): reject non-JSON
  Content-Type (e.g. application/x-www-form-urlencoded) with HTTP 415
  before body parsing. Missing Content-Type is still accepted for
  CLI/script backwards compat. Prevents cross-origin form submissions
  from being silently parsed as JSON.

- Replace OpenClaw README with VoltClaw README that documents the fork
  identity, security hardening changes, and project structure.

https://claude.ai/code/session_01UZ2Bf7rHM151gogeybi3Fn
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: L labels Mar 12, 2026
@greptile-apps

greptile-apps Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR applies genuine security hardening across three areas: replacing execSync (shell string interpolation) with execFileSync (argument arrays) in keychain credential reads and contributor scripts, adding X-Frame-Options: DENY to gateway HTTP responses to prevent clickjacking, and enforcing application/json Content-Type on JSON API endpoints with a 415 response for non-JSON requests. The execSync → execFileSync changes and the Content-Type enforcement are well-implemented and include test coverage.

Key issues found:

  • Breaking regression in canvas/A2UI framing: X-Frame-Options: DENY is now added in setDefaultSecurityHeaders, which is called for every request in server-http.ts before the request stage pipeline. Neither src/canvas-host/server.ts nor src/canvas-host/a2ui.ts override or remove this header. The original code explicitly omitted X-Frame-Options to avoid exactly this problem ("some handlers (canvas host, A2UI) serve content that may be loaded inside frames"). The PR's own comment acknowledges that canvas/A2UI handlers "should override or remove it after calling this function" — but they don't. This will break canvas content loaded in iframes.
  • Very large README rebranding: The entire README is replaced, renaming the project to "VoltClaw" and removing all original documentation, channel guides, configuration examples, badges, sponsors, and contributor content. This is an unusually large scope for a security hardening PR targeting the upstream openclaw/openclaw repository.

Confidence Score: 2/5

  • Not safe to merge as-is — the global X-Frame-Options: DENY header will break canvas and A2UI iframe functionality.
  • The execSync → execFileSync and Content-Type enforcement changes are correct and well-tested. However, setting X-Frame-Options: DENY in the shared setDefaultSecurityHeaders function — without updating the canvas-host handlers to remove it — is a breaking regression for an advertised core feature. The README change is also an unusually large and potentially unwanted scope change for the upstream repo.
  • src/gateway/http-common.ts and src/gateway/server-http.ts require attention for the X-Frame-Options regression; src/canvas-host/server.ts and src/canvas-host/a2ui.ts need corresponding header overrides that are missing from this PR.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/gateway/http-common.ts
Line: 8-20

Comment:
**Canvas/A2UI routes will break — `X-Frame-Options: DENY` is never overridden**

`setDefaultSecurityHeaders` is invoked once at the very top of `handleRequest` in `server-http.ts` (line 613) for **every** incoming request, including canvas and A2UI routes. The comment on lines 9–10 accurately describes the intent — "Handlers that intentionally serve framed content (canvas host, A2UI) should override or remove it after calling this function" — but neither `src/canvas-host/server.ts` nor `src/canvas-host/a2ui.ts` call `res.removeHeader("X-Frame-Options")` or `res.setHeader("X-Frame-Options", "SAMEORIGIN")` anywhere in their response paths. Because `setHeader` replaces and the canvas handlers never touch this header, all canvas/A2UI responses will carry `X-Frame-Options: DENY`, causing any browser that loads canvas content inside an `<iframe>` to block it.

The previous version of the comment explicitly explained why this header was _excluded_:
> "Headers that restrict framing or set a Content-Security-Policy are intentionally omitted here because some handlers (canvas host, A2UI) serve content that may be loaded inside frames."

This PR removes that safeguard without making the canvas/A2UI handlers exempt.

To fix this without breaking canvas functionality, the canvas and A2UI handlers need to remove or relax the header for their own responses, e.g. in `handleA2uiHttpRequest` and `canvasHost.handleHttpRequest`:

```ts
// In canvas/A2UI handlers, after setDefaultSecurityHeaders has already run:
res.removeHeader("X-Frame-Options");
```

Or, alternatively, scope `X-Frame-Options: DENY` only to non-canvas paths in `server-http.ts` rather than applying it globally.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: c6a3b74

Comment on lines +8 to +20
* X-Frame-Options defaults to DENY to prevent clickjacking on API/UI routes.
* Handlers that intentionally serve framed content (canvas host, A2UI) should
* override or remove it after calling this function.
*
* Content-Security-Policy is intentionally omitted because framing policy
* differs per handler; the control UI sets its own strict CSP.
*/
export function setDefaultSecurityHeaders(
res: ServerResponse,
opts?: { strictTransportSecurity?: string },
) {
res.setHeader("X-Content-Type-Options", "nosniff");
res.setHeader("X-Frame-Options", "DENY");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canvas/A2UI routes will break — X-Frame-Options: DENY is never overridden

setDefaultSecurityHeaders is invoked once at the very top of handleRequest in server-http.ts (line 613) for every incoming request, including canvas and A2UI routes. The comment on lines 9–10 accurately describes the intent — "Handlers that intentionally serve framed content (canvas host, A2UI) should override or remove it after calling this function" — but neither src/canvas-host/server.ts nor src/canvas-host/a2ui.ts call res.removeHeader("X-Frame-Options") or res.setHeader("X-Frame-Options", "SAMEORIGIN") anywhere in their response paths. Because setHeader replaces and the canvas handlers never touch this header, all canvas/A2UI responses will carry X-Frame-Options: DENY, causing any browser that loads canvas content inside an <iframe> to block it.

The previous version of the comment explicitly explained why this header was excluded:

"Headers that restrict framing or set a Content-Security-Policy are intentionally omitted here because some handlers (canvas host, A2UI) serve content that may be loaded inside frames."

This PR removes that safeguard without making the canvas/A2UI handlers exempt.

To fix this without breaking canvas functionality, the canvas and A2UI handlers need to remove or relax the header for their own responses, e.g. in handleA2uiHttpRequest and canvasHost.handleHttpRequest:

// In canvas/A2UI handlers, after setDefaultSecurityHeaders has already run:
res.removeHeader("X-Frame-Options");

Or, alternatively, scope X-Frame-Options: DENY only to non-canvas paths in server-http.ts rather than applying it globally.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/http-common.ts
Line: 8-20

Comment:
**Canvas/A2UI routes will break — `X-Frame-Options: DENY` is never overridden**

`setDefaultSecurityHeaders` is invoked once at the very top of `handleRequest` in `server-http.ts` (line 613) for **every** incoming request, including canvas and A2UI routes. The comment on lines 9–10 accurately describes the intent — "Handlers that intentionally serve framed content (canvas host, A2UI) should override or remove it after calling this function" — but neither `src/canvas-host/server.ts` nor `src/canvas-host/a2ui.ts` call `res.removeHeader("X-Frame-Options")` or `res.setHeader("X-Frame-Options", "SAMEORIGIN")` anywhere in their response paths. Because `setHeader` replaces and the canvas handlers never touch this header, all canvas/A2UI responses will carry `X-Frame-Options: DENY`, causing any browser that loads canvas content inside an `<iframe>` to block it.

The previous version of the comment explicitly explained why this header was _excluded_:
> "Headers that restrict framing or set a Content-Security-Policy are intentionally omitted here because some handlers (canvas host, A2UI) serve content that may be loaded inside frames."

This PR removes that safeguard without making the canvas/A2UI handlers exempt.

To fix this without breaking canvas functionality, the canvas and A2UI handlers need to remove or relax the header for their own responses, e.g. in `handleA2uiHttpRequest` and `canvasHost.handleHttpRequest`:

```ts
// In canvas/A2UI handlers, after setDefaultSecurityHeaders has already run:
res.removeHeader("X-Frame-Options");
```

Or, alternatively, scope `X-Frame-Options: DENY` only to non-canvas paths in `server-http.ts` rather than applying it globally.

How can I resolve this? If you propose a fix, please make it concise.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4e8408bb4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

opts?: { strictTransportSecurity?: string },
) {
res.setHeader("X-Content-Type-Options", "nosniff");
res.setHeader("X-Frame-Options", "DENY");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve frame access for canvas and A2UI responses

Adding X-Frame-Options: DENY in the shared default headers path applies to every HTTP request (the gateway sets defaults before routing), including /__openclaw__/a2ui/* and canvas-host responses, but those handlers do not clear/override the header. That causes browsers to block iframe embedding for these routes, which regresses framed canvas/A2UI integrations that previously worked.

Useful? React with 👍 / 👎.

Comment thread README.md
@@ -1,559 +1,81 @@
# 🦞 OpenClaw — Personal AI Assistant
# VoltClaw

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep README clawtributors marker block present

This README rewrite removes the <p align="left">...</p> clawtributors section that scripts/update-clawtributors.ts still requires (indexOf('<p align="left">') and throws when absent), so the contributor update workflow now fails against the new README format. If the new format is intentional, the script needs to be updated in the same change.

Useful? React with 👍 / 👎.

@katoue

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants