Repository navigation
Allow restricting share recipients to an allowlist - #3
Closed
pragmabits wants to merge 1 commit into
Closed
pragmabits wants to merge 1 commit into
pragmabits wants to merge 1 commit into
Conversation
share_spreadsheet will invite any address the caller supplies, which is the one path through which this server hands data to someone outside it. SHARE_ALLOWED_EMAILS now optionally narrows that: 'user@host' permits one address and '@host' a whole domain. Recipients outside the list are reported under failures without an invitation being sent, so the existing successes/failures contract is unchanged. Leaving the variable unset keeps sharing unrestricted, so installations that do not want the feature see no difference. Domains are compared exactly rather than by suffix, otherwise '@example.com' would also admit 'notexample.com'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
share_spreadsheetinvites any address the caller supplies. It is the one path through which this server hands data to someone outside it, and the Drive permissions of the credential do not constrain it: a service account limited to a single folder can still share a file from that folder with a stranger.Removing the tool via
ENABLED_TOOLScovers the extreme case, but not the common one — wanting to share, only with known destinations.Change
SHARE_ALLOWED_EMAILSoptionally narrows who can be invited:user@hostpermits one address@hostpermits a whole domainRecipients outside the list are reported under
failureswithout an invitation being sent, so the existing{successes, failures}contract is unchanged.Opt-in, with the default preserved
Leaving the variable unset keeps sharing unrestricted. Installations that do not want the feature see no difference and need no configuration.
Note this is the opposite of a fail-closed default: an empty list means "no restriction", not "block everyone". Blocking everything is already achievable by dropping the tool from
ENABLED_TOOLS.Notes
@example.comwould also admitnotexample.com. There is a dedicated test for it.