From 8e34b51c7700958193cd6b8bd2e44be7d7534beb Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Tue, 25 Oct 2022 14:57:05 +0200 Subject: [PATCH] GODT-1940: Fix message encryption Update liteapi to v0.36.0 to include message encryption fix and fix compile errors related to update. --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/bridge/sync_test.go | 2 +- pkg/message/build.go | 8 +++----- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 447e2a17..382d85cc 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557 github.com/Masterminds/semver/v3 v3.1.1 - github.com/ProtonMail/gluon v0.13.1-0.20221024121621-eaf93a0dafd0 + github.com/ProtonMail/gluon v0.13.1-0.20221025093924-86bbf0261eb8 github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a github.com/ProtonMail/go-rfc5322 v0.11.0 github.com/ProtonMail/gopenpgp/v2 v2.4.10 @@ -38,7 +38,7 @@ require ( github.com/sirupsen/logrus v1.9.0 github.com/stretchr/testify v1.8.0 github.com/urfave/cli/v2 v2.20.3 - gitlab.protontech.ch/go/liteapi v0.35.1-0.20221024102125-605f4712c351 + gitlab.protontech.ch/go/liteapi v0.36.0 go.uber.org/goleak v1.2.0 golang.org/x/exp v0.0.0-20220921164117-439092de6870 golang.org/x/net v0.1.0 diff --git a/go.sum b/go.sum index d4d460a4..0698a00e 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf h1:yc9daCCYUefEs github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf/go.mod h1:o0ESU9p83twszAU8LBeJKFAAMX14tISa0yk4Oo5TOqo= github.com/ProtonMail/docker-credential-helpers v1.1.0 h1:+kvUIpwWcbtP3WFv5sSvkFn/XLzSqPOB5AAthuk9xPk= github.com/ProtonMail/docker-credential-helpers v1.1.0/go.mod h1:mK0aBveCxhnQ756AmaTfXMZDeULvheYVhF/MWMErN5g= -github.com/ProtonMail/gluon v0.13.1-0.20221024121621-eaf93a0dafd0 h1:f1ncQIwvYCkpbDA2qJGALNKPmLPdwn9c7Gj58tS2PaM= -github.com/ProtonMail/gluon v0.13.1-0.20221024121621-eaf93a0dafd0/go.mod h1:XW/gcr4jErc5bX5yMqkUq3U+AucC2QZHJ5L231k3Nw4= +github.com/ProtonMail/gluon v0.13.1-0.20221025093924-86bbf0261eb8 h1:LKyiQdEsAxAocSYUWxSfwlxBwmzJYvO/9td/eAX3oFU= +github.com/ProtonMail/gluon v0.13.1-0.20221025093924-86bbf0261eb8/go.mod h1:XW/gcr4jErc5bX5yMqkUq3U+AucC2QZHJ5L231k3Nw4= github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a h1:D+aZah+k14Gn6kmL7eKxoo/4Dr/lK3ChBcwce2+SQP4= github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a/go.mod h1:oTGdE7/DlWIr23G0IKW3OXK9wZ5Hw1GGiaJFccTvZi4= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= @@ -399,8 +399,8 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0= github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= -gitlab.protontech.ch/go/liteapi v0.35.1-0.20221024102125-605f4712c351 h1:0qom9c2XYMdW1J8JAMBgflL0a8SYwloi9tbE8FV2O2A= -gitlab.protontech.ch/go/liteapi v0.35.1-0.20221024102125-605f4712c351/go.mod h1:VMv325o/Z3h9c6JL7loDVjXF0mqs4/7JbzhGmABxDj8= +gitlab.protontech.ch/go/liteapi v0.36.0 h1:x9bODGDHQxPdnzGPBuzTArLdWJ+jTHpWAwGcvmn8Wig= +gitlab.protontech.ch/go/liteapi v0.36.0/go.mod h1:IM7ADWjgIL2hXopzx0WNamizEuMgM2QZl7QH12FNflk= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= diff --git a/internal/bridge/sync_test.go b/internal/bridge/sync_test.go index 147db32f..057106bc 100644 --- a/internal/bridge/sync_test.go +++ b/internal/bridge/sync_test.go @@ -43,7 +43,7 @@ func TestBridge_Sync(t *testing.T) { userID, addrID, err := s.CreateUser("imap", "imap@pm.me", password) require.NoError(t, err) - labelID, err := s.CreateLabel(userID, "folder", liteapi.LabelTypeFolder) + labelID, err := s.CreateLabel(userID, "folder", "", liteapi.LabelTypeFolder) require.NoError(t, err) withClient(ctx, t, s, "imap", password, func(ctx context.Context, c *liteapi.Client) { diff --git a/pkg/message/build.go b/pkg/message/build.go index fecede2b..d94ded9a 100644 --- a/pkg/message/build.go +++ b/pkg/message/build.go @@ -357,11 +357,9 @@ func writeMultipartEncryptedRFC822(header message.Header, body []byte) ([]byte, return nil, err } - // If parsed header is empty then either it is malformed or it is missing. - // Anyway message could not be considered multipart/mixed anymore since there will be no boundary. - if bodyHeader.Len() == 0 { - header.Del("Content-Type") - } + // Remove old content type header as it is non-standard. Ensure that messages + // without content type header entries don't become invalid. + header.Del("Content-Type") entFields := bodyHeader.Fields()