Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/architecture/architecture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ var allowedScopes = map[string]bool{
"https://www.googleapis.com/auth/calendar.events": true, // RSVP, color (NOT calendar settings)
"https://www.googleapis.com/auth/contacts.readonly": true,
"https://www.googleapis.com/auth/contacts": true, // group membership, starring (NOT create/delete contacts)
"https://www.googleapis.com/auth/userinfo.profile": true, // read authenticated user's name/email for people/me (NOT contacts list)
"https://www.googleapis.com/auth/drive.readonly": true,
"https://www.googleapis.com/auth/drive.metadata": true, // star/unstar files (NOT file content write)
}
Expand Down
3 changes: 3 additions & 0 deletions internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ import (
// The architecture test (TestNoDestructiveAPIMethodsInProductionCode) prevents accidental misuse.
// Contacts uses the full contacts scope for group management and starring.
// The contacts scope is a superset of contacts.readonly — it includes all read access.
// Profile is required for people/me (names, emailAddresses fields) used by `gro me` and init verification.
var AllScopes = []string{
gmail.GmailModifyScope,
calendar.CalendarReadonlyScope,
calendar.CalendarEventsScope,
people.ContactsScope,
people.UserinfoProfileScope,
drive.DriveReadonlyScope,
drive.DriveMetadataScope,
}
Expand All @@ -43,6 +45,7 @@ var ScopeDescriptions = map[string]string{
calendar.CalendarEventsScope: "Calendar Events — read and update events (RSVP, color). No calendar settings access.",
people.ContactsScope: "Contacts — read contacts and groups, plus manage group membership and starring.",
people.ContactsReadonlyScope: "Contacts Read-Only — read contacts and groups.",
people.UserinfoProfileScope: "Profile — read the authenticated user's name and email address (required for 'gro me').",
drive.DriveReadonlyScope: "Drive Read-Only — read files and metadata.",
drive.DriveMetadataScope: "Drive Metadata — read and update file metadata (star/unstar). No file content write access.",
}
Expand Down
7 changes: 5 additions & 2 deletions internal/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func TestDeprecatedWrappers(t *testing.T) {

func TestAllScopes(t *testing.T) {
t.Parallel()
if len(AllScopes) != 6 {
t.Errorf("got length %d, want %d", len(AllScopes), 6)
if len(AllScopes) != 7 {
t.Errorf("got length %d, want %d", len(AllScopes), 7)
}
scopeSet := strings.Join(AllScopes, " ")
if !strings.Contains(scopeSet, "https://www.googleapis.com/auth/gmail.modify") {
Expand All @@ -123,6 +123,9 @@ func TestAllScopes(t *testing.T) {
if !strings.Contains(scopeSet, "https://www.googleapis.com/auth/drive.metadata") {
t.Errorf("expected AllScopes to contain %q", "https://www.googleapis.com/auth/drive.metadata")
}
if !strings.Contains(scopeSet, "https://www.googleapis.com/auth/userinfo.profile") {
t.Errorf("expected AllScopes to contain %q", "https://www.googleapis.com/auth/userinfo.profile")
}
}

func TestCheckScopesMigration_NoGrantedScopes(t *testing.T) {
Expand Down
Loading