Skip to content

Use a "SecureString" like type to store Parquet encryption keys #7373

Open
@adamreeve

Description

@adamreeve

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAny new improvement worthy of a entry in the changelogparquetChanges to the parquet crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions