Skip to content

feat: path /secret auth + forwardedClientId + WS event metrics - #20

Open
snowkide wants to merge 5 commits into
feat/websocket-supportfrom
feat/forwarded-client-id-metrics
Open

feat: path /secret auth + forwardedClientId + WS event metrics#20
snowkide wants to merge 5 commits into
feat/websocket-supportfrom
feat/forwarded-client-id-metrics

Conversation

@snowkide

@snowkide snowkide commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • forwardedClientId strategy for gateway-injected X-Client-Id (Envoy apiKeyAuth mode).
  • Path /<secret> and apikey query/header aliases remain available but CLL .com uses Envoy ?apikey= + forwardedClientId.
  • WS subscription event counters labeled with network alias.

Test plan

  • go test ./auth/
  • Publish image to GHCR

Add AuthTypeForwardedClientId so a trusted gateway-injected X-Client-Id
(Envoy apiKeyAuth.forwardClientIDHeader) becomes User.Id for per-client
Prometheus labels. Emit erpc_ws_subscription_events_total (and dropped)
on client notification write/overflow for third-party RPC observability.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
File Lines Key changes Risk
🟠 strategy_forwarded_client_id.go +40/-0 ForwardedClientIdStrategy, NewForwardedClientIdStrategy, Supports, ... ⚠ ErrAuthUnauthorized
🟠 authorizer.go +5/-0 ⚠ ErrInvalidConfig
🟠 strategy_secret.go +9/-0 ⚠ ErrAuthUnauthorized
🔵 adapter.go +50/-2 SubscriptionLabels, AddSubscription, subscriptionNetworkLabel, ...
🔵 http.go +57/-1 NewPayloadFromHttp, singlePathSegmentSecret, firstNonEmptyHeader
🔵 config.go +27/-11 ForwardedClientIdStrategyConfig, ForwardedClientIdStrategyConfig
🔵 request.go +25/-0 SetTransport, Transport
🔵 payload.go +12/-5 ForwardedClientIdPayload
🔵 defaults.go +17/-0 SetDefaults
🔵 validation.go +22/-1 Validate
2 test files +105

xray — see through AI slop with deterministic architecture PR diff reviews

snowkide and others added 2 commits August 5, 2026 12:12
Use Network.Label() (alias when set) on ws_subscription_events_* so
metrics match HTTP counters without a PromQL chain-id map.

Co-authored-by: Cursor <cursoragent@cursor.com>
…dge Lua

Domain-aliased hosts can keep a single path segment as the secret so
clients use https://host/<KEY> without Envoy Lua/WASM path extractors.

Co-authored-by: Cursor <cursoragent@cursor.com>
@snowkide snowkide changed the title feat: forwardedClientId auth + WS subscription event metrics feat: path /secret auth + forwardedClientId + WS event metrics Aug 5, 2026
snowkide and others added 2 commits August 6, 2026 10:05
Reject empty secrets, require secret.id, cover path reserved segments,
and dedupe subscription event counter increments.

Co-authored-by: Cursor <cursoragent@cursor.com>
CLL rpc_ws_event_count_total must count JSON-RPC calls over WebSocket,
not subscription push notifications. Mark WS ingress on NormalizedRequest
and expose transport on erpc_network_request_received_total.

Co-authored-by: Cursor <cursoragent@cursor.com>
@snowkide

snowkide commented Aug 7, 2026

Copy link
Copy Markdown
Author

Follow-up: transport label for CLL rpc_ws_event_count_total

CLL sheet defines rpc_ws_event_count_total as RPC calls via WSS, not subscription pushes.

This branch now:

  • sets NormalizedRequest.transport = "ws" on WebSocket ingress
  • adds transport (http|ws) on erpc_network_request_received_total

Infra PR will remap recording rules:

  • rpc_http_requests_totaltransport!="ws"
  • rpc_ws_event_count_totaltransport="ws"

erpc_ws_subscription_events_total stays as an internal ops metric for push notifications.

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.

1 participant