cossacklabs / acra

Database security suite. Database proxy with field-level encryption, search through encrypted data, SQL injections prevention, intrusion detection, honeypots. Supports client-side and proxy-side ("transparent") encryption. SQL, NoSQL.
https://www.cossacklabs.com/acra/
Apache License 2.0
1.35k stars 128 forks source link

[T2580] Fix handling null values in mysql #543

Closed Lagovas closed 2 years ago

Lagovas commented 2 years ago

On decryption our envelope_detector returned []byte{} on nil values instead leaving nil. MySQL encoded differently empty strings and NULL values. NULL values should have 0xfb value. So on Acra side when it receive null value as 0xfb then it changed to empty array and encode it as LengthEncoded String or Integer that are incorrect.

So in this PR removed processing null data in crypto envelope. If it will be empty array, it will be returned as empty array too.

Checklist