reject group invites without a corresponding key bundle
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Sarah Jamie Lewis 2021-06-09 13:26:02 -07:00
parent 957558165d
commit aa6f2499b9
1 changed files with 4 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"golang.org/x/crypto/ed25519"
"io"
@ -390,6 +391,9 @@ func (p *Profile) GetGroup(groupID string) (g *Group) {
func (p *Profile) ProcessInvite(invite string) (string, error) {
gci, err := ValidateInvite(invite)
if err == nil {
if _, exists := p.GetContact(gci.ServerHost); !exists {
return "", fmt.Errorf("unknown server. a server key bundle needs to be imported before this group can be verified")
}
group := new(Group)
group.Version = CurrentGroupVersion
group.GroupID = gci.GroupID