From b51da277770b1c17414a62f44183ec5f1695ffc9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 18 Nov 2025 16:33:01 +0000 Subject: [PATCH] drive: add --metadata-force-expansive-access flag - Fixes #8980 This allows the permissions changes happening in Feb 2026 to be tested in advance. --- backend/drive/drive.go | 13 +++++++++++++ backend/drive/metadata.go | 2 ++ 2 files changed, 15 insertions(+) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index ffccadbd5..2c7a3aa63 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -733,6 +733,17 @@ two accounts. Advanced: true, Default: rwOff, Examples: rwExamples, + }, { + Name: "metadata_enforce_expansive_access", + Help: `Whether the request should enforce expansive access rules. + +From Feb 2026 this flag will be set by default so this flag can be used for +testing before then. + +See: https://developers.google.com/workspace/drive/api/guides/limited-expansive-access +`, + Advanced: true, + Default: false, }, { Name: config.ConfigEncoding, Help: config.ConfigEncodingHelp, @@ -812,6 +823,7 @@ type Options struct { MetadataOwner rwChoice `config:"metadata_owner"` MetadataPermissions rwChoice `config:"metadata_permissions"` MetadataLabels rwChoice `config:"metadata_labels"` + EnforceExpansiveAccess bool `config:"metadata_enforce_expansive_access"` Enc encoder.MultiEncoder `config:"encoding"` EnvAuth bool `config:"env_auth"` } @@ -3092,6 +3104,7 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, _, err = f.svc.Permissions.Create(id, permission). Fields(""). SupportsAllDrives(true). + EnforceExpansiveAccess(f.opt.EnforceExpansiveAccess). Context(ctx).Do() return f.shouldRetry(ctx, err) }) diff --git a/backend/drive/metadata.go b/backend/drive/metadata.go index 2a56ce233..5e837fa50 100644 --- a/backend/drive/metadata.go +++ b/backend/drive/metadata.go @@ -149,6 +149,7 @@ func (f *Fs) setPermissions(ctx context.Context, info *drive.File, permissions [ _, err := f.svc.Permissions.Create(info.Id, perm). SupportsAllDrives(true). SendNotificationEmail(false). + EnforceExpansiveAccess(f.opt.EnforceExpansiveAccess). Context(ctx).Do() return f.shouldRetry(ctx, err) }) @@ -483,6 +484,7 @@ func (f *Fs) setOwner(ctx context.Context, info *drive.File, owner string) (err SupportsAllDrives(true). TransferOwnership(true). // SendNotificationEmail(false). - required apparently! + EnforceExpansiveAccess(f.opt.EnforceExpansiveAccess). Context(ctx).Do() return f.shouldRetry(ctx, err) })