Skip to content

Conversation

@stereotype441
Copy link
Contributor

@stereotype441 stereotype441 commented Nov 12, 2024

This PR adds logic to google_identity_services_web/lib/src/js_loader.dart to cause the nonce property to be property set when creating new script elements.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

* Adds a `nonce` parameter to the `loadWebSdk` method.
* Applies the `nonce` regardless of TrustedTypes being available or not
  (this is a CSP feature, more widely available than TTs)
* Does not attempt to validate the `nonce` value, the browser should
  complain instead (in practice, any value seems valid, see tests)
* Adds unit tests (dart test --platform chrome)
Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

(PS: we probably should do this across all the packages that automatically load the JS into the page... and extract the JS Loading logic to its own package so we can share the logic across all packages that load JS into the page :P I'll create a separate issue for that)

@ditman ditman added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 14, 2024
@auto-submit auto-submit bot merged commit 4e1942e into flutter:main Nov 14, 2024
77 checks passed
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 15, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 15, 2024
flutter/packages@b9ac917...b164be3

2024-11-14 [email protected] Remove packages/platform from dependabot config (flutter/packages#8099)
2024-11-14 [email protected] Ignore dependabot minor and patch updates of Kotlin mocking library (flutter/packages#8056)
2024-11-14 [email protected] [google_identity_services_web] Set nonce properly in loadWebSdk(). (flutter/packages#8069)
2024-11-14 [email protected] Roll Flutter (stable) from 6031040 to dec2ee5 (4 revisions) (flutter/packages#8084)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants