fix: address MEDIUM review findings (light witness resilience, proxy CORS, threshold warning) - #1382
Draft
lklimek wants to merge 3 commits into
Draft
fix: address MEDIUM review findings (light witness resilience, proxy CORS, threshold warning)#1382lklimek wants to merge 3 commits into
lklimek wants to merge 3 commits into
Conversation
…he client Previously any single witness returning a first/new header that disagreed with the primary would abort the light client with ErrConflictingWitnessHeader, letting one faulty or partitioned witness break liveness for the whole client. Now a single conflicting witness (with at least one corroborating witness) is removed from the trusted set, while two or more conflicting witnesses, or a conflict with no corroboration, still fail closed. This prevents one bad witness from taking down the client while preserving safety against genuine forks. Co-Authored-By: Claudius the Magnificent <noreply@anthropic.com>
…trust)
The light proxy previously accepted WebSocket connections from any origin
(func(*http.Request) bool { return true }), allowing cross-site clients to
subscribe to consensus/block streams.
The proxy now uses rpcserver.OriginChecker against the configured
rpc.cors-allowed-origins list, defaulting to an empty list (reject all) for a
zero-trust posture. Operators opt in by setting cors-allowed-origins in config.
Co-Authored-By: Claudius the Magnificent <noreply@anthropic.com>
…2/3+1 When validators.BelowStrictThreshold() is true the node can no longer guarantee safety, yet previously continued silently. The state machine now logs an explicit "OVERRIDE ENABLED - NOT SAFE FOR PRODUCTION" error so operators are aware they are running an unsafe override. Also documents the behavior change and that cors-allowed-origins governs the light proxy. Co-Authored-By: Claudius the Magnificent <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this PR exists
ErrConflictingWitnessHeader), breaking liveness for honest users; (2) the light proxy accepts WebSocket connections from any origin, enabling cross-site subscription to consensus streams; (3) running below the 2/3+1 voting-power threshold proceeds silently with no operator warning that safety is no longer guaranteed.v1.6-dev.Issue being fixed or feature implemented
Addresses three review findings:
voting_power_thresholddrops below 2/3+1.What was done?
light/client.go: single conflicting witness (with ≥1 corroborating) is removed from the trusted set; ≥2 conflicting witnesses, or a conflict with zero corroboration, still fail closed.light/proxy/proxy.go: replaced the permissivefunc(*http.Request) bool { return true }origin check withrpcserver.OriginCheckerover a newAllowedOriginsfield (zero-trust default: empty list rejects all).cmd/tenderdash/commands/light.gowiresconf.RPC.CORSAllowedOriginsinto the proxy.internal/consensus/state_data.go: logs an explicitOVERRIDE ENABLED - NOT SAFE FOR PRODUCTIONerror whenvalidators.BelowStrictThreshold()is true.CHANGELOG.md+docs/nodes/configuration.md: document the behavior changes.How Has This Been Tested?
gofmtclean on all changed files.go vet ./light/ ./light/proxy/ ./internal/consensus/clean (BLS native deps built viamake build-bls).go test ./light/passes (13.4s), including updatedTestCompareFirstHeaderWithWitness*cases: single conflicting witness → removed (no error), two conflicting → fail, single conflicting with no corroboration → fail.go build ./light/proxy/ ./cmd/tenderdash/commands/succeeds.Breaking Changes
None in the Go API. Behavioral: the light proxy now rejects WebSocket connections from unconfigured origins by default (previously accepted all). Operators relying on the open behavior must set
rpc.cors-allowed-origins.Checklist:
🤖 Co-authored by Claudius the Magnificent AI Agent