-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix(google-scopes): added forms and different drive scope #1532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -36,7 +36,7 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = { | |||||
| required: true, | ||||||
| provider: 'google-drive', | ||||||
| serviceId: 'google-drive', | ||||||
| requiredScopes: ['https://www.googleapis.com/auth/drive.file'], | ||||||
| requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||||||
|
||||||
| requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], | |
| requiredScopes: ['https://www.googleapis.com/auth/drive'], |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/google_drive.ts
Line: 39:39
Comment:
**logic:** Critical scope mismatch: Using readonly scope for a block that performs upload and create folder operations. This will cause authentication failures for write operations.
```suggestion
requiredScopes: ['https://www.googleapis.com/auth/drive'],
```
How can I resolve this? If you propose a fix, please make it concise.| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -425,7 +425,7 @@ export const auth = betterAuth({ | |
| scopes: [ | ||
| 'https://www.googleapis.com/auth/userinfo.email', | ||
| 'https://www.googleapis.com/auth/userinfo.profile', | ||
| 'https://www.googleapis.com/auth/drive.file', | ||
| 'https://www.googleapis.com/auth/drive.readonly', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: This scope change breaks write functionality. 'drive.readonly' only allows reading files, but many tools likely need to create/modify files. Consider 'drive.file' for read-write access to app-created files or 'drive' for full access if needed. Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/sim/lib/auth.ts
Line: 428:428
Comment:
**logic:** This scope change breaks write functionality. 'drive.readonly' only allows reading files, but many tools likely need to create/modify files. Consider 'drive.file' for read-write access to app-created files or 'drive' for full access if needed.
How can I resolve this? If you propose a fix, please make it concise. |
||
| ], | ||
| prompt: 'consent', | ||
| redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-drive`, | ||
|
|
@@ -439,7 +439,7 @@ export const auth = betterAuth({ | |
| scopes: [ | ||
| 'https://www.googleapis.com/auth/userinfo.email', | ||
| 'https://www.googleapis.com/auth/userinfo.profile', | ||
| 'https://www.googleapis.com/auth/drive.file', | ||
| 'https://www.googleapis.com/auth/drive.readonly', | ||
| ], | ||
| prompt: 'consent', | ||
| redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-docs`, | ||
|
|
@@ -453,7 +453,7 @@ export const auth = betterAuth({ | |
| scopes: [ | ||
| 'https://www.googleapis.com/auth/userinfo.email', | ||
| 'https://www.googleapis.com/auth/userinfo.profile', | ||
| 'https://www.googleapis.com/auth/drive.file', | ||
| 'https://www.googleapis.com/auth/drive.readonly', | ||
| ], | ||
| prompt: 'consent', | ||
| redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-sheets`, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,7 +121,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = { | |
| providerId: 'google-drive', | ||
| icon: (props) => GoogleDriveIcon(props), | ||
| baseProviderIcon: (props) => GoogleIcon(props), | ||
| scopes: ['https://www.googleapis.com/auth/drive.file'], | ||
| scopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||
|
||
| }, | ||
| 'google-docs': { | ||
| id: 'google-docs', | ||
|
|
@@ -130,7 +130,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = { | |
| providerId: 'google-docs', | ||
| icon: (props) => GoogleDocsIcon(props), | ||
| baseProviderIcon: (props) => GoogleIcon(props), | ||
| scopes: ['https://www.googleapis.com/auth/drive.file'], | ||
| scopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||
| }, | ||
| 'google-sheets': { | ||
| id: 'google-sheets', | ||
|
|
@@ -139,7 +139,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = { | |
| providerId: 'google-sheets', | ||
| icon: (props) => GoogleSheetsIcon(props), | ||
| baseProviderIcon: (props) => GoogleIcon(props), | ||
| scopes: ['https://www.googleapis.com/auth/drive.file'], | ||
| scopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||
| }, | ||
| 'google-forms': { | ||
| id: 'google-forms', | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ export const createTool: ToolConfig<GoogleDocsToolParams, GoogleDocsCreateRespon | |||||
| oauth: { | ||||||
| required: true, | ||||||
| provider: 'google-docs', | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||||||
|
||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | |
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/google_docs/create.ts
Line: 16:16
Comment:
**logic:** Critical scope mismatch: 'drive.readonly' cannot create documents. This tool POSTs to Drive API which requires write permissions, but readonly scope only allows read access.
```suggestion
additionalScopes: ['https://www.googleapis.com/auth/drive.file'],
```
How can I resolve this? If you propose a fix, please make it concise.| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ export const writeTool: ToolConfig<GoogleDocsToolParams, GoogleDocsWriteResponse | |||||
| oauth: { | ||||||
| required: true, | ||||||
| provider: 'google-docs', | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||||||
|
||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | |
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/google_docs/write.ts
Line: 12:12
Comment:
**logic:** This scope is incompatible with write operations. The tool performs document updates via batchUpdate API which requires write permissions, not readonly. This will cause authentication failures at runtime.
```suggestion
additionalScopes: ['https://www.googleapis.com/auth/drive.file'],
```
How can I resolve this? If you propose a fix, please make it concise.| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,7 @@ export const createFolderTool: ToolConfig<GoogleDriveToolParams, GoogleDriveUplo | |||||
| oauth: { | ||||||
| required: true, | ||||||
| provider: 'google-drive', | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||||||
|
||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | |
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/google_drive/create_folder.ts
Line: 13:13
Comment:
**logic:** Using 'drive.readonly' scope for creating folders will fail - this operation requires write permissions. Should use 'https://www.googleapis.com/auth/drive.file' or 'https://www.googleapis.com/auth/drive'
```suggestion
additionalScopes: ['https://www.googleapis.com/auth/drive.file'],
```
How can I resolve this? If you propose a fix, please make it concise.| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ export const listTool: ToolConfig<GoogleDriveToolParams, GoogleDriveListResponse | |
| oauth: { | ||
| required: true, | ||
| provider: 'google-drive', | ||
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], | ||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||
|
||
| }, | ||
|
|
||
| params: { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,7 @@ export const uploadTool: ToolConfig<GoogleDriveToolParams, GoogleDriveUploadResp | |||||
| oauth: { | ||||||
| required: true, | ||||||
| provider: 'google-drive', | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], | ||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | ||||||
|
||||||
| additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], | |
| additionalScopes: ['https://www.googleapis.com/auth/drive.file'], |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/google_drive/upload.ts
Line: 21:21
Comment:
**logic:** Critical issue: Upload tool cannot function with readonly scope. This scope only allows reading files, but upload requires write permissions. Should use `drive.file` or `drive` scope instead.
```suggestion
additionalScopes: ['https://www.googleapis.com/auth/drive.file'],
```
How can I resolve this? If you propose a fix, please make it concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Using readonly scope will break write and create operations. Google Docs write/create requires 'https://www.googleapis.com/auth/drive.file' or broader write permissions.
Prompt To Fix With AI