- Add require_scope() calls to all 54 RPC handlers (data_service + credit_class_service)
- Fix connection pool exhaustion: replace conn.close() with factory.release()
- Add configurable TLS via GRPC_TLS_CERT/GRPC_TLS_KEY env vars
- Fix health Watch to keep stream open with periodic updates
- Add 26 tests covering scope enforcement, pool resilience, TLS config
Summary
Hardens gRPC service security across three critical areas:
1. Connection Pool Fix (CRITICAL)
conn.close()calls withfactory.release(conn)to return connections to the poolconn.close()calls replaced across auth interceptor, data_service, and credit_class_service2. Scope Enforcement
require_scope()calls to all 54 RPC handlers3. TLS Support
GRPC_TLS_CERTandGRPC_TLS_KEYenv vars4. Health Watch Fix
Tests
26 tests covering scope enforcement, pool resilience, TLS configuration, and health watch behavior.