-
Notifications
You must be signed in to change notification settings - Fork 334
Feature flag for exposing invite URLs to team admins [SQPIT-1368] #2684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
The logic for determining whether this feature is enabled and/or locked for a given team is more nuanced than the default implementation.
9fda742 to
96b35f6
Compare
fisx
approved these changes
Sep 16, 2022
Contributor
fisx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contributor
actually, "not needed" is correct, but not for this reason. we need routing from nginz, but it already covers the new end-points: |
Co-authored-by: fisx <[email protected]>
8 tasks
isovector
added a commit
to isovector/wire-server
that referenced
this pull request
Oct 3, 2022
1 task
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.
https://wearezeta.atlassian.net/browse/SQPIT-1368
This PR extends the payload of the
/team/:tid/invitationendpoints inbrigto optionally return invitation URLs, so team admins can distribute them by means other than email. This functionality is gated behind a team feature flag ingalley. As invitation URLs are otherwise considered sensitive, and enabling this feature might allow team admins to undermine the security of email validation, teams where this feature is enabled must be explicitly listed in thegalleyconfiguration file.On the
galleyside, this introduces two new feature flags.exposeInvitationURLsToTeamAdminis a team-scoped feature (with getter and setter routes in the public API) which controls whether the invitation URLs are exposed in thebriginvitation endpoints.exposeInvitationURLsTeamAllowlistis a site-scoped feature (with no per-team settings) which specifies a list of teams for which the former flag may be enabled.The logic for reading and toggling the
exposeInvitationURLsToTeamAdminflag depends on whether the team ID is named in the allowlist.galleywill always report that the feature is locked and disabled for that team. There is a single exception here, in that if the feature is unlocked, a team is not in the allowlist, but they have the feature enabled in the database (because the team was previously in the allowlist and the team admin had explicitly enabled it at the time), thengalleywill report that the feature is enabled for that team up until the point where they disable it, at which point it becomes locked and disabled.Given its sensitivity, I've intentionally written these features so that
exposeInvitationURLsToTeamAdmindefaults to disabled and locked, and even when enabled requires a team allowlist to be configured, so that explicit operator effort is required to turn it on.On the
brigside, I've added a new optional field to theInvitationtype for the invite URL, and I've extended the handlers for the invitation API so they first check the status of the team feature ingalley, and then populate the URL field in the invitation payload if the feature is enabled for the given team. Annoyingly, this adds a round trip togalleyfor every call to the invitation API, and requires adding a stack of extra typeclass constraints to add all the capabilities required for making calls togalley(previously onlyMonadClientwas needed, for the Cassandra queries) in these codepaths.TODO:
Integration tests (test cases and galley configuration)(Delayed to a later PR. Manually tested instead.)Add new feature endpoints to nginz(Not needed. we only add a field to an existing endpoint's body.)Someone else is free to pick this one up while I'm out of office later this week.
Checklist
changelog.d