Sanitize strings by default on all platforms.
Instead of sanitizing strings only on iOS, we do it on all platforms.
This commit is contained in:
parent
04803505f8
commit
4971d78a53
4 changed files with 11 additions and 16 deletions
|
|
@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Changed
|
### Changed
|
||||||
- Updated `github.com/ProtonMail/go-mime` to latest versions, which cleans up uneeded dependencies. And fix an issue with PGP/MIME messages with non standard encodings.
|
- Updated `github.com/ProtonMail/go-mime` to latest versions, which cleans up uneeded dependencies. And fix an issue with PGP/MIME messages with non standard encodings.
|
||||||
- iOS only: sanitize strings returned in `MIMECallbacks.OnBody()` and `PlainMessage.GetString()`. Strings that have non utf8 characters will be sanitized to have the "character unknown" character : <20> instead.
|
- Sanitize strings returned in `MIMECallbacks.OnBody()` and `PlainMessage.GetString()`. Strings that have non utf8 characters will be sanitized to have the "character unknown" character : <20> instead.
|
||||||
|
|
||||||
## [2.4.10] 2022-08-22
|
## [2.4.10] 2022-08-22
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -83,7 +84,12 @@ func TestTextMixedMessageDecryptionWithPassword(t *testing.T) {
|
||||||
t.Fatal("Expected no error when decrypting, got:", err)
|
t.Fatal("Expected no error when decrypting, got:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Exactly(t, readTestFile("message_mixedPasswordPublicExpected", true), decrypted.GetString())
|
expected, err := ioutil.ReadFile("testdata/message_mixedPasswordPublicExpected")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Exactly(t, expected, decrypted.GetBinary())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTextMessageEncryption(t *testing.T) {
|
func TestTextMessageEncryption(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
//go:build !ios
|
|
||||||
// +build !ios
|
|
||||||
|
|
||||||
package crypto
|
package crypto
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
func sanitizeString(input string) string {
|
func sanitizeString(input string) string {
|
||||||
return input
|
return strings.ToValidUTF8(input, "\ufffd")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
//go:build ios
|
|
||||||
// +build ios
|
|
||||||
|
|
||||||
package crypto
|
|
||||||
|
|
||||||
import "strings"
|
|
||||||
|
|
||||||
func sanitizeString(input string) string {
|
|
||||||
return strings.ToValidUTF8(input, "\ufffd")
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue