Description
#6637 and #7111 added support for reading and writing Parquet files with encryption. These add FileDecryptionProperties
and FileEncryptionProperties
types that hold encryption keys as a Vec<u8>
. Precaution should be taken to prevent accidentally exposing these keys and allowing unauthorised access to encrypted data.
In the C++ Parquet implementation for example, these keys are "wiped" after a file is read or written, which is intended to prevent any memory access bugs from being able to expose these keys. But it's known that this wiping isn't very secure as only the first byte of the key is usually overwritten. See apache/arrow#31603 and some of the discussion in apache/arrow#44990.
Ideally these keys should be stored in a type that automatically clears the whole key from memory when it is dropped, eg. something like https://crates.io/crates/secure-string, or a custom abstraction built on top of https://crates.io/crates/zeroize.
We might also want to have a Debug
implementation that doesn't show the key contents to avoid accidental logging of keys.