Skip to content

fix(@schematics/angular): use null objects and callbacks in karma-to-vitest migration#33309

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix-karma-to-vitest-migration-templates
Open

fix(@schematics/angular): use null objects and callbacks in karma-to-vitest migration#33309
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix-karma-to-vitest-migration-templates

Conversation

@clydin
Copy link
Copy Markdown
Member

@clydin clydin commented Jun 4, 2026

The karma-to-vitest migration schematic previously used plain JavaScript objects as dictionaries when processing custom build options and analyzing Karma AST configurations. In environments where the input workspace files contain custom keys such as __proto__ these assignments would leak properties onto the global Object prototype.

@clydin clydin added the target: patch This PR is targeted for the next patch release label Jun 4, 2026
@clydin clydin marked this pull request as ready for review June 4, 2026 16:27
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves the Karma-to-Vitest migration schematics by using Object.create(null) to mitigate prototype pollution and wrapping string replacements in functions to prevent issues with special replacement patterns. However, a potential prototype pollution vulnerability remains in migration.ts when iterating over customBuildOptions keys, as unsafe keys like __proto__ are not explicitly skipped.

…vitest migration

The karma-to-vitest migration schematic previously used plain JavaScript objects as dictionaries when processing custom build options and analyzing Karma AST configurations. In environments where the input workspace files contain custom keys such as "__proto__", these assignments would leak properties onto the global Object prototype.
@clydin clydin force-pushed the fix-karma-to-vitest-migration-templates branch from 56a8846 to e322401 Compare June 4, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @schematics/angular target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant