Title: Service worker caches `Cache-Control: no-store` responses for asset group `urls` and serves them to the next user after logout · Issue #72163 · angular/angular · GitHub
Open Graph Title: Service worker caches `Cache-Control: no-store` responses for asset group `urls` and serves them to the next user after logout · Issue #72163 · angular/angular
X Title: Service worker caches `Cache-Control: no-store` responses for asset group `urls` and serves them to the next user after logout · Issue #72163 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description For URLs matched by an asset group's urls, handleFetch() answers from CacheStorage whenever it has a copy: angular/packages/servic...
Open Graph Description: Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description For URLs matched by an asset group's urls, handleFetch() answers from CacheStorage wheneve...
X Description: Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description For URLs matched by an asset group's urls, handleFetch() answers from CacheStorage whe...
Opengraph URL: https://github.com/angular/angular/issues/72163
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Service worker caches `Cache-Control: no-store` responses for asset group `urls` and serves them to the next user after logout","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nservice-worker\n\n### Is this a regression?\n\nNo\n\n### Description\n\n\nFor URLs matched by an asset group's `urls`, `handleFetch()` answers from CacheStorage whenever it has a copy:\n\nhttps://github.com/angular/angular/blob/53ef99a543e037b64c596e9c3e147cb365062cea/packages/service-worker/worker/src/assets.ts#L141-L164\n\nand `fetchAndCacheOnce()` keys in-flight requests by URL only, then stores the response without looking at `Cache-Control`:\n\nhttps://github.com/angular/angular/blob/53ef99a543e037b64c596e9c3e147cb365062cea/packages/service-worker/worker/src/assets.ts#L300-L336\n\nSo:\n\n- A response sent with `Cache-Control: no-store` is stored and served to later requests for that URL, whatever their credentials. On a shared browser, the next user gets the previous user's response. The [docs](https://angular.dev/ecosystem/service-workers/config) say `urls` resources \"are cached according to their HTTP headers\", and `no-store` means a cache [must not store the response](https://www.rfc-editor.org/rfc/rfc9111#section-5.2.2.5).\n- A request that arrives while another request for the same URL is in flight gets that request's response, even if one was sent with the user's cookie and the other with `credentials: 'omit'`.\n\nMinimal example:\n\n```json\n{ \"name\": \"api\", \"installMode\": \"lazy\", \"resources\": { \"urls\": [\"/api/**\"] } }\n```\n\n```ts\nawait firstValueFrom(http.post('/auth/login', { user: 'alice' }));\nawait firstValueFrom(http.get('/api/me'));\n\nawait firstValueFrom(http.post('/auth/logout', null));\nawait firstValueFrom(http.get('/api/me', { credentials: 'omit', cache: 'no-store' }));\n\nawait firstValueFrom(http.post('/auth/login', { user: 'bob' }));\nawait firstValueFrom(http.get('/api/me'));\n```\n\n`/api/me` is sent with `Cache-Control: no-store, private` and `Vary: Cookie`, and returns `{\"user\":null}` without a session. The last two requests both get alice's response:\n\n```json\n{ \"user\": \"alice\", \"email\": \"alice@example.test\", \"request\": 1 }\n```\n\nBob's request has no options, so the request's `credentials` and `cache` don't matter here. `Vary: Cookie` doesn't help either: asset groups always match with `ignoreVary: true`, and requests in the worker don't carry the `Cookie` header.\n\nThe requests above:\n\n| Request | Service worker bypassed | Service worker active |\n| ---------------------------------------------------------------------- | ----------------------- | --------------------- |\n| `GET /api/me` as alice | alice, request 1 | alice, request 1 |\n| `GET /api/me` after logout, `credentials: 'omit'`, `cache: 'no-store'` | `null`, request 2 | alice, request 1 |\n| `GET /api/me` as bob | bob, request 3 | alice, request 1 |\n\nThen, as alice, a URL that isn't cached yet, and 50 ms later the same URL with `credentials: 'omit'`:\n\n| Request | Service worker bypassed | Service worker active |\n| ------------------------------------------- | ----------------------- | --------------------- |\n| `GET /api/me?race=…` | alice, request 4 | alice, request 2 |\n| `GET /api/me?race=…`, `credentials: 'omit'` | `null`, request 5 | alice, request 2 |\n\nBoth cases use the setup of GHSA-95qp-cmmw-mgqv (precondition 2), but neither is the request rebuilding fixed in #68904. That request now keeps `credentials: 'omit'` and `cache`, and the server never gets a cookie for those requests: in both cases the worker answers without sending them. The advisory also notes that CacheStorage is governed by `ngsw-config.json` and `ngsw-bypass`, not `Request.cache`. The first case is about the response's own `Cache-Control`, which the docs say `urls` follow, and the second one doesn't come from CacheStorage.\n\n### Please provide a link to a minimal reproduction of the bug\n\nSee https://github.com/SkyZeroZx/ng-service-worker-cache-bypass\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI : 22.3.0\nAngular : 22.3.0\nNode.js : 24.16.0\nPackage Manager : npm 11.13.0\nOperating System : win32 x64\n\n┌───────────────────────────┬───────────────────┬───────────────────┐\n│ Package │ Installed Version │ Requested Version │\n├───────────────────────────┼───────────────────┼───────────────────┤\n│ @angular/build │ 22.3.0 │ 22.3.0 │\n│ @angular/cli │ 22.3.0 │ 22.3.0 │\n│ @angular/common │ 22.3.0 │ 22.3.0 │\n│ @angular/compiler │ 22.3.0 │ 22.3.0 │\n│ @angular/compiler-cli │ 22.3.0 │ 22.3.0 │\n│ @angular/core │ 22.3.0 │ 22.3.0 │\n│ @angular/platform-browser │ 22.3.0 │ 22.3.0 │\n│ @angular/service-worker │ 22.3.0 │ 22.3.0 │\n│ rxjs │ 7.8.2 │ ~7.8.0 │\n│ typescript │ 6.0.3 │ ~6.0.2 │\n└───────────────────────────┴───────────────────┴───────────────────┘\n```\n\n### Anything else?\n\nI think we can consider this a bypass of https://github.com/advisories/GHSA-95qp-cmmw-mgqv","author":{"url":"https://github.com/SkyZeroZx","@type":"Person","name":"SkyZeroZx"},"datePublished":"2026-11-22T19:51:29Z","url":"https://github.com/angular/angular/issues/72163"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d23a535d-069a-916b-6957-f9e5ca49b7df |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B81E:107A1:84151E:ABC57E:6B062DC0 |
| html-safe-nonce | 6ea3b0c349c1d80c1541c95343b72e7cea762c03312ba531d93f797a3609a601 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODFFOjEwN0ExOjg0MTUxRTpBQkM1N0U6NkIwNjJEQzAiLCJ2aXNpdG9yX2lkIjoiNDc0MTgyNTE4NzE0OTEzMTIwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | db0d8bd86e45fcc3f1194ba0ea26a84fcf76a9a3e55df477c5be00fa0cda3aca |
| hovercard-subject-tag | issue:6546968179 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/72163/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9d29f076b21ef5f1587689c00acea7e75008f8abef1f3d2448afeeaffb73768c/angular/angular/issues/72163 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9d29f076b21ef5f1587689c00acea7e75008f8abef1f3d2448afeeaffb73768c/angular/angular/issues/72163 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description For URLs matched by an asset group's urls, handleFetch() answers from CacheStorage wheneve... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SkyZeroZx |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f961de5dd5c5d4aca24d33f8b3ffb3fb8b2ef53d0a4f32f01f0a790e512f6d3 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 494ea0bb1e0feef734a83e2628697647755e8864 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width