From 76cb8ee7d3c9d78945a648d00b535df129a0c0d1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 28 Oct 2025 22:46:29 +0200 Subject: [PATCH] bridgev2/provisioning: add option to skip identifier validation in create group --- bridgev2/networkinterface.go | 4 ++++ bridgev2/provisionutil/creategroup.go | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bridgev2/networkinterface.go b/bridgev2/networkinterface.go index da505435..8a39c7f8 100644 --- a/bridgev2/networkinterface.go +++ b/bridgev2/networkinterface.go @@ -826,6 +826,10 @@ type GroupFieldCapability struct { // Only for the disappear field: allowed disappearing settings DisappearSettings *event.DisappearingTimerCapability `json:"settings,omitempty"` + + // This can be used to tell provisionutil not to call ValidateUserID on each participant. + // It only meant to allow hacks where ResolveIdentifier returns a fake ID that isn't actually valid for MXIDs. + SkipIdentifierValidation bool `json:"-"` } type GroupCreateParams struct { diff --git a/bridgev2/provisionutil/creategroup.go b/bridgev2/provisionutil/creategroup.go index 0df09ff5..55a21b1a 100644 --- a/bridgev2/provisionutil/creategroup.go +++ b/bridgev2/provisionutil/creategroup.go @@ -47,8 +47,10 @@ func CreateGroup(ctx context.Context, login *bridgev2.UserLogin, params *bridgev participant = parsedParticipant params.Participants[i] = participant } - if uidValOK && !userIDValidatingNetwork.ValidateUserID(participant) { - return nil, bridgev2.RespError(mautrix.MInvalidParam.WithMessage("User ID %q is not valid on this network", participant)) + if !typeSpec.Participants.SkipIdentifierValidation { + if uidValOK && !userIDValidatingNetwork.ValidateUserID(participant) { + return nil, bridgev2.RespError(mautrix.MInvalidParam.WithMessage("User ID %q is not valid on this network", participant)) + } } if api.IsThisUser(ctx, participant) { return nil, bridgev2.RespError(mautrix.MInvalidParam.WithMessage("You can't include yourself in the participants list", participant))