Skip to content

fix(service-worker): validate redirected hashed asset responses#69209

Open
claudeloba wants to merge 1 commit into
angular:mainfrom
claudeloba:fix/sw-redirect-hash-validation
Open

fix(service-worker): validate redirected hashed asset responses#69209
claudeloba wants to merge 1 commit into
angular:mainfrom
claudeloba:fix/sw-redirect-hash-validation

Conversation

@claudeloba
Copy link
Copy Markdown

@claudeloba claudeloba commented Jun 6, 2026

Carry the expected asset hash through redirected network fetches so a hashed manifest entry cannot cache bytes from a different redirect target.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When a hashed service-worker asset request is fulfilled through a redirect, the final redirected response can be returned to the caching path without validating the final response body against the original manifest hash.

Issue Number: N/A

What is the new behavior?

The expected manifest hash is carried through redirected network fetches. If the final successful redirected response body does not match the original hash, Angular raises a service-worker critical error instead of returning the mismatched response for caching.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Tested with:

  • bazelisk test //packages/service-worker/worker/test:test --test_output=errors --cache_test_results=no
  • git diff --check main..HEAD
  • pnpm ng-dev commit-message validate-range main HEAD
  • pnpm ng-dev format changed --check main
  • pnpm tslint
  • pnpm ts-circular-deps:check

Carry the expected asset hash through redirected network fetches so a hashed manifest entry cannot cache bytes from a different redirect target.
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Jun 6, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@pullapprove pullapprove Bot requested a review from crisbeto June 6, 2026 19:55
@angular-robot angular-robot Bot added the area: service-worker Issues related to the @angular/service-worker package label Jun 6, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: service-worker Issues related to the @angular/service-worker package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant