fix: gRPC security hardening — scope enforcement, pool fix, TLS, health watch #74
Merged
wasabi opened 2 days ago

Summary

Hardens gRPC service security across three critical areas:

1. Connection Pool Fix (CRITICAL)

  • Replaced all conn.close() calls with factory.release(conn) to return connections to the pool
  • Fixed pool exhaustion bug: after 20 requests the server became unable to serve any new requests
  • 53 conn.close() calls replaced across auth interceptor, data_service, and credit_class_service

2. Scope Enforcement

  • Added require_scope() calls to all 54 RPC handlers
  • Read methods require read scopes, write methods require write scopes
  • Financial mutations (bridge, marketplace) require additional scope checks
  • Any valid API key now has fine-grained access control instead of god-mode

3. TLS Support

  • Configurable via GRPC_TLS_CERT and GRPC_TLS_KEY env vars
  • Falls back to insecure transport with warning when not configured

4. Health Watch Fix

  • Watch RPC now keeps stream open with periodic SERVING updates
  • Fixed violation of gRPC health protocol

Tests

26 tests covering scope enforcement, pool resilience, TLS configuration, and health watch behavior.

Commits were merged into target branch
1/1
Submitter wasabi
Target main
Source fix/grpc-security-hardening
Jobs
Merge Strategy
Create Merge Commit
Watchers (1)
Reference
pull request KI-74
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover