Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(service-worker): Preserves explicit 'credentials: omit' in asset … - #68904

Merged
alxhub merged 2 commits into
angular:mainfrom
SkyZeroZx:fix/service-worker
May 27, 2026
Merged

fix(service-worker): Preserves explicit 'credentials: omit' in asset …#68904
alxhub merged 2 commits into
angular:mainfrom
SkyZeroZx:fix/service-worker

Conversation

@SkyZeroZx

@SkyZeroZx SkyZeroZx commented May 24, 2026

Copy link
Copy Markdown
Contributor

fix(service-worker): Preserves explicit 'credentials: omit' in asset requests

Ensures that explicitly provided credentials: 'omit' options are preserved
when creating new requests, preventing unintended credential inclusion.

fix(service-worker): Preserves HTTP cache mode in asset group requests

Ensures explicit HTTP cache mode from incoming requests is forwarded and maintained when creating fetch requests for assets, aligning with expected fetch behavior and preventing unintended cache handling.

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?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…requests

Ensures that explicitly provided `credentials: 'omit'` options are preserved
when creating new requests, preventing unintended credential inclusion.
@pullapprove
pullapprove Bot requested a review from kirjs May 24, 2026 00:32
@angular-robot angular-robot Bot added the area: service-worker Issues related to the @angular/service-worker package label May 24, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 24, 2026
};

if (options.credentials === 'omit') {
init.credentials = 'omit';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm also wondering whether we should consider cache as well.

For cases like no-store and no-cache, to avoid keeping it in the browser memory for subsequent requests.

Can we see it in a follow PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The question is more: are we fixing a security bug or adding a feature ?

We should only be really fixing bug as this package is now in maintenance mode.

@SkyZeroZx SkyZeroZx May 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a security flaw, not a feature. I say this because, in a hypothetical scenario where a document or sensitive information is accidentally cached, this could become a potential vulnerability.

Considering that the intention of the request was not to save the information in the browser so that any subsequent request would not receive the request with outdated information (e.g., medical records on a shared computer [This is common in some parts of my country and clinics.], bank statements, etc.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah makes sense, let's ship both in this PR as both could be seen as security fixes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated, I added it as another commit

Ensures explicit HTTP cache mode from incoming requests is forwarded and maintained when creating fetch requests for assets, aligning with expected fetch behavior and preventing unintended cache handling.
@SkyZeroZx

SkyZeroZx commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

Given that this case is similar the same attack vector as this issue #68823

I believe we should also backport this pull request ?

@SkyZeroZx

Copy link
Copy Markdown
Contributor Author

Sorry for bothering you @JeanMeche @alan-agius4.

I think this should be merged as well so it can make it into today's patch release, since it's also a security issue.

@JeanMeche
JeanMeche removed the request for review from kirjs May 27, 2026 16:33
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels May 27, 2026
@alxhub
alxhub merged commit 31399c2 into angular:main May 27, 2026
26 checks passed
@alxhub

alxhub commented May 27, 2026

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jun 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: service-worker Issues related to the @angular/service-worker package target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants