π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Validate registered notification keys for HPKE
AmanRajSinghMourya4877c586077e
diff --git a/server/migrations/152_push_notification_keys.up.sql b/server/migrations/152_push_notification_keys.up.sqlindex f92530eeff..895455b315 100644--- a/server/migrations/152_push_notification_keys.up.sql+++ b/server/migrations/152_push_notification_keys.up.sql@@ -1,2 +1,2 @@ALTER TABLE push_tokens ADD COLUMN notification_public_key BYTEA- CHECK (notification_public_key IS NULL OR octet_length(notification_public_key) = 32);+ CHECK (notification_public_key IS NULL OR octet_length(notification_public_key) = 1216);diff --git a/server/pkg/controller/push.go b/server/pkg/controller/push.goindex d92d02c567..111524cd6f 100644--- a/server/pkg/controller/push.go+++ b/server/pkg/controller/push.go@@ -3,7 +3,7 @@ package controllerimport ("bytes""context"- "encoding/base64"+ "crypto/hpke""encoding/json""errors""fmt"@@ -18,7 +18,6 @@ import ("github.com/ente/museum/ente""github.com/ente/museum/pkg/repo""github.com/ente/museum/pkg/utils/config"- "github.com/ente/museum/pkg/utils/crypto""github.com/ente/museum/pkg/utils/time""github.com/ente/stacktrace"log "github.com/sirupsen/logrus"@@ -103,7 +102,7 @@ func newFCMClient() (*fcmClient, error) {func (c *PushController) AddToken(userID int64, sessionTokenHash []byte, token ente.PushTokenRequest) error {if token.NotificationKey != nil {- if err := crypto.ValidateSealedBoxPublicKey(base64.StdEncoding.EncodeToString(token.NotificationKey)); err != nil {+ if _, err := hpke.MLKEM768X25519().NewPublicKey(token.NotificationKey); err != nil {return ente.NewBadRequestWithMessage("invalid notification public key")}}