Skip to content

refactor(extras): drop the redirect target text - #829

Merged
ParidelPooya merged 2 commits into
mainfrom
refactor/microvm-redirect-status
Oct 24, 2026
Merged

ParidelPooya merged 2 commits into
mainfrom
refactor/microvm-redirect-status

Conversation

@ParidelPooya

@ParidelPooya ParidelPooya commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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 an opener 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. The path and the status are enough to find the problem.
  5. So the message omits the 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 Location as JS did.

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 caller's opener followed: "The MicroVM answered the job at {path} with a redirect, and the opener followed it. … and pass an opener that follows no redirect."
  • A 3xx without a Location: "The MicroVM answered the job at {path} with HTTP {status}". This matches JS. The old text said "a redirect to no location".
  • _Answer.location becomes has_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

  • The redirect tests assert the new messages. New tests send a Location with ?token=secret, and an opener that follows it, and assert that the message omits it. A new test covers a 3xx without a Location.
  • hatch run dev-extras:cov: 376 tests pass, 100 % coverage. Typecheck and hatch fmt --check pass.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

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.

@yaythomas yaythomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

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
ParidelPooya marked this pull request as ready for review October 24, 2026 19:57
@ParidelPooya
ParidelPooya merged commit 3d7dd4f into main Oct 24, 2026
21 checks passed
@ParidelPooya
ParidelPooya deployed to ai-pr-review-runtime October 24, 2026 19:58 — with GitHub Actions Active
@ParidelPooya
ParidelPooya deleted the refactor/microvm-redirect-status branch October 24, 2026 19:58

This branch was successfully deployed

1 active deployment
ai-pr-review-runtime — 1cf9621a Deployed Oct 24, 2026 by ParidelPooya via notify / Generate notification summary #282
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants