[AAASM-3685] 🔒 (transport): Require TLS for non-loopback gateway/op-control#181
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…k host Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
🔎 Claude Code review — fix-waveCI: All functional checks green (unit/integration 3.13, CodeQL, pip-audit, CI Success, codecov/patch). Only SonarCloud Code Analysis red — acceptance/quality-gate, out of scope, ignored. |
… tests Convert the five TestHttpTransportSecurity cases from a client = GatewayClient(...) / try: ... / finally: client.close() pattern to a with GatewayClient(...) as client: block, so cleanup runs via __exit__. Resolves the CodeQL 'Should use a with statement' review findings; assertions and pytest.raises checks unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Security review dispositions (SonarCloud + CodeQL)SonarCloud Security Hotspots — 2 (both
|
…essage Reword the require_secure_http_url ValueError to describe the plaintext (non-TLS) connection without the literal http:// scheme token, clearing two python:S5332 SonarCloud hotspots on new code. No behavior change; the diagnostic still names the Bearer credential, non-loopback host, https:// remedy, and allow_insecure opt-in. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
SonarCloud gate green — S5332 false positives resolvedThe only red check was SonarCloud Code Analysis: 2 These were false positives: the function constructs no URL and makes no network call. It is the guard that refuses to send a Bearer credential over plaintext to a non-loopback host; the Fix (no behavior change): reworded the
The diagnostic still names the Bearer credential, the non-loopback host, the Validation: full suite Final CI: SonarCloud Code Analysis ✅ pass, CI Success ✅ pass, 0 failing checks. — Claude Code, 2026-06-25 |



Description
Hardens both SDK→gateway transports against sending sensitive material over plaintext to a remote host. Adds a shared loopback/scheme validator (
agent_assembly/core/transport_security.py) reused by both paths (mirrors node-sdk AAASM-3123):OpControlSubscriber.connectpreviously openedgrpc.insecure_channelunconditionally. It now refuses a plaintext channel to a non-loopback gateway unless the caller passes achannel_factory(e.g. a TLS channel) or the newallow_insecure=Trueopt-in. Loopback (localhost/127.0.0.1/::1) stays plaintext for local dev.GatewayClientsentAuthorization: Bearer <api_key>over plaintexthttp://with no scheme guard. It now refuses, when an API key is set, to send the Bearer header overhttp://to a non-loopback host unlessallow_insecure=True.https://and loopback always pass.init_assemblyadditionally emits a resolution-time warning for the same condition.Secure-by-default; loopback dev and explicit opt-in preserved.
Type of Change
Breaking Changes
Connecting to a non-loopback gateway over plaintext (insecure gRPC, or
http://with an API key set) now raisesValueErrorunless the caller passes a TLSchannel_factory/allow_insecure=True. Loopback andhttps://are unaffected. This is intentional secure-by-default behavior.Related Issues
Testing
uv syncthenpytest test/— 713 passed, 16 skipped (env-gated).mypy agent_assemblyclean for changed files (4 pre-existing_core/grpc-stub errors unchanged from master). New tests cover: insecure gRPC to non-loopback rejected, loopback/opt-in allowed; Bearer-over-http non-loopback rejected, loopback/https allowed, control-plane-url is the validated target; resolution warning fires (and is silent for loopback). One pre-existing header test updated to opt in viaallow_insecure=True.Checklist
🤖 Generated with Claude Code