Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
2212103
libs/wire-api: add optional URL field to Invitations.
sysvinit Sep 8, 2022
76e3882
libs/wire-api: update golden tests.
sysvinit Sep 8, 2022
e8d2fed
libs/wire-api: add exposeInvitationURLsToTeamAdmin feature flag defin…
sysvinit Sep 8, 2022
1cf1d5a
galley: add exposeInvitationURLsToTeamAdmin feature flag to Cassandra…
sysvinit Sep 8, 2022
57a6b69
libs/galley-types: add exposeInvitationURLsToTeamAdmin to galley feat…
sysvinit Sep 8, 2022
a069fec
galley: add feature flag toggle logic for exposeInvitationURLsToTeamA…
sysvinit Sep 8, 2022
823da24
libs/wire-api: add galley routes for exposeInvitationURLsToTeamAdmin …
sysvinit Sep 8, 2022
39160c5
galley: implement feature config routes for exposeInvitationURLsToTea…
sysvinit Sep 8, 2022
cf4d9b3
galley: add internal endpoints for exposeInvitationURLsToTeamAdmin fe…
sysvinit Sep 8, 2022
8dd780f
galley: add option for specifying teams with admin-visible invitation…
sysvinit Sep 8, 2022
88130c9
galley: only allow enabling feature for explicitly configured teams
sysvinit Sep 8, 2022
eeac0bf
libs/wire-api: add separate feature flag for team allowlist.
sysvinit Sep 12, 2022
6c557ff
galley: remove lock status for exposeInvitationURLsToTeamAdmin.
sysvinit Sep 12, 2022
ba7e153
libs/galley-types: add feature flag configuration for invite url allo…
sysvinit Sep 12, 2022
507d609
galley: re-scope effect row constraint for exposeInvitationURLsToTeam…
sysvinit Sep 12, 2022
c20b900
galley: add feature status internals for allowlist config.
sysvinit Sep 12, 2022
574d362
galley: use allowlist feature config for setting exposeInvitationURLs…
sysvinit Sep 12, 2022
6d71330
galley: remove top-level configuration option for team allowlist
sysvinit Sep 12, 2022
107671d
libs/{wire-api,galley-types}: lock exposeInvitationURLsToTeamAdmin by…
sysvinit Sep 12, 2022
cbcbe81
galley: validate based on state transition instead of target state.
sysvinit Sep 12, 2022
3c3f2ac
galley: add missing imports to galley-schema
sysvinit Sep 12, 2022
655db60
galley: note to self.
sysvinit Sep 12, 2022
a88e872
brig: add function for checking invite link visibility in galley
sysvinit Sep 12, 2022
b453550
brig: add checks for exposeInvitationUrlsToTeamAdmin in team invite e…
sysvinit Sep 12, 2022
b16c032
brig: swap wrapClient for wrapHttp to handle extra typeclass constrai…
sysvinit Sep 12, 2022
eabaf06
brig: formatting and style.
sysvinit Sep 13, 2022
73d0135
galley: override getConfigForTeam for exposeInvitationURLsToTeamAdmin
sysvinit Sep 13, 2022
74e5fe9
galley: formatting.
sysvinit Sep 13, 2022
b1bb6ef
galley: style
sysvinit Sep 13, 2022
f51f510
Fix type checking issue
supersven Sep 13, 2022
658b160
Fix golden tests
supersven Sep 14, 2022
4ee0994
Ensure the url for invitation QR code is a HttpsUrl
supersven Sep 14, 2022
6b5d079
Less naive approach to HttpsUrl parsing / error handling
supersven Sep 14, 2022
f3ce88a
Add more interesting golden test.
fisx Sep 14, 2022
b53d770
make git-add-cassandra-schema
fisx Sep 14, 2022
d05cdcc
Merge remote-tracking branch 'origin/develop' into sysvinit/feature-i…
fisx Sep 14, 2022
1985013
The list of allowed TeamIds doesn't need to be a feature config
supersven Sep 15, 2022
37e46ce
Invitation URLs may not always be HTTPS
supersven Sep 15, 2022
ccf99e4
Test the basic feature behavior
supersven Sep 15, 2022
55f93cf
Server config takes precedence over team feature config
supersven Sep 15, 2022
b173539
Move test cases
supersven Sep 15, 2022
3e56087
Delete ExposeInvitationURLsTeamAllowlistConfig team feature left overs
supersven Sep 15, 2022
5d0ff3f
Add changelog
supersven Sep 15, 2022
d312ed3
Add allow list config to Helm chart
supersven Sep 15, 2022
0db1bd7
Add section to config-options.md
supersven Sep 15, 2022
6a5248d
Fix Helm chart
supersven Sep 15, 2022
82b83a3
Simplify Galley YAML config
supersven Sep 15, 2022
b2bca90
Fix galley mock setup
supersven Sep 16, 2022
85f4d29
Fix Helm chart
supersven Sep 16, 2022
9d08e5d
Merge remote-tracking branch 'origin/develop' into sysvinit/feature-i…
fisx Sep 16, 2022
6469018
Move allow list from feature flags to settings.
fisx Sep 16, 2022
c2a8ddb
rm trailing whitespace.
fisx Sep 16, 2022
5304f1b
Fixup
fisx Sep 16, 2022
93c9920
Add comment
supersven Sep 16, 2022
480ce95
Simplify expression
supersven Sep 16, 2022
d05c896
Refer to docs in changelog
supersven Sep 16, 2022
1a3c688
Move the decision of invitation url rendering out of DB
supersven Sep 16, 2022
4f603bc
Add FUTUREWORK note
supersven Sep 16, 2022
325b588
Explain why a test case is needed (Haddock)
supersven Sep 16, 2022
1a93732
Remove *all* the lookups to the feature flag from `Brig.Team.DB`.
fisx Sep 16, 2022
904b0b0
Make custom bool.
fisx Sep 16, 2022
f0bb831
Move Bool into the first argument position in all of `Brig.Team.DB`.
fisx Sep 16, 2022
ff74b29
Expose `ShowOrHideInvitationUrl` to application logic consistently.
fisx Sep 16, 2022
96b35f6
Cleanup
fisx Sep 16, 2022
1e69fd0
hlint
fisx Sep 16, 2022
53e4106
ormolu
fisx Sep 16, 2022
9a23835
Merge remote-tracking branch 'origin/develop' into sysvinit/feature-i…
fisx Sep 16, 2022
d03ad32
Simplify expression
supersven Sep 18, 2022
dc543a9
Remove unused import
supersven Sep 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ CREATE TABLE galley_test.team_features (
app_lock_status int,
conference_calling int,
digital_signatures int,
expose_invitation_urls_to_team_admin int,
file_sharing int,
file_sharing_lock_status int,
guest_links_lock_status int,
Expand Down
1 change: 1 addition & 0 deletions changelog.d/2-features/registration-url-in-invitation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Optionally add invitation urls to the body of `/teams/{tid}/invitations`. This allows further processing; e.g. to send those links with custom emails or distribute them as QR codes. See [docs](https://docs.wire.com/developer/reference/config-options.html#expose-invitation-urls-to-team-admin) for details and privacy implications.
9 changes: 6 additions & 3 deletions charts/galley/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ data:
{{- if .settings.maxFanoutSize }}
maxFanoutSize: {{ .settings.maxFanoutSize }}
{{- end }}
{{- if .settings.exposeInvitationURLsTeamAllowlist }}
exposeInvitationURLsTeamAllowlist: {{ .settings.exposeInvitationURLsTeamAllowlist }}
{{- end }}
conversationCodeURI: {{ .settings.conversationCodeURI | quote }}
{{- if .settings.enableIndexedBillingTeamMembers }}
enableIndexedBillingTeamMembers: {{ .settings.enableIndexedBillingTeamMembers }}
Expand Down Expand Up @@ -92,15 +95,15 @@ data:
{{- if .settings.featureFlags.appLock }}
appLock:
{{- toYaml .settings.featureFlags.appLock | nindent 10 }}
{{- end }}
{{- end }}
{{- if .settings.featureFlags.conferenceCalling }}
conferenceCalling:
{{- toYaml .settings.featureFlags.conferenceCalling | nindent 10 }}
{{- end }}
{{- end }}
{{- if .settings.featureFlags.selfDeletingMessages }}
selfDeletingMessages:
{{- toYaml .settings.featureFlags.selfDeletingMessages | nindent 10 }}
{{- end }}
{{- end }}
{{- if .settings.featureFlags.conversationGuestLinks }}
conversationGuestLinks:
{{- toYaml .settings.featureFlags.conversationGuestLinks | nindent 10 }}
Expand Down
3 changes: 2 additions & 1 deletion charts/galley/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config:
settings:
httpPoolSize: 128
maxTeamSize: 10000
exposeInvitationURLsTeamAllowlist: []
maxConvSize: 500
# Before making indexedBillingTeamMember true while upgrading, please
# refer to notes here: https://github.com/wireapp/wire-server-deploy/releases/tag/v2020-05-15
Expand Down Expand Up @@ -79,7 +80,7 @@ config:
validateSAMLemails:
defaults:
status: enabled

aws:
region: "eu-west-1"
proxy: {}
Expand Down
47 changes: 47 additions & 0 deletions docs/src/developer/reference/config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,53 @@ IMPORTANT: If you switch this back to `disabled-permanently` from
that have created them while it was allowed. This may change in the
future.

### Expose invitation URLs to team admin

For further processing (e.g. sending custom emails or rendering the URLs as QR
codes), team invitation URLs can be made part of the result of
`GET /teams/{tid}/invitations`.

```json
{
"has_more": false,
"invitations": [
{
"created_at": "2022-09-15T15:47:28.577Z",
"created_by": "375f56fe-7f12-4c0c-aed8-d48c0326d1fb",
"email": "foo@example.com",
"id": "4decf7f8-bdd4-43b3-aaf2-e912e2c0c46f",
"name": null,
"phone": null,
"role": "member",
"team": "51612209-3b61-49b0-8c55-d21ae65efc1a",
"url": "http://127.0.0.1:8080/register?team=51612209-3b61-49b0-8c55-d21ae65efc1a&team_code=RpxGkK_yjw8ZBegJuFQO0hha-2Tneajp"
}
]
}
```

This can be a privacy issue as it allows the team admin to impersonate as
another team member. The feature is disabled by default.

To activate this feature two steps are needed. First, the team id (tid) has to
be added to the list of teams for which this feature *can* be enabled
(`exposeInvitationURLsTeamAllowlist`). This is done in `galley`'s `values.yaml`:

```yaml
settings:
exposeInvitationURLsTeamAllowlist: ["51612209-3b61-49b0-8c55-d21ae65efc1a", ...]
```

Then, the feature can be set for the team by enabling the
`exposeInvitationURLsToTeamAdmin` flag. This is done by making a `PUT` request
to `/teams/{tid}/features/exposeInvitationURLsToTeamAdmin` with the body:

```json
{
"status": "enabled"
}
```

### Team searchVisibility

The team flag `searchVisibility` affects the outbound search of user
Expand Down
2 changes: 2 additions & 0 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,8 @@ type FeatureAPI =
:<|> FeatureStatusPut '() SndFactorPasswordChallengeConfig
:<|> FeatureStatusGet MLSConfig
:<|> FeatureStatusPut '() MLSConfig
:<|> FeatureStatusGet ExposeInvitationURLsToTeamAdminConfig
:<|> FeatureStatusPut '() ExposeInvitationURLsToTeamAdminConfig
:<|> FeatureStatusGet SearchVisibilityInboundConfig
:<|> FeatureStatusPut '() SearchVisibilityInboundConfig
:<|> AllFeatureConfigsUserGet
Expand Down
31 changes: 28 additions & 3 deletions libs/wire-api/src/Wire/API/Team/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ module Wire.API.Team.Feature
DigitalSignaturesConfig (..),
ConferenceCallingConfig (..),
GuestLinksConfig (..),
ExposeInvitationURLsToTeamAdminConfig (..),
SndFactorPasswordChallengeConfig (..),
SearchVisibilityInboundConfig (..),
ClassifiedDomainsConfig (..),
Expand Down Expand Up @@ -579,6 +580,7 @@ allFeatureModels =
withStatusNoLockModel @SndFactorPasswordChallengeConfig,
withStatusNoLockModel @SearchVisibilityInboundConfig,
withStatusNoLockModel @MLSConfig,
withStatusNoLockModel @ExposeInvitationURLsToTeamAdminConfig,
withStatusModel @LegalholdConfig,
withStatusModel @SSOConfig,
withStatusModel @SearchVisibilityAvailableConfig,
Expand All @@ -592,7 +594,8 @@ allFeatureModels =
withStatusModel @GuestLinksConfig,
withStatusModel @SndFactorPasswordChallengeConfig,
withStatusModel @SearchVisibilityInboundConfig,
withStatusModel @MLSConfig
withStatusModel @MLSConfig,
withStatusModel @ExposeInvitationURLsToTeamAdminConfig
]
<> catMaybes
[ configModel @LegalholdConfig,
Expand All @@ -608,7 +611,8 @@ allFeatureModels =
configModel @GuestLinksConfig,
configModel @SndFactorPasswordChallengeConfig,
configModel @SearchVisibilityInboundConfig,
configModel @MLSConfig
configModel @MLSConfig,
configModel @ExposeInvitationURLsToTeamAdminConfig
]

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -939,6 +943,24 @@ instance IsFeatureConfig MLSConfig where
Doc.property "allowedCipherSuites" (Doc.array Doc.int32') $ Doc.description "cipher suite numbers, See https://messaginglayersecurity.rocks/mls-protocol/draft-ietf-mls-protocol.html#table-5"
Doc.property "defaultCipherSuite" Doc.int32' $ Doc.description "cipher suite number. See https://messaginglayersecurity.rocks/mls-protocol/draft-ietf-mls-protocol.html#table-5"

----------------------------------------------------------------------
-- ExposeInvitationURLsToTeamAdminConfig

data ExposeInvitationURLsToTeamAdminConfig = ExposeInvitationURLsToTeamAdminConfig
deriving stock (Show, Eq, Generic)
deriving (Arbitrary) via (GenericUniform ExposeInvitationURLsToTeamAdminConfig)

instance IsFeatureConfig ExposeInvitationURLsToTeamAdminConfig where
type FeatureSymbol ExposeInvitationURLsToTeamAdminConfig = "exposeInvitationURLsToTeamAdmin"
defFeatureStatus = withStatus FeatureStatusDisabled LockStatusLocked ExposeInvitationURLsToTeamAdminConfig FeatureTTLUnlimited
objectSchema = pure ExposeInvitationURLsToTeamAdminConfig

instance ToSchema ExposeInvitationURLsToTeamAdminConfig where
schema = object "ExposeInvitationURLsToTeamAdminConfig" objectSchema

instance FeatureTrivialConfig ExposeInvitationURLsToTeamAdminConfig where
trivialConfig = ExposeInvitationURLsToTeamAdminConfig

----------------------------------------------------------------------
-- FeatureStatus

Expand Down Expand Up @@ -1007,7 +1029,8 @@ data AllFeatureConfigs = AllFeatureConfigs
afcSelfDeletingMessages :: WithStatus SelfDeletingMessagesConfig,
afcGuestLink :: WithStatus GuestLinksConfig,
afcSndFactorPasswordChallenge :: WithStatus SndFactorPasswordChallengeConfig,
afcMLS :: WithStatus MLSConfig
afcMLS :: WithStatus MLSConfig,
afcExposeInvitationURLsToTeamAdmin :: WithStatus ExposeInvitationURLsToTeamAdminConfig
}
deriving stock (Eq, Show)
deriving (FromJSON, ToJSON, S.ToSchema) via (Schema AllFeatureConfigs)
Expand All @@ -1030,6 +1053,7 @@ instance ToSchema AllFeatureConfigs where
<*> afcGuestLink .= featureField
<*> afcSndFactorPasswordChallenge .= featureField
<*> afcMLS .= featureField
<*> afcExposeInvitationURLsToTeamAdmin .= featureField
where
featureField ::
forall cfg.
Expand All @@ -1054,5 +1078,6 @@ instance Arbitrary AllFeatureConfigs where
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary

makeLenses ''ImplicitLockStatus
11 changes: 9 additions & 2 deletions libs/wire-api/src/Wire/API/Team/Invitation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import Data.Id
import Data.Json.Util
import qualified Data.Swagger.Build.Api as Doc
import Imports
import URI.ByteString
import Wire.API.Team.Role (Role, defaultRole, typeRole)
import Wire.API.User.Identity (Email, Phone)
import Wire.API.User.Profile (Locale, Name)
Expand Down Expand Up @@ -104,7 +105,8 @@ data Invitation = Invitation
inCreatedBy :: Maybe UserId,
inInviteeEmail :: Email,
inInviteeName :: Maybe Name,
inInviteePhone :: Maybe Phone
inInviteePhone :: Maybe Phone,
inInviteeUrl :: Maybe (URIRef Absolute)
}
deriving stock (Eq, Show, Generic)
deriving (Arbitrary) via (GenericUniform Invitation)
Expand Down Expand Up @@ -134,6 +136,9 @@ modelTeamInvitation = Doc.defineModel "TeamInvitation" $ do
Doc.property "phone" Doc.string' $ do
Doc.description "Phone number of the invitee, in the E.164 format"
Doc.optional
Doc.property "url" Doc.string' $ do
Doc.description "URL of the invitation link to be sent to the invitee"
Doc.optional

instance ToJSON Invitation where
toJSON i =
Expand All @@ -145,7 +150,8 @@ instance ToJSON Invitation where
"created_by" .= inCreatedBy i,
"email" .= inInviteeEmail i,
"name" .= inInviteeName i,
"phone" .= inInviteePhone i
"phone" .= inInviteePhone i,
"url" .= inInviteeUrl i
]

instance FromJSON Invitation where
Expand All @@ -160,6 +166,7 @@ instance FromJSON Invitation where
<*> o .: "email"
<*> o .:? "name"
<*> o .:? "phone"
<*> o .:? "url"

--------------------------------------------------------------------------------
-- InvitationList
Expand Down
Loading