11 Legacy public-share inventory & cleanup
Sharing defaults are prospective: tightening them leaves every file that is already link-shared to anyone, or shared domain-wide, exactly as it was. This runbook enumerates those files with GAM — the console will not show sharing state in bulk — triages each row into justified or not against a register, revokes the rest, and then re-runs on a schedule and diffs against the register. The recurring diff is what makes it a control rather than a one-off tidy-up.
Documentation: Take action based on search results
Caveats
- Cleanup without the recurring diff is a one-off — and tightening the org-wide sharing default (№13) revokes nothing retroactively, so neither half works without the other.
- Files owned by suspended or deleted users still surface publicly — transfer ownership before you delete an account, or the share outlives the identity.
Setup steps
-
gam all users print filelist fields id,name,owners.emailaddress,permissions,webviewlink > shares.csv - open ↗
https://admin.google.com/ac/sc/investigation · captured 2026-07-15
Keep rows where permissions.*.type = anyone (allowFileDiscovery true or false) or type = domain; write that permission's id to a permId column
-
Output two lists: public-approved.csv (documented) and public-revoke.csv
-
gam csv public-revoke.csv gam user "~owners.0.emailAddress" delete drivefileacl "~id" "~permId" - open ↗
https://admin.google.com/ac/managedsettings/55656082996/sharing · captured 2026-07-15
Apps › Google Workspace › Drive and Docs › Sharing settings- Sharing outside of your organization
Off, or Allowlisted domains- General access default
Private to the owner
-
Monthly cron: re-run print filelist → diff vs public-approved.csv → alert on new rows
Ongoing maintenance
- automatable: script Monthly: re-run the sweep and diff against the exceptions register.
- requires a human Per finding: contact the owner and revoke or register the share.
How to verify
-
Re-run the public-link inventory; the result should be empty or exactly the approved exceptions register.
gam all users print filelist query "visibility='anyoneWithLink' or visibility='anyoneCanFind' or visibility='domainWithLink' or visibility='domainCanFind'" fields id,title,owners
v0.1.3 Prevent policy #15 · #12 ↗