Skip to content

Automate browser based workflows with AI

Drop the unused drive.file scope from the Google Sheets consent screen (SKY-13427) (#8202)

Aaron Perezdba2ceb4b609
diff --git a/skyvern-frontend/src/util/googleScopes.ts b/skyvern-frontend/src/util/googleScopes.ts
index c0a8e52c4..80c312dba 100644
--- a/skyvern-frontend/src/util/googleScopes.ts
+++ b/skyvern-frontend/src/util/googleScopes.ts
@@ -1,6 +1,5 @@
export const GOOGLE_SHEETS_REQUIRED_SCOPES = [
"https://www.googleapis.com/auth/spreadsheets",
- "https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.metadata.readonly",
] as const;
diff --git a/skyvern/forge/sdk/services/google_oauth_service.py b/skyvern/forge/sdk/services/google_oauth_service.py
index 292df5a79..35a5fc22f 100644
--- a/skyvern/forge/sdk/services/google_oauth_service.py
+++ b/skyvern/forge/sdk/services/google_oauth_service.py
@@ -58,11 +58,9 @@ GOOGLE_REVOKE_ENDPOINT = "https://oauth2.googleapis.com/revoke"
# Spreadsheets + Drive scopes for the picker UX:
# - spreadsheets: read/write sheet cells and create new spreadsheets
-# - drive.file: list/read spreadsheets this integration created or the user picked
# - drive.metadata.readonly: list file metadata (required for the picker search)
GOOGLE_SHEETS_SCOPES: tuple[str, ...] = (
"https://www.googleapis.com/auth/spreadsheets",
- "https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.metadata.readonly",
)
GOOGLE_GMAIL_READONLY_SCOPE = "https://www.googleapis.com/auth/gmail.readonly"
diff --git a/tests/unit/google/test_google_oauth.py b/tests/unit/google/test_google_oauth.py
index 7a3d4f31d..22b35276d 100644
--- a/tests/unit/google/test_google_oauth.py
+++ b/tests/unit/google/test_google_oauth.py
@@ -68,13 +68,25 @@ def test_coerce_scopes_accepts_strings_and_iterables() -> None:
def test_google_oauth_scope_profiles_are_exact() -> None:
assert google_oauth_service.GOOGLE_SHEETS_SCOPES == (
"https://www.googleapis.com/auth/spreadsheets",
- "https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.metadata.readonly",
)
assert google_oauth_service.GOOGLE_GMAIL_SCOPES == ("https://www.googleapis.com/auth/gmail.readonly",)
assert google_oauth_service.GOOGLE_DRIVE_SCOPES == ("https://www.googleapis.com/auth/drive",)
+def test_sheets_credentials_granted_drive_file_still_satisfy_the_sheets_profile() -> None:
+ """Credentials consented before drive.file left the profile must keep working without reconsent."""
+ granted_with_drive_file = [
+ "https://www.googleapis.com/auth/spreadsheets",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ ]
+ assert google_oauth_service.has_required_scopes(
+ granted_with_drive_file,
+ google_oauth_service.GOOGLE_SHEETS_SCOPES,
+ )
+
+
def test_google_drive_scope_profile_uses_full_drive_scope_for_folder_uploads() -> None:
scopes = google_oauth_service.scopes_for_profile("google_drive")
assert scopes == [