Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

feat: add API-key-gated WebSocket support#122

Open
prd-carapulse[bot] wants to merge 5 commits into
morpho-mainfrom
hermes/wss-api-key-access
Open

feat: add API-key-gated WebSocket support#122
prd-carapulse[bot] wants to merge 5 commits into
morpho-mainfrom
hermes/wss-api-key-access

Conversation

@prd-carapulse

@prd-carapulse prd-carapulse Bot commented Jul 21, 2026

Copy link
Copy Markdown

Adds opt-in WebSocket transport to eRPC.

  • gates upgrades per auth strategy with allowWebsocket: true; HTTP-only API keys stay denied
  • validates every text frame and JSON-RPC batch; reapplies project/auth method filters and rate limits per method
  • rejects binary/malformed frames and database-auth fail-open sessions
  • adds validated/redacted per-upstream websocketEndpoint
  • selects eligible eth_subscribe upstreams in policy order and fails over on bounded dial failures
  • bypasses HTTP buffering safely, clears HTTP deadlines, owns connection contexts, and closes hijacked sockets during shutdown
  • bounds per-user connections, idle time, dial time, frame size, and maximum lifetime
  • enforces configured browser origins

Validation:

  • TDD RED commit confirmed missing behavior
  • Go build and package tests
  • focused WebSocket bridge, method-boundary, batch, failover, route, CORS, and resource-limit tests
  • fallback config and Go module validation
  • security and TypeScript config jobs
  • Wiz SAST, secret, IaC, dependency, and data scans

Requested by: @DevAtom (Slack)

@prd-carapulse
prd-carapulse Bot marked this pull request as ready for review July 21, 2026 06:12
@prd-carapulse
prd-carapulse Bot requested a review from 0x666c6f as a code owner July 21, 2026 06:12

@claude claude Bot 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@prd-carapulse
prd-carapulse Bot marked this pull request as draft July 21, 2026 06:13
@prd-carapulse
prd-carapulse Bot marked this pull request as ready for review July 21, 2026 06:38
Comment thread erpc/projects.go
}

func (p *PreparedProject) SupportsMethod(method string) (bool, error) {
allowed := true

@aikido-pr-checks aikido-pr-checks Bot Jul 21, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SupportsMethod never blocks non-matching methods when AllowMethods is set alone; allowed starts true and is never turned false on allow-list misses.

Suggested change
allowed := true
allowed := len(p.Config.AllowMethods) == 0
Details

✨ AI Reasoning
​The new method appears to enforce project-level method filtering, but its control flow cannot deny methods when only an allow-list is configured. It starts in an allowed state, only toggles false inside ignore matches, and allow checks only ever set true. So a non-matching method still remains allowed, which contradicts the intended meaning of an allow-list gate.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant