Patch 2#69794
Open
istesf wants to merge 1 commit into
Open
Conversation
JeanMeche
reviewed
Jul 15, 2026
|
|
||
| export function eventTargetPatch(_global: any, api: _ZonePrivate) { | ||
| if ((Zone as any)[api.symbol('patchEventTarget')]) { | ||
| // === FIX START: Prevent prototype pollution of patchEventTarget === |
Member
There was a problem hiding this comment.
Can we please drop those comments.
JeanMeche
reviewed
Jul 15, 2026
| const compare = patchOptions?.diff || compareTaskCallbackVsDelegate; | ||
|
|
||
| const unpatchedEvents: string[] = (Zone as any)[zoneSymbol('UNPATCHED_EVENTS')]; | ||
| // === FIX START: Prevent prototype pollution of UNPATCHED_EVENTS === |
Member
|
Can you also please address the linting issues. Thank you. |
Author
|
I removed the comments and fixed the linting. |
Member
|
Can you please squuash the commits into a single one. We'd like this change to be a single commit. Thank you. |
…chEventTarget Add hasOwnProperty checks before reading internal flags from the Zone object to prevent prototype pollution attacks.
JeanMeche
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Zone.js stores the internal flags
UNPATCHED_EVENTS(inevents.ts) andpatchEventTarget(inevent-target.ts) as string-keyed properties on theZoneobject. Because these keys are plain strings, they can be inheritedfrom
Object.prototypevia prototype pollution. An attacker who pollutesObject.prototypebefore Zone.js loads can:disabling change detection for those events (security bypass);
patchEventTargettotrue, causing the entire event patching tobe skipped and the application to become unresponsive (DoS).
Issue Number: N/A
What is the new behavior?
Before reading the flags, we now check that they are own properties of the
Zoneobject usinghasOwnProperty. Inherited values from the prototypechain are ignored, closing the prototype pollution vector.
The fix is limited to two files:
packages/zone.js/lib/common/events.tspackages/zone.js/lib/browser/event-target.tsDoes this PR introduce a breaking change?
Other information
I manually tested these changes on Zone.js 0.16.2 (latest stable) in a real
browser. Without the patch, polluting
Object.prototypewith the relevantkeys disabled event tracking as expected. With the patch, the polluted
values are ignored and Angular change detection continues to work normally.
No existing functionality is affected.
This vulnerability was previously reported to Google Bug Hunters (OSS VRP)
and is tracked as issue 524605344. The fix is coordinated with the Angular
team.