fix: allow Google Picker scripts in CSP#2307
Merged
Merged
Conversation
Adds https://apis.google.com and https://accounts.google.com to the CSP meta tag's script-src directive so the Google Drive upload tab from #2306 can actually load gapi/Picker and Google Identity Services. Without this, "Choose from Google Drive" throws "Couldn't load Google Drive" because the two <script> tags injected by useGooglePicker are blocked at the browser boundary. Verified in prod browser console — both scripts were blocked with the exact CSP violation message before this change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Adds `https://apis.google.com\` and `https://accounts.google.com\` to the `script-src` directive of the CSP meta tag in `web/index.html`. Required for the Google Drive upload tab from #2306 to function.
Why
Browser console on prod after deploying #2306 showed:
```
Loading the script 'https://apis.google.com/js/api.js' violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' https://www.googletagmanager.com https://www.google-analytics.com https://static.hotjar.com https://script.hotjar.com https://www.dropbox.com"
```
Same violation for `accounts.google.com/gsi/client`. Both are required by the Picker / GIS flow that `useGooglePicker` lazy-loads.
How
One-line addition to the existing CSP meta tag's `script-src`. No other directives needed — frame/connect/img directives are not set on this site, so the Picker iframe and XHR calls were never blocked.
Testing
Risks
Goal alignment
Unblocks #2306, which closes the empty "From Google Drive" history section #2305 introduced.
Need help on this PR? Tag
@codesmithwith what you need.