feat(agw): new customer agents auth#187
Closed
NicoleMGomes wants to merge 6 commits into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds transparent TLS mode for customer agents running under the OpenShell Gateway. In this mode the gateway intercepts the HTTPS connection and injects the mTLS client certificate at the TLS layer, so the agent process never loads certificate or private key material. The agent only needs three environment variables (
CLIENT_ID,TOKEN_SERVICE_URL,GATEWAY_URL) instead of a full credentials file with embedded PEM strings.Changes:
config.py: newTlsModeenum (STANDARD/TRANSPARENT) andtls_modefield onClientConfig.ClientConfig.from_env()resolves the mode from theAGW_TLS_MODEenvironment variable._models.py:CustomerCredentials.certificateandprivate_keyare nowstr | None(both areNonein transparent mode)._customer.py:detect_customer_agent_credentials(tls_mode)skips file detection whentls_mode=TRANSPARENT.load_customer_credentials_from_env()— loads credentials from env vars for transparent mode._create_http_client_transparent()— createshttpx.Clientwithout an SSL context._request_token_transparent()— sends the OAuth2 POST body without touching certificates.get_system_token_transparent()andexchange_user_token_transparent()— caching-aware wrappers for the transparent token flows.agw_client.py: all four public methods (get_system_auth,get_user_auth,list_mcp_tools,call_mcp_tool) passtls_modeto credential detection and branch into the transparent path when needed.Type of Change
How to Test
Standard mode (existing behaviour — should be unchanged):
AGW_TLS_MODEenvironment variable is set.AGW_CREDENTIALS_PATH.create_client()→list_mcp_tools()should work exactly as before.Transparent mode (new):
AGW_TLS_MODE=transparentin the environment.CLIENT_ID,TOKEN_SERVICE_URL,GATEWAY_URL(and optionallyINTEGRATION_DEPENDENCIES).HTTPS_PROXYpoints to a running OpenShell Gateway.ssl.SSLContextis created and no temp cert/key files are written.Unit tests:
Expected: all 51 tests pass.
Checklist