Visitar URL original
fix(upgrade): Address Trusted Types violations in @angular/upgrade by bjarkler · Pull Request #57454 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20240830090129/https://github.com/angular/angular/pull/57454
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upgrade): Address Trusted Types violations in @angular/upgrade #57454

Closed

Conversation

bjarkler
Copy link
Contributor

Angular applications that are AngularJS hybrids are currently unable to adopt Trusted Types due to violations eminating from an innerHTML assignment in the @angular/upgrade package. This commit allows developers of such applications to optionally ignore this class of violations by configuring the Trusted Types header to allow the new angular#unsafe-upgrade policy.

Note that the policy is explicitly labeled as unsafe as it does not in any way mitigate the security risk of using AngularJS in an Angular application, but does unblock Trusted Types adoption enabling XSS protection for other parts of the application.

The implementation follows the approach taken in @angular/core; see packages/core/src/util/security.

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.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

The @angular/upgrade package emits Trusted Types violations, blocking adoption of the security feature.

Issue Number: N/A

What is the new behavior?

The Trusted Types violations can be ignored by allowing the new angular#unsafe-upgrade Trusted Types policy. There are no functional changes.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@bjarkler bjarkler requested a review from jelbourn August 19, 2024 18:21
@angular-robot angular-robot bot added the area: upgrade Issues related to AngularJS → Angular upgrade APIs label Aug 19, 2024
@ngbot ngbot bot added this to the Backlog milestone Aug 19, 2024
@bjarkler
Copy link
Contributor Author

Presubmit (TGP).

@bjarkler bjarkler force-pushed the upgrade-package-trusted-types branch 2 times, most recently from c968dbf to ff30510 Compare August 19, 2024 18:44
Angular applications that are AngularJS hybrids are currently unable to
adopt Trusted Types due to violations eminating from an innerHTML
assignment in the @angular/upgrade package. This commit allows
developers of such applications to optionally ignore this class of
violations by configuring the Trusted Types header to allow the new
angular#unsafe-upgrade policy.

Note that the policy is explicitly labeled as unsafe as it does not in
any way mitigate the security risk of using AngularJS in an Angular
application, but does unblock Trusted Types adoption enabling XSS
protection for other parts of the application.

The implementation follows the approach taken in @angular/core;
see packages/core/src/util/security.
@bjarkler bjarkler force-pushed the upgrade-package-trusted-types branch from ff30510 to f626593 Compare August 19, 2024 22:29
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: fw-security

Copy link
Contributor

@thePunderWoman thePunderWoman left a comment

Choose a reason for hiding this comment

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

LGTM

@alxhub alxhub added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Aug 26, 2024
@alxhub
Copy link
Member

alxhub commented Aug 26, 2024

This PR was merged into the repository by commit c9d9078.

The changes were merged into the following branches: main, 18.2.x

@alxhub alxhub closed this in c9d9078 Aug 26, 2024
alxhub pushed a commit that referenced this pull request Aug 26, 2024
…57454)

Angular applications that are AngularJS hybrids are currently unable to
adopt Trusted Types due to violations eminating from an innerHTML
assignment in the @angular/upgrade package. This commit allows
developers of such applications to optionally ignore this class of
violations by configuring the Trusted Types header to allow the new
angular#unsafe-upgrade policy.

Note that the policy is explicitly labeled as unsafe as it does not in
any way mitigate the security risk of using AngularJS in an Angular
application, but does unblock Trusted Types adoption enabling XSS
protection for other parts of the application.

The implementation follows the approach taken in @angular/core;
see packages/core/src/util/security.

PR Close #57454
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: upgrade Issues related to AngularJS → Angular upgrade APIs target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants