themis
themis copied to clipboard
react-native-themis - Sealed encryption crashes for empty string
Describe the bug
When secureCellSealWithSymmetricKeyEncrypt64()
is called on an empty string, a native exception is thrown. If this is by design, it should be documented. Themis should consider handling this condition internally, since empty fields are a common occurrence for field-level encryption scenarios (e.g. imagine a user creating a to-do with an empty description field, and all user content-generated fields are encrypted).
To Reproduce Steps to reproduce the behavior:
- In a React Native project with
react-native-themis
installed, run the following code:
const key = "ANY_BYTE_ARRAY";
const emptyText = "";
// This code will throw a native exception
await secureCellSealWithSymmetricKeyEncrypt64(key, emptyText);
- Observe the exception:
Expected behavior The encryption should no-op in Themis for empty strings.
Environment (please complete the following information):
- OS: iOS 15.2
- Hardware: iOS Simulator
- Themis version: react-native-themis 0.14.4
- Installation way:
- [x] via package manager
- [ ] built from source
Thank you, @tom-at-pixel! We'll take a look.
i guess it's fixed in the latest release 0.14.7 https://github.com/cossacklabs/themis/releases/tag/0.14.7
@tom-at-pixel please take a look
Thanks @vixentael, that's great!