Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions parquet-hadoop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,16 @@ If `false`, write files in encrypted footer mode, that fully encrypts the footer

---

**Property:** `parquet.encryption.kms.enable.url.read`
**Description:** If a KMS URL is set by writers, it will be stored in the key material. However, by default, it will not be
given to readers because the storage is untrusted. Readers that need the URL should set the KMS URL property.
If they cannot do so, they can enable retrieving the KMS URL from the stored key material by setting this parameter
to `true`. KMS client implementations must validate the URL value and use authentication to prevent key material
tampering attacks that could, for example, result in a KMS access token being sent to a malicious URL endpoint.
**Default value:** `false`

---

**Property:** `parquet.encryption.key.access.token`
**Description:** Authorization token that will be passed to KMS.
**Default value:** `DEFAULT`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ KeyToolkit.KmsClientAndDetails getKmsClientFromConfigOrKeyMaterial(KeyMaterial k

String kmsInstanceURL = hadoopConfiguration.getTrimmed(KeyToolkit.KMS_INSTANCE_URL_PROPERTY_NAME);
if (stringIsEmpty(kmsInstanceURL)) {
kmsInstanceURL = keyMaterial.getKmsInstanceURL();
if (hadoopConfiguration.getBoolean(
KeyToolkit.KMS_ENABLE_URL_READ_PROPERTY_NAME, KeyToolkit.KMS_ENABLE_URL_READ_DEFAULT)) {
kmsInstanceURL = keyMaterial.getKmsInstanceURL();
}

if (null == kmsInstanceURL) {
throw new ParquetCryptoRuntimeException(
"KMS instance URL is missing both in properties and file key material");
kmsInstanceURL = KmsClient.KMS_INSTANCE_URL_DEFAULT;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to change this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will prevent throwing an exception for most of the current users. Today, this exception is never thrown in practice, because the writer always fills the url value (set or default) in the key material, so the reader always gets something, either from properties or from the key material. Now that we skip reading the url from key material by default, the existing readers that don't use the property value, will get an exception. So to prevent it and to preserve the current interface, we drop the exception, and return the KMS_INSTANCE_URL_DEFAULT value (which is given to the readers today, from the key material).

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ public class KeyToolkit {
* URL of the KMS instance.
*/
public static final String KMS_INSTANCE_URL_PROPERTY_NAME = "parquet.encryption.kms.instance.url";
/**
* If a KMS URL is set by writers, it will be stored in the key material. However, by default, it will not be
* provided to readers because the storage is untrusted. Readers that need the URL should set the
* KMS URL property. If they cannot do so, they can enable retrieving the KMS URL from the stored material
* by setting this parameter to true. KMS client implementations must validate the URL value and
* use authentication to prevent key material tampering attacks, which could, for example, send a KMS
* access token to a malicious URL endpoint.
*/
public static final String KMS_ENABLE_URL_READ_PROPERTY_NAME = "parquet.encryption.kms.enable.url.read";

public static final boolean KMS_ENABLE_URL_READ_DEFAULT = false;
/**
* Authorization token that will be passed to KMS.
*/
Expand Down
Loading