:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix: use secrets AWS profiles and handle AccessDeniedException in codec server (#61420)
Gustavo H. Strassburger83f59bb3709d
diff --git a/bin/temporal-codec-server b/bin/temporal-codec-serverindex 03dca0a2e119..1bec375a9647 100755--- a/bin/temporal-codec-server+++ b/bin/temporal-codec-server@@ -28,13 +28,14 @@ import subprocessimport sysfrom http.server import BaseHTTPRequestHandler, HTTPServerfrom typing import Any+from urllib.parse import urlparsefrom cryptography.fernet import Fernetfrom temporalio.api.common.v1 import PayloadREGIONS = {- "us": {"aws_profile": "prod-us", "aws_region": "us-east-1"},- "eu": {"aws_profile": "prod-eu", "aws_region": "eu-central-1"},+ "us": {"aws_profile": "prod-us-secrets", "aws_region": "us-east-1"},+ "eu": {"aws_profile": "prod-eu-secrets", "aws_region": "eu-central-1"},}AWS_SECRET_NAME = "temporal-worker-shared-secrets"@@ -63,9 +64,10 @@ def get_fernet(region: str) -> Fernet:if isinstance(e, ClientError) and e.response["Error"]["Code"] not in ("ExpiredToken","ExpiredTokenException",+ "AccessDeniedException",):raise- print(f"AWS SSO session expired for profile '{profile}', logging in...")+ print(f"AWS SSO session not active for profile '{profile}', logging in...")subprocess.run(["aws", "sso", "login", "--profile", profile], check=True)session = boto3.Session(profile_name=profile)client = session.client("secretsmanager", region_name=aws_region)@@ -116,9 +118,10 @@ class CodecHandler(BaseHTTPRequestHandler):if not self._is_origin_allowed():self.send_error(403, "Origin not allowed")return- if self.path == "/decode":+ path = urlparse(self.path).path+ if path == "/decode":self._handle_decode()- elif self.path == "/encode":+ elif path == "/encode":self._handle_passthrough()else:self.send_error(404)