← All controls

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.

Caveats

Setup steps

  1. gam all users print filelist fields id,name,owners.emailaddress,permissions,webviewlink > shares.csv

    Method: files.list ↗

  2. open ↗

    Keep rows where permissions.*.type = anyone (allowFileDiscovery true or false) or type = domain; write that permission's id to a permId column

  3. Output two lists: public-approved.csv (documented) and public-revoke.csv

  4. gam csv public-revoke.csv gam user "~owners.0.emailAddress" delete drivefileacl "~id" "~permId"

    Method: permissions.delete ↗

  5. open ↗ Apps › Google Workspace › Drive and Docs › Sharing settings
    Sharing outside of your organization
    Off, or Allowlisted domains
    General access default
    Private to the owner

    Manage external sharing for your organization ↗ Set general access sharing options for your organization ↗

  6. Monthly cron: re-run print filelist → diff vs public-approved.csv → alert on new rows

Ongoing maintenance

How to verify

  1. 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.3Prevent policy #15 · #12 ↗