fix(security): prevent presigned URL leak and exception data exfiltration #1068
+6
−6
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.
Summary
Fixes two HIGH priority security vulnerabilities that could lead to supply chain attacks and data exfiltration.
1. Presigned URL Leak - Supply Chain Attack Vector (HIGH)
Problem:
The upload script logged sensitive presigned URLs to CI logs through multiple mechanisms:
curl -vflag printed full HTTP headers including the URL2>&1captured verbose stderr outputset -xshell tracing echoed the entire curl command with$SIGNED_URLThe presigned URL contains HMAC-SHA256 signatures that grant upload rights for ~1 hour. Anyone with CI log access could:
Fix:
-xflag fromset -exuo pipefail→set -euo pipefailcurl -vwithcurl -s -w '%{http_code}' -o /dev/null2. Exception Data Exfiltration to API (HIGH)
Problem:
Tool runner caught all exceptions and automatically sent
repr(exc)to Anthropic API intool_resultcontent. Exception messages routinely contain:postgres://user:password@host:5432/dbsk-proj-...,sk_live_.../home/user/.ssh/id_rsa,/var/www/secret-api/AWS_SECRET_ACCESS_KEY=...This behavior silently exfiltrated sensitive host information to the LLM with:
Fix:
repr(exc)with generic error message:"Error: Tool '{tool_name}' execution failed. Check logs for details."log.exception()for debuggingImplementation Details
Curl Fix
Before:
After:
Exception Fix
Before:
After:
Security Impact
Presigned URL Leak
Exception Exfiltration
Changes
scripts/utils/upload-artifact.sh:2-xfromset -exuo pipefailscripts/utils/upload-artifact.sh:17-21curl -v ... 2>&1withcurl -s -w '%{http_code}' -o /dev/nullsrc/anthropic/lib/tools/_beta_runner.py:195(sync)repr(exc)to generic error messagesrc/anthropic/lib/tools/_beta_runner.py:362(async)repr(exc)to generic error messageTesting
Both fixes validated with comprehensive security review to ensure: