fix(telemetry): detect intercepted uploads on client side#70
Open
swarit-stepsecurity wants to merge 1 commit into
Open
Conversation
The agent currently treats any HTTP 200 from the presigned-URL PUT as proof the upload reached S3 and immediately calls notify. A TLS- inspecting proxy, DLP appliance, or outbound-filtering firewall on a customer network can terminate that PUT mid-flight and synthesize a 200 response without forwarding the bytes — the run is then reported as a silent success despite no object ever existing in S3. Two checks, in order: 1. After the PUT returns 200, require x-amz-request-id and/or x-amz-id-2 on the response. Real S3 always sets these; a proxy fake-200 can't reproduce them. Missing both → non-retryable failure with the response Server header captured for forensics. 2. Before calling notify, POST /telemetry/confirm-upload to ask the backend whether the object actually exists in S3. A definitive uploaded=false is fatal (bail with reason). 404 (old backend without the endpoint), non-200, or transport errors fall through to notify, whose own server-side precheck remains the safety net. On success the agent prints a definitive "Upload confirmed in S3 (N bytes)" line, separate from "Backend processing started", so the user can tell upload-landed from processing-kicked-off. Adds tests for: real-S3 happy path, synthetic-200 PUT rejection, confirm=false fatal path, confirm 404 fallback, confirm 5xx fallback. Signed-off-by: Swarit Pandey <swarit@stepsecurity.io>
80fee9c to
7e6c38f
Compare
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.
What does this PR do?
Type of change
Testing
./stepsecurity-dev-machine-guard --verbose./stepsecurity-dev-machine-guard --json | python3 -m json.toolmake lintmake testRelated Issues