Repository navigation
refactor(extras): drop the redirect target text - #829
Merged
Merged
Conversation
The execution history stores a rejected job's error message. A query in the Location header can hold a secret. So the 3xx and the followed-redirect messages name only the path and the status.
The redirect docs now state what the message omits. This addresses the D3 review, and adds tests for a 302 and an empty Location.
ParidelPooya
added a commit
to aws/aws-durable-execution-sdk-js
that referenced
this pull request
Oct 24, 2026
## Summary A MicroVM job route that answers a redirect still fails the delivery at once. The error message no longer contains the `Location` header, or the URL that a custom fetch followed. ## Why 1. The server sets the `Location` header. 2. A `Location` can carry a query with a secret, such as a presigned signature or an SSO state. 3. The core SDK checkpoints the message of a step failure. So the execution history stored that text. 4. `redirectTarget` removed the query and capped the text at 200 characters. 5. The path, and the status of a 3xx answer, are enough to find the problem. 6. So the message omits the `Location`, and the URL that a followed redirect reached. `redirectTarget` is removed. This is item D3 of a review of the MicroVM safeguards. The Python SDK gets the same messages in aws/aws-durable-execution-sdk-python#829. ## Changes - A 3xx with a `Location`: "The MicroVM answered the job at {path} with HTTP {status}, a redirect. The operation does not follow redirects, so set the path that the route serves." - A redirect that a custom fetch followed: "The MicroVM answered the job at {path} with a redirect, and the fetch function followed it. …" - A 3xx without a `Location` is unchanged. - `redirect: "manual"` and the `response.redirected` check are unchanged. They prevent a lost job and an auth token sent to another host. - `redirectTarget` and `MAX_REDIRECT_TARGET_LENGTH` are removed. ## Testing - The redirect tests assert the new messages. New tests send a `Location` with `?token=secret` and assert that the message omits it, for a 3xx and for a followed redirect. - Extras `npm test`: 334 tests pass. `npm run lint` and `npm run format:check` pass. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
ParidelPooya
marked this pull request as ready for review
October 24, 2026 19:57
This branch was successfully deployed
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.
Summary
A MicroVM job route that answers a redirect still fails the delivery at once. The error message no longer contains the
Locationheader or the URL that an opener followed.Why
Locationheader.Locationcan carry a query with a secret, such as a presigned signature or an SSO state.Location, and the URL that a followed redirect reached.This is item D3 of a review of the MicroVM safeguards. The JS SDK makes the same change in aws/aws-durable-execution-sdk-js#1079. It replaces the planned follow-up that would have sanitized the
Locationas JS did.Changes
Location: "The MicroVM answered the job at {path} with HTTP {status}, a redirect. The operation does not follow redirects, so set the path that the route serves."Location: "The MicroVM answered the job at {path} with HTTP {status}". This matches JS. The old text said "a redirect to no location"._Answer.locationbecomeshas_location._NoRedirect, the unredirected auth headers, and the followed-redirect check are unchanged.Merge note
The repository squash-merges with the commit messages. The body of 9863bff says that the followed-redirect message names the status. It names only the path. Please replace that sentence when merging: "So the 3xx message names only the path and the status. The followed-redirect message names only the path."
Testing
Locationwith?token=secret, and an opener that follows it, and assert that the message omits it. A new test covers a 3xx without aLocation.hatch run dev-extras:cov: 376 tests pass, 100 % coverage. Typecheck andhatch fmt --checkpass.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.