Skip to content

fix(http): preserve empty referrer option in HttpRequest#69171

Open
SkyZeroZx wants to merge 1 commit into
angular:mainfrom
SkyZeroZx:fix/http-referrer
Open

fix(http): preserve empty referrer option in HttpRequest#69171
SkyZeroZx wants to merge 1 commit into
angular:mainfrom
SkyZeroZx:fix/http-referrer

Conversation

@SkyZeroZx
Copy link
Copy Markdown
Contributor

@SkyZeroZx SkyZeroZx commented Jun 5, 2026

Preserve referrer: '' when constructing and cloning HttpRequest.

An empty string is a valid Fetch referrer value and is documented by Angular as the way to omit referrer information for sensitive requests. The previous truthy checks treated it as if the option was not provided, causing requests to fall back to the browser default referrer behavior.

See https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#referrer

@pullapprove pullapprove Bot requested a review from kirjs June 5, 2026 03:37
@angular-robot angular-robot Bot added the area: common Issues related to APIs in the @angular/common package label Jun 5, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 5, 2026
Preserve `referrer: ''` when constructing and cloning HttpRequest.

An empty string is a valid Fetch referrer value and is documented by
Angular as the way to omit referrer information for sensitive requests.
The previous truthy checks treated it as if the option was not provided,
causing requests to fall back to the browser default referrer behavior.
@SkyZeroZx SkyZeroZx force-pushed the fix/http-referrer branch from 7d26173 to 1e54b8f Compare June 5, 2026 03:37
@SkyZeroZx SkyZeroZx changed the title fix(common): preserve empty referrer option in HttpRequest fix(http): preserve empty referrer option in HttpRequest Jun 5, 2026
@angular-robot angular-robot Bot added the area: common/http Issues related to HTTP and HTTP Client label Jun 5, 2026
@SkyZeroZx
Copy link
Copy Markdown
Contributor Author

I'm wondering if this would need backporting or not, considering that since it was added in Angular 20, it has always been omitted.

@alan-agius4
Copy link
Copy Markdown
Contributor

I'm wondering if this would need backporting or not, considering that since it was added in Angular 20, it has always been omitted.

Bug fixes are not backported.

@alan-agius4 alan-agius4 removed the request for review from kirjs June 5, 2026 12:53
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Jun 5, 2026
@ngbot
Copy link
Copy Markdown

ngbot Bot commented Jun 5, 2026

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@SkyZeroZx
Copy link
Copy Markdown
Contributor Author

I'm wondering if this would need backporting or not, considering that since it was added in Angular 20, it has always been omitted.

Bug fixes are not backported.

That's the question, I'm not sure if it's a bug fix or a security issue, since if a user has been using referrer with '' and has sent any sensitive URL containing a token or OAuth2, it hasn't been fulfilled.

@alan-agius4
Copy link
Copy Markdown
Contributor

Good point about the token, in that case yes let's backporting as technically this is potentially leaking sensitive route parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: common/http Issues related to HTTP and HTTP Client area: common Issues related to APIs in the @angular/common 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