fix(picker): fix docs.google.com refused to connect issue#797
fix(picker): fix docs.google.com refused to connect issue#797waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Greptile Summary
This PR fixes a critical integration issue with Google Drive Picker functionality by modifying Cross-Origin security policies in the Next.js configuration. The change updates the Cross-Origin-Opener-Policy (COOP) from same-origin to same-origin-allow-popups for specific routes that require Google Drive integration.
The core problem was that Google Drive Picker opens in a popup window and needs to communicate back to the parent window to send selected file information. The previous restrictive same-origin policy was blocking this popup communication, causing a "docs.google.com refused to connect" error. The solution implements a targeted approach:
- Maintains strict
same-originpolicy for most application routes to preserve security - Uses the more permissive
same-origin-allow-popupspolicy specifically for routes that need Google Drive integration (w/.*,workspace/.*,api/tools/drive) - Also updates Cross-Origin-Embedder-Policy to
unsafe-nonefor these same routes
This change integrates with the existing GoogleDrivePicker component (referenced in the context) which handles OAuth authentication and file selection. The security model remains sound as the permissive policy is only applied to routes that specifically require popup communication for Google Drive functionality.
PR Description Notes:
- Minor typo: "chaging" should be "changing"
Confidence score: 4/5
- This is a well-targeted fix that addresses a specific integration issue without compromising overall security
- The solution correctly identifies the root cause and applies the minimal necessary change
- The route-specific application of policies maintains security boundaries while enabling required functionality
apps/sim/next.config.tsneeds careful review to ensure the route patterns correctly match all intended Google Drive integration endpoints
1 file reviewed, no comments
…i#797) Co-authored-by: waleedlatif <waleedlatif@waleedlatifs-MacBook-Pro.local>
Description
Type of change
How Has This Been Tested?
Tested manually in incognito browser to prevent browser caching.
Checklist:
bun run test)Security Considerations: