Skip to content

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
@pullapprove pullapprove bot requested a review from thePunderWoman 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
@angular-automatic-lock-bot
Copy link

This issue 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 Sep 29, 2024
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: 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.

4 participants