Skip to content

lint: classify raw socket callsites#77126

Merged
jesse-merhi merged 8 commits into
mainfrom
raw-socket-guardrails
May 7, 2026
Merged

lint: classify raw socket callsites#77126
jesse-merhi merged 8 commits into
mainfrom
raw-socket-guardrails

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented May 4, 2026

Copy link
Copy Markdown
Member

Summary

  • add lint:tmp:raw-socket-classification boundary guard requiring raw net.connect, tls.connect, and http2.connect callsites to be classified before landing, with rationale comments for current allowlisted callsites (local IPC/probes, APNs HTTP/2 wrapper, managed CONNECT tunnel helper, debug proxy internals, QA lab diagnostics, IRC)
  • add lint:tmp:managed-proxy-runtime-mutation boundary guard requiring direct mutation of process.env proxy keys and global/globalThis.GLOBAL_AGENT to live in the canonical proxy-lifecycle owner, with a narrow allowlist for the proxy lifecycle and the browser CDP loopback bypass helper
  • wire lint:tmp:no-raw-http2-imports and lint:tmp:managed-proxy-runtime-mutation into the additional boundary checks pipeline
  • document proxy.loopbackMode (gateway-only default, proxy, block), the --apns-reachable validation probe, and a managed-proxy coverage/status table in docs/security/network-proxy.md

Test Plan

  • OPENCLAW_LOCAL_CHECK=0 pnpm test test/scripts/check-raw-socket-callsite-classification.test.ts test/scripts/check-managed-proxy-runtime-mutation.test.ts test/scripts/run-additional-boundary-checks.test.ts
  • pnpm lint:tmp:raw-socket-classification
  • pnpm lint:tmp:managed-proxy-runtime-mutation
  • pnpm lint:tmp:no-raw-http2-imports
  • pnpm format:check scripts/check-raw-socket-callsite-classification.mjs scripts/check-managed-proxy-runtime-mutation.mjs test/scripts/check-raw-socket-callsite-classification.test.ts test/scripts/check-managed-proxy-runtime-mutation.test.ts test/scripts/run-additional-boundary-checks.test.ts scripts/run-additional-boundary-checks.mjs package.json docs/security/network-proxy.md
  • OPENCLAW_LOCAL_CHECK=0 pnpm check:changed

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: S maintainer Maintainer-authored PR labels May 4, 2026
@clawsweeper

clawsweeper Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

Summary
The branch adds a CodeQL network-runtime-boundary shard with raw socket and managed proxy mutation queries, plus managed-proxy docs and changelog updates.

Reproducibility: not applicable. This PR adds CI guardrails and documentation, not a runtime bug. The exact-head Critical Quality (network-runtime-boundary) check passed, verifying the new CodeQL shard compiles and runs.

Real behavior proof
Not applicable: Not applicable because this is a MEMBER-authored maintainer PR, so the external-contributor real behavior proof gate does not apply.

Next step before merge
Automerge is requested, but secops-owned files and the non-narrow macos-swift failure need maintainer disposition; there is no clear ClawSweeper repair target.

Security
Cleared: The diff is security-sensitive, but it uses pinned official checkout/CodeQL actions, narrow existing workflow permissions, local queries, and pinned CodeQL pack dependencies without a concrete supply-chain regression.

Review details

Best possible solution:

Land the additive CodeQL guardrail after secops/CODEOWNERS review and exact-head CI disposition, keeping the proxy docs and changelog aligned.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds CI guardrails and documentation, not a runtime bug. The exact-head Critical Quality (network-runtime-boundary) check passed, verifying the new CodeQL shard compiles and runs.

Is this the best way to solve the issue?

Yes: an additive CodeQL Critical Quality shard is a maintainable place for this policy, and the docs describe the managed-proxy coverage boundary. The remaining decision is maintainer/secops approval plus CI disposition, not a code repair from this review.

What I checked:

Likely related people:

  • @vincentkoc: Recent history shows repeated additions and expansion of CodeQL Critical Quality shards that this PR extends. (role: CodeQL critical-quality workflow maintainer; confidence: high; commits: 02597caa8bff, 6308d2a1dcd4, 423f6df5b1de; files: .github/workflows/codeql-critical-quality.yml, .github/codeql)
  • @jesse-merhi: Prior merged work added operator-managed proxy routing, APNs HTTP/2 proxy handling, and recent managed-proxy docs that this guardrail classifies. (role: managed proxy and APNs runtime owner; confidence: high; commits: 2633b1491413, d5b0083300a6, 5b00cd1ae12a; files: src/infra/net/proxy/proxy-lifecycle.ts, src/infra/push-apns-http2.ts, src/infra/net/http-connect-tunnel.ts)
  • @steipete: CODEOWNERS protects the touched CodeQL workflow, query directory, and security docs under secops review, and recent commits touched CodeQL/proxy-adjacent policy. (role: secops and proxy-adjacent maintainer; confidence: medium; commits: 9dd5014cf38c, bdcd543ed78a, b113d92c6fda; files: .github/CODEOWNERS, .github/workflows/codeql-critical-quality.yml, docs/security/network-proxy.md)

Remaining risk / open question:

  • Exact-head CI still shows macos-swift failing with only generic exit-code annotations, so a maintainer needs to decide whether it is unrelated before merge.
  • The diff is intentionally security-sensitive and touches secops-owned CodeQL workflow/query and security-doc surfaces, so CODEOWNERS/secops review remains the merge gate.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 8e88c7b29768.

@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch from afd320e to 3cbe918 Compare May 4, 2026 05:47
@clawsweeper clawsweeper Bot mentioned this pull request May 4, 2026
7 tasks
@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch from 3cbe918 to 57168ce Compare May 6, 2026 05:12
@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch 2 times, most recently from 0166811 to 40d0c4c Compare May 6, 2026 07:14
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch from 40d0c4c to 2355b49 Compare May 6, 2026 08:01
@clawsweeper

clawsweeper Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch from 2355b49 to c4ff121 Compare May 6, 2026 09:34
@clawsweeper

clawsweeper Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch from c4ff121 to 9a880ee Compare May 6, 2026 09:54
@clawsweeper

clawsweeper Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch from 9a880ee to 9416bda Compare May 6, 2026 10:47
@clawsweeper

clawsweeper Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the security Security documentation label May 7, 2026
@jesse-merhi jesse-merhi self-assigned this May 7, 2026

Copilot AI 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.

Pull request overview

This PR tightens the project’s network security posture by introducing CodeQL-based “boundary guard” checks that prevent new unclassified raw-socket egress and unmanaged proxy-runtime state mutations from landing without explicit review, and documents managed-proxy coverage/behavior for operators.

Changes:

  • Add new CodeQL boundary queries to (1) require classification of raw net/tls/http2 client connect callsites and (2) restrict proxy-related process.env and GLOBAL_AGENT mutations to approved owner scopes.
  • Wire a new network-runtime-boundary shard into the “CodeQL Critical Quality” workflow and add a dedicated CodeQL config for these network boundary checks.
  • Update proxy security docs with a managed-proxy coverage/status table and add a changelog entry describing the new boundary checks.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/security/network-proxy.md Adds a managed proxy coverage/status table documenting which traffic surfaces are proxied vs raw/direct.
CHANGELOG.md Records the managed proxy/security boundary-check additions.
.github/workflows/codeql-critical-quality.yml Introduces a new network-runtime-boundary shard/job and expands PR path triggers for network boundary checks.
.github/codeql/openclaw-boundary/queries/raw-socket-callsite-classification.ql New CodeQL query enforcing classification/allowlisting of raw socket connect callsites.
.github/codeql/openclaw-boundary/queries/managed-proxy-runtime-mutation.ql New CodeQL query enforcing owner-scope restrictions for proxy-related runtime mutations.
.github/codeql/openclaw-boundary/qlpack.yml Adds a local CodeQL pack definition for the boundary queries.
.github/codeql/openclaw-boundary/codeql-pack.lock.yml Adds the dependency lockfile for the local CodeQL pack.
.github/codeql/codeql-network-runtime-boundary-critical-quality.yml Adds a dedicated CodeQL config that runs the new network boundary queries over src and extensions.

Comment thread CHANGELOG.md Outdated
Comment on lines 454 to 457
- Managed proxy/security: classify raw socket callsites and proxy runtime mutations in boundary checks so new direct egress or unmanaged proxy-state changes cannot land without explicit review. (#77126) Thanks @jesse-merhi.



@clawsweeper

clawsweeper Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@jesse-merhi jesse-merhi force-pushed the raw-socket-guardrails branch from f8d974b to aabeb29 Compare May 7, 2026 07:22
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@clawsweeper

clawsweeper Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

1 similar comment
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 7, 2026
@clawsweeper

clawsweeper Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper 🐠 automerge status

ClawSweeper finished this automerge repair pass without changing the branch.

Executor outcome: no planned fix actions.
Worker summary: Prepared non-mutating classification only. The sole hydrated item, this PR, is already closed as merged, so no repair, close, merge, comment, or label action is valid from this worker run.

Worker actions:

  • keep_closed on this PR: skipped - this PR is the canonical PR for this one-item automerge cluster, but it is already closed as merged. The only idempotent result is to keep it closed and emit no mutating repair path.

Nothing moved downstream from this pass: no branch update, replacement PR, merge, or re-review.

fish notes: model gpt-5.5, reasoning high.

Automerge progress:

  • 2026-05-07 12:44:51 UTC review queued b64d78065508 (queued)
  • 2026-05-07 14:52:45 UTC review queued b64d78065508 (queued)
  • 2026-05-07 15:00:18 UTC review passed b64d78065508 (structured ClawSweeper verdict: pass (sha=b64d78065508117287e4bdf338089db3c4a26...)

@clawsweeper clawsweeper Bot added the clawsweeper:human-review Needs maintainer review before ClawSweeper can continue label May 7, 2026
@clawsweeper

clawsweeper Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🦞✅
ClawSweeper is pausing this repair loop for human review.

Source: clawsweeper[bot]
Reason: Maintainers should complete secops/CODEOWNERS review and decide whether the failing macos-swift check is unrelated; there is no narrow ClawSweeper repair target.; Cleared: The diff is security-sensitive, but it uses pinned official CodeQL/checkout actions, narrow existing permissions, and local query files without adding a concrete supply-chain regression. (sha=b64d78065508117287e4bdf338089db3c4a26ff4)

I added clawsweeper:human-review and left the final call with a maintainer.

@jesse-merhi jesse-merhi removed the clawsweeper:human-review Needs maintainer review before ClawSweeper can continue label May 7, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper automerge

@jesse-merhi jesse-merhi merged commit 95a1c91 into main May 7, 2026
121 of 122 checks passed
@jesse-merhi jesse-merhi deleted the raw-socket-guardrails branch May 7, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge docs Improvements or additions to documentation maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants