Skip to content

ws origin allowlist#1421

Open
pragmaxim wants to merge 1 commit intomasterfrom
enhancement-websocket-origin-check
Open

ws origin allowlist#1421
pragmaxim wants to merge 1 commit intomasterfrom
enhancement-websocket-origin-check

Conversation

@pragmaxim
Copy link
Contributor

  • Added optional WebSocket origin allowlist support with explicit logging, and documented the operator responsibility for securing origins when not using the proxy.

Testing

  • go test ./server -tags unittest -run 'TestCheckOrigin|TestParseAllowedOrigins|Test_PublicServer_EthereumType'

@greptile-apps
Copy link

greptile-apps bot commented Feb 16, 2026

Greptile Summary

Adds optional WebSocket origin allowlist validation via <COIN>_WS_ALLOWED_ORIGINS environment variable with case-insensitive normalization and explicit logging when disabled.

  • Origin validation with URL parsing and normalization (scheme + host only)
  • Comprehensive test coverage for allowlist parsing and validation logic
  • Clear documentation of operator responsibility when allowlist is not configured
  • Requests without Origin header bypass check (standard WebSocket behavior for non-browser clients)

Important Files Changed

Filename Overview
server/websocket.go Adds origin allowlist with proper normalization and validation; requests without Origin header bypass check
server/websocket_test.go Comprehensive tests for origin validation, normalization, and allowlist parsing

Last reviewed commit: 261b43c

Copy link
Member

@vdovhanych vdovhanych left a comment

Choose a reason for hiding this comment

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

Looks good!

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.

3 participants