The vulnerability lies in the @angular/service-worker package, where the service worker fails to respect the client-defined redirect policy when intercepting and reconstructing network requests. The analysis of the provided patch commits pinpoints the exact location of the flaw.
The commit 58bf5ecd4ed256d66a3444166d172eeffd38f75f directly addresses the issue. The key change is in the packages/service-worker/worker/src/assets.ts file, specifically within the AssetGroup.newRequestWithMetadata function. Before the patch, this function would create a new Request object preserving only the headers of the original request. The patch modifies this function to also preserve the redirect property from the original request's options.
This confirms that AssetGroup.newRequestWithMetadata is the vulnerable function. When an application makes a fetch request with a strict redirect policy (e.g., {redirect: 'error'}), the service worker intercepts it. The vulnerable version of newRequestWithMetadata then reconstructs this request without the redirect: 'error' policy. Consequently, the browser defaults to its standard redirect: 'follow' behavior. If the original request's URL redirects to a sensitive, authenticated endpoint, the browser will incorrectly follow the redirect, sending along any cookies or authentication headers, leading to a 'Confused Deputy' problem and potential information disclosure.