Skip to content

[google_identity_services_web] Set nonce properly in loadWebSdk(). - #8069

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
stereotype441:b_378662081_2
Nov 14, 2024
Merged

[google_identity_services_web] Set nonce properly in loadWebSdk().#8069
auto-submit[bot] merged 2 commits into
flutter:mainfrom
stereotype441:b_378662081_2

Conversation

@stereotype441

@stereotype441stereotype441 commented Nov 12, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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)

@ditmanditman left a comment

Copy link
Copy Markdown
Member

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)

@ditmanditman added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 14, 2024
@auto-submit
auto-submitBot merged commit 4e1942e into flutter:mainNov 14, 2024
@auto-submitauto-submitBot 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-submitBot pushed a commit to flutter/flutter that referenced this pull request Nov 15, 2024
flutter/packages@b9ac917...b164be3
2024-11-14 magder@google.com Remove packages/platform from dependabot config (flutter/packages#8099)
2024-11-14 magder@google.com Ignore dependabot minor and patch updates of Kotlin mocking library (flutter/packages#8056)
2024-11-14 paulberry@google.com [google_identity_services_web] Set nonce properly in loadWebSdk(). (flutter/packages#8069)
2024-11-14 engine-flutter-autoroll@skia.org 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 flutter-ecosystem@google.com 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
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…lutter#8069)
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.
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
…lutter#8069)
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.
Sign up for freeto 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

@stereotype441@ditman