Skip to content

fix(cloud): require explicit intent header for connect endpoint#77

Merged
hyperb1iss merged 2 commits into
mainfrom
codex/fix-cloud-daemon-socket-csrf-vulnerability
May 19, 2026
Merged

fix(cloud): require explicit intent header for connect endpoint#77
hyperb1iss merged 2 commits into
mainfrom
codex/fix-cloud-daemon-socket-csrf-vulnerability

Conversation

@hyperb1iss
Copy link
Copy Markdown
Owner

Motivation

  • Prevent a CSRF-style vector where a no-body POST to POST /api/v1/cloud/connection/connect could be triggered from a cross-origin web page and start a persistent cloud socket in unsecured (no API key) loopback deployments.

Description

  • Require a non-simple intent header x-hypercolor-connect-intent: manual on the connect handler before any state-changing cloud connect logic runs, returning 400 Bad Request if missing (added in crates/hypercolor-daemon/src/api/cloud.rs).
  • Add a reusable CLI HTTP helper DaemonClient::post_with_headers to send extra headers from the client (crates/hypercolor-cli/src/client.rs).
  • Update the hypercolor cloud connection --connect command to send the required intent header (crates/hypercolor-cli/src/commands/cloud.rs).
  • Update and add tests to assert the new request shape and guard: the CLI request-shape test now verifies the header is sent and the daemon API tests cover both the required header and missing-header rejection (crates/hypercolor-cli/tests/request_shape_tests.rs, crates/hypercolor-daemon/tests/cloud_api_tests.rs).

Testing

  • Added new/updated unit/integration tests for the CLI request shape and daemon connect endpoint and exercised them locally via the repository test targets in this environment; test code changes are present in the repo and targeted runs were attempted (cloud_api_tests and request_shape_tests).
  • Attempted cargo test -p hypercolor-daemon --test cloud_api_tests (targeted connect tests) and compilation started, but the full run did not complete within this environment due to long compile time / artifact lock contention, so no final pass/fail could be observed here.
  • Attempted cargo test -p hypercolor-cli --test request_shape_tests and the run was blocked on artifact directory lock contention, so the test outcome could not be observed in this environment.

Codex Task

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@hyperb1iss has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 42 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ab0707b9-96fe-486d-aab1-60fd9e41d733

📥 Commits

Reviewing files that changed from the base of the PR and between e8f4a72 and 7e61e60.

📒 Files selected for processing (5)
  • crates/hypercolor-cli/src/client.rs
  • crates/hypercolor-cli/src/commands/cloud.rs
  • crates/hypercolor-cli/tests/request_shape_tests.rs
  • crates/hypercolor-daemon/src/api/cloud.rs
  • crates/hypercolor-daemon/tests/cloud_api_tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-cloud-daemon-socket-csrf-vulnerability

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

hyperb1iss and others added 2 commits May 19, 2026 02:01
The connect tests built a full daemon AppState via the process-global
data-dir override, racing parallel tests on the shared asset index.
Each test now builds state with an explicit, owned temp data dir.
@hyperb1iss hyperb1iss force-pushed the codex/fix-cloud-daemon-socket-csrf-vulnerability branch from d7f2756 to 7e61e60 Compare May 19, 2026 09:06
@hyperb1iss hyperb1iss merged commit 706b497 into main May 19, 2026
@hyperb1iss hyperb1iss deleted the codex/fix-cloud-daemon-socket-csrf-vulnerability branch May 19, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant