Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend): Remove Google Sheets API scopes from block inputs (#11484)

Nicholas Tindle0728f3bd49fd
diff --git a/autogpt_platform/backend/backend/blocks/google/_drive.py b/autogpt_platform/backend/backend/blocks/google/_drive.py
index 46fafd6857..3e3ecb2711 100644
--- a/autogpt_platform/backend/backend/blocks/google/_drive.py
+++ b/autogpt_platform/backend/backend/blocks/google/_drive.py
@@ -112,12 +112,6 @@ def GoogleDrivePickerField(
# Use drive.file for minimal scope - only access files selected by user in picker
picker_scopes.add("https://www.googleapis.com/auth/drive.file")
- views = set(allowed_views or [])
- if "SPREADSHEETS" in views:
- picker_scopes.add("https://www.googleapis.com/auth/spreadsheets.readonly")
- if "DOCUMENTS" in views or "DOCS" in views:
- picker_scopes.add("https://www.googleapis.com/auth/documents.readonly")
-
picker_config["scopes"] = sorted(picker_scopes)
# Set appropriate default value
diff --git a/autogpt_platform/backend/backend/blocks/google/sheets.py b/autogpt_platform/backend/backend/blocks/google/sheets.py
index e8d2d1d74a..e35749a72e 100644
--- a/autogpt_platform/backend/backend/blocks/google/sheets.py
+++ b/autogpt_platform/backend/backend/blocks/google/sheets.py
@@ -250,9 +250,7 @@ class BatchOperation(BlockSchemaInput):
class GoogleSheetsReadBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets.readonly"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -375,9 +373,7 @@ class GoogleSheetsReadBlock(Block):
class GoogleSheetsWriteBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -513,9 +509,7 @@ class GoogleSheetsWriteBlock(Block):
class GoogleSheetsAppendBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -696,9 +690,7 @@ class GoogleSheetsAppendBlock(Block):
class GoogleSheetsClearBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -806,9 +798,7 @@ class GoogleSheetsClearBlock(Block):
class GoogleSheetsMetadataBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets.readonly"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -928,9 +918,7 @@ class GoogleSheetsMetadataBlock(Block):
class GoogleSheetsManageSheetBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -1085,9 +1073,7 @@ class GoogleSheetsManageSheetBlock(Block):
class GoogleSheetsBatchOperationsBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -1242,9 +1228,7 @@ class GoogleSheetsBatchOperationsBlock(Block):
class GoogleSheetsFindReplaceBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -1392,9 +1376,7 @@ class GoogleSheetsFindReplaceBlock(Block):
class GoogleSheetsFindBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets.readonly"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -1700,9 +1682,7 @@ class GoogleSheetsFindBlock(Block):
class GoogleSheetsFormatBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",
@@ -1875,9 +1855,7 @@ class GoogleSheetsFormatBlock(Block):
class GoogleSheetsCreateSpreadsheetBlock(Block):
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
title: str = SchemaField(
description="The title of the new spreadsheet",
)
@@ -2017,9 +1995,7 @@ class GoogleSheetsUpdateCellBlock(Block):
"""Update a single cell in a Google Sheets spreadsheet."""
class Input(BlockSchemaInput):
- credentials: GoogleCredentialsInput = GoogleCredentialsField(
- ["https://www.googleapis.com/auth/spreadsheets"]
- )
+ credentials: GoogleCredentialsInput = GoogleCredentialsField([])
spreadsheet: GoogleDriveFile = GoogleDrivePickerField(
title="Spreadsheet",
description="Select a Google Sheets spreadsheet",