security(gateway): isolate env/credential registries using ContextVars

This commit is contained in:
Dusk1e
2026-04-06 16:05:15 +03:00
committed by Teknium
parent da02a4e283
commit 7d0953d6ff
3 changed files with 47 additions and 11 deletions

View File

@@ -3252,6 +3252,18 @@ class GatewayRunner:
logger.debug("Gateway memory flush on reset failed: %s", e)
self._evict_cached_agent(session_key)
try:
from tools.env_passthrough import clear_env_passthrough
clear_env_passthrough()
except Exception:
pass
try:
from tools.credential_files import clear_credential_files
clear_credential_files()
except Exception:
pass
# Reset the session
new_entry = self.session_store.reset_session(session_key)