Skip to content

fix(light/proxy)!: require configured WebSocket origins - #1453

Merged
lklimek merged 2 commits into
v1.8-devfrom
fix/light-proxy-origin-policy
Sep 11, 2026
Merged

lklimek merged 2 commits into
v1.8-devfrom
fix/light-proxy-origin-policy

Conversation

@lklimek

@lklimek lklimek commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

TL;DR: Browser connections to the light proxy now require an explicitly permitted origin. Non-browser clients remain supported.

User story

As a node operator, I want to choose which websites can connect to my light proxy.

Scenario

The light proxy currently accepts WebSocket connections from any website. After this change, browser origins must match the configured list, including same-host origins. Clients without an Origin header continue to work.

Detailed discussion

Issue being fixed or feature implemented

Extracts the useful WebSocket-origin restriction from closed PR #1382 into a standalone change based on current v1.8-dev. PR #1343 introduced the shared origin checker but deliberately retained allow-all behavior for the light proxy. No other open PR covering this fix was found.

What was done?

  • Added an allow-list-only variant of the shared origin checker, reusing existing case-insensitive exact and wildcard matching. The existing checker keeps its same-host behavior for other RPC consumers.
  • Applied the strict variant to both light-proxy serving modes and wired rpc.cors-allowed-origins through the CLI.
  • An empty list rejects Origin-bearing requests, including same-host origins. Origin-less clients remain supported; * is an explicit operator opt-in to allow all.
  • Added policy tests and local WebSocket integration tests, plus configuration guidance and a 1.8.0 changelog entry.

This change does not provide authentication or authorization. It changes no light-client witness policy or consensus threshold behavior.

How Has This Been Tested?

  • make test PACKAGES='./rpc/jsonrpc/server ./light/proxy ./cmd/tenderdash/commands': passed, with CGO and -tags deadlock as supplied by the Makefile.
  • make lint LINT_BASE=origin/v1.8-dev: passed, zero issues.
  • gofmt and git diff --check: passed.
  • Local validation used existing native BLS libraries via BLS_DIR=/home/ubuntu/git/tenderdash/third_party/bls-signatures and a writable Go build cache. Full logs are retained locally.

Breaking Changes

Browser WebSocket clients must configure their origin in rpc.cors-allowed-origins, including browsers served from the proxy host. Applications constructing Proxy directly can set AllowedOrigins before serving. An explicit * restores the previous allow-all policy but removes the origin restriction. Origin-less clients are unaffected.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Co-authored by Claudius the Magnificent AI Agent

Preserve Origin-less clients and reuse RPC origin matching without implicit same-host trust for the light proxy.

Co-authored-by: Codex <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: e171e236-eacb-48fe-9170-47bea47f3a8f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@lklimek
lklimek marked this pull request as ready for review September 10, 2026 08:23
@thepastaclaw

thepastaclaw commented Sep 10, 2026 •

Copy link
Copy Markdown

🕓 Queued for automated review — 14th in line, estimated start in ~2.6 h (commit cde8567)
Estimated review time once started: ~25 min (two-phase automated review; median of recent runs).

  • Request priority review — tick this box and the review moves to the front of the queue.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Final validation — Phase 2 only (queue backlog)

Reviewed the complete assigned range for the configured WebSocket-origin restriction in both light-proxy serving modes. The implementation and associated tests correctly enforce the explicit allow-list for Origin-bearing browser connections while preserving Origin-less clients and existing RPC origin behavior; no in-scope defects were found.

Source: reviewer 1: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)

Review provenance

  • Triage: critical by gpt-6-astra (effort low) — This is a security-sensitive networking change that alters browser access control for light-proxy WebSocket endpoints across multiple serving modes, where origin-validation bugs could expose operators to cross-site access despite the implementation being relatively contained.
  • Phase 1 reviewers: not run (skipped for throughput: 18 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6-astra — final-verifier; agent astra-verifier
  • Phase 2 reviewers: gpt-6-astra — general (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — tenderdash-consensus-security (completed, effort xhigh); agent phase2-reviewer

Retain both the light-proxy origin policy and committed-block recovery
entries in the 1.8.0 changelog.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@lklimek
lklimek enabled auto-merge (squash) September 11, 2026 07:04
@lklimek
lklimek merged commit f88b65e into v1.8-dev Sep 11, 2026
21 checks passed
@lklimek
lklimek deleted the fix/light-proxy-origin-policy branch September 11, 2026 07:30
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.

2 participants