You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/06/04 07:27:10 UTC
[GitHub] [iceberg] jackye1995 opened a new pull request #2675: Core: add key_metadata to ManifestFile spec
jackye1995 opened a new pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675
@flyrain @rdblue @ggershinsky
first step based on draft #2520, simply add `keyMetadata` to the interface and implementations, pass in `null` for any caller.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r645849860
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -399,6 +415,7 @@ public String toString() {
.add("deleted_data_files_count", deletedFilesCount)
.add("deleted_rows_count", deletedRowsCount)
.add("partitions", partitions)
+ .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
Review comment:
That makes sense to me. 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] RussellSpitzer commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
RussellSpitzer commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r650073436
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -124,6 +128,7 @@ public GenericManifestFile(String path, long length, int specId, ManifestContent
this.deletedRowsCount = deletedRowsCount;
this.partitions = partitions == null ? null : partitions.toArray(new PartitionFieldSummary[0]);
this.fromProjectionPos = null;
+ this.keyMetadata = ByteBuffers.toByteArray(keyMetadata);
Review comment:
Do we need a null guard here?
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -399,6 +415,7 @@ public String toString() {
.add("deleted_data_files_count", deletedFilesCount)
.add("deleted_rows_count", deletedRowsCount)
.add("partitions", partitions)
+ .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
Review comment:
So maybe we should just drop this from toString? I'm fine with that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r651295477
##########
File path: api/src/test/java/org/apache/iceberg/TestHelpers.java
##########
@@ -346,6 +350,11 @@ public Long deletedRowsCount() {
return partitions;
}
+ @Override
+ public ByteBuffer keyMetadata() {
Review comment:
Is this used in tests? We could just allow this to use the default implementation, unless we added tests that exercise it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] jackye1995 commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
jackye1995 commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r645811936
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -399,6 +415,7 @@ public String toString() {
.add("deleted_data_files_count", deletedFilesCount)
.add("deleted_rows_count", deletedRowsCount)
.add("partitions", partitions)
+ .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
Review comment:
I would actually be more against using this approach to support redact, for 2 reasons:
1. this is only for `toString`. If you really want to see the details of the key metadata you can read through the manifest table, and that should show the information fully if you can decrypt an encrypted manifest list. I think that provides better access control. Changing `toString` feels to me like opening a backdoor.
2. if we can encrypt a manifest, we should be able to support redact configuration natively through encryption manager as a part of data masking. When we can do that, you don't need a forked version to use a custom static method for this purpose.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue merged pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
rdblue merged pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r645363982
##########
File path: api/src/main/java/org/apache/iceberg/ManifestFile.java
##########
@@ -179,6 +181,13 @@ default boolean hasDeletedFiles() {
*/
List<PartitionFieldSummary> partitions();
+ /**
+ * Returns metadata about how this manifest file is encrypted, or null if the file is stored in plain text.
+ */
+ default ByteBuffer keyMetadata() {
+ return null;
+ }
Review comment:
Is there any way to avoid using `null` as the return argument for `default` methods?
This particular case isn't too bad, as the `null` return value is documented and has semantic meaning. But I've noticed that we return `null` for a number of methods in base classes or default methods in interfaces, many times where it's expected that the child classes _will_ override the method, that could lead to bad results.
So partially I wanted to bring that issue up as it seems to be a code style that is employed sometimes that is somewhat unsafe, and I've noticed it in a few PRs recently.
[I recently fixed a bug](https://github.com/apache/iceberg/pull/2630/files#diff-1ae8e9490fe1a4b6da8842c1c313fa57e68a674e186bfeace1c763bee1381faaL72-L74) arising from a similar situation - in this case, `BaseMetastoreTableOperations#tableName`, which should have been `abstract` as all catalogs needed to implement it, that was subsequently not overridden by `NessieTableOperations` and would have lead to all of the issues one can imagine with unexpected nulls in a PR that was being merged at the time.
##########
File path: api/src/main/java/org/apache/iceberg/ManifestFile.java
##########
@@ -179,6 +181,13 @@ default boolean hasDeletedFiles() {
*/
List<PartitionFieldSummary> partitions();
+ /**
+ * Returns metadata about how this manifest file is encrypted, or null if the file is stored in plain text.
+ */
+ default ByteBuffer keyMetadata() {
+ return null;
+ }
Review comment:
Having looked through the PR further, I think the usage of `null` here is definitely justified. Especially as the utility methods in `ByteBuffers` handle null already so there's not too much extra null handling, and the physical type needs to be byte[] for Avro.
Feel free to resolve this, but I've seen this in a number of PRs recently where the `null` return value was more just a stand in for `abstract` and I felt it would be good to draw attention to this in general as it seems to be creeping into the codebase here and there. However, this is not one of those cases. 🙂
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] jackye1995 commented on pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
jackye1995 commented on pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#issuecomment-860833293
@RussellSpitzer we are not waiting for anyone to merge, but I thought for any format v2 change @rdblue should take a look and approve. If it's not necessary we will merge to unblock other subsequent changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r651296684
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -399,6 +415,7 @@ public String toString() {
.add("deleted_data_files_count", deletedFilesCount)
.add("deleted_rows_count", deletedRowsCount)
.add("partitions", partitions)
+ .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
Review comment:
I'm also fine dropping this from `toString`. I think the main concern is that we don't want to dump binary key metadata as a string. I'm fine if this shows nothing at all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r645380903
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -399,6 +415,7 @@ public String toString() {
.add("deleted_data_files_count", deletedFilesCount)
.add("deleted_rows_count", deletedRowsCount)
.add("partitions", partitions)
+ .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
Review comment:
Given we're adding a number of encryption related PRs, most of which have very sensitive data in them (encryption keys), would it make sense to make this into a utility function, such as `EncryptionUtils.toRedactedString(byte[] value)`?
We could have a unified way of redacting, which could also reduce the null checks in the code.
It would give people the option of possibly customizing the way in which they redact keys (say, in a fork or something or via an override) that redacts in the way that allows SREs to better assist customers - for example, I can imagine that there _might_ be utility in showing the first 2 or 4 bytes or something so as to be able to check that the key is definitively not the same as another one (would defer to the experts on how insecure it is to allow logging any portion of the key or a hash of a portion at all).
Not sure how much benefit people would have in custom redaction for stringifying (either for checking if the key metadata is definitively not the same or something else), but throwing that out there as I'm curious to hear if there is any utility in not entirely redacting, from a usability / debugging standpoint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] kbendick commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
kbendick commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r645363982
##########
File path: api/src/main/java/org/apache/iceberg/ManifestFile.java
##########
@@ -179,6 +181,13 @@ default boolean hasDeletedFiles() {
*/
List<PartitionFieldSummary> partitions();
+ /**
+ * Returns metadata about how this manifest file is encrypted, or null if the file is stored in plain text.
+ */
+ default ByteBuffer keyMetadata() {
+ return null;
+ }
Review comment:
Is there any way to avoid using `null` as the return argument for `default` methods?
This particular case isn't too bad, as the `null` return value is documented and has semantic meaning. But I've noticed that we return `null` for a number of methods in base classes or default methods in interfaces, many times where it's expected that the child classes _will_ override the method, that could lead to bad results.
So partially I wanted to bring that issue up as it seems to be a code style that is employed sometimes that is somewhat unsafe, and I've noticed it in a few PRs recently.
[I recently fixed a bug](https://github.com/apache/iceberg/pull/2630/files#diff-1ae8e9490fe1a4b6da8842c1c313fa57e68a674e186bfeace1c763bee1381faaL72-L74) arising from a similar situation - in this case, `BaseMetastoreTableOperations#tableName`, which should have been `abstract` as all catalogs needed to implement it, that was subsequently not overridden by `NessieTableOperations` and would have lead to all of the issues one can imagine with unexpected nulls in a PR that was being merged at the time.
##########
File path: api/src/main/java/org/apache/iceberg/ManifestFile.java
##########
@@ -179,6 +181,13 @@ default boolean hasDeletedFiles() {
*/
List<PartitionFieldSummary> partitions();
+ /**
+ * Returns metadata about how this manifest file is encrypted, or null if the file is stored in plain text.
+ */
+ default ByteBuffer keyMetadata() {
+ return null;
+ }
Review comment:
Having looked through the PR further, I think the usage of `null` here is definitely justified. Especially as the utility methods in `ByteBuffers` handle null already so there's not too much extra null handling, and the physical type needs to be byte[] for Avro.
Feel free to resolve this, but I've seen this in a number of PRs recently where the `null` return value was more just a stand in for `abstract` and I felt it would be good to draw attention to this in general as it seems to be creeping into the codebase here and there. However, this is not one of those cases. 🙂
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -399,6 +415,7 @@ public String toString() {
.add("deleted_data_files_count", deletedFilesCount)
.add("deleted_rows_count", deletedRowsCount)
.add("partitions", partitions)
+ .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
Review comment:
Given we're adding a number of encryption related PRs, most of which have very sensitive data in them (encryption keys), would it make sense to make this into a utility function, such as `EncryptionUtils.toRedactedString(byte[] value)`?
We could have a unified way of redacting, which could also reduce the null checks in the code.
It would give people the option of possibly customizing the way in which they redact keys (say, in a fork or something or via an override) that redacts in the way that allows SREs to better assist customers - for example, I can imagine that there _might_ be utility in showing the first 2 or 4 bytes or something so as to be able to check that the key is definitively not the same.
Not sure how much benefit people would have in custom redaction for stringifying, but throwing that out there as I'm curious to hear if there is any utility in not entirely redacting, from a usability / debugging standpoint.
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -399,6 +415,7 @@ public String toString() {
.add("deleted_data_files_count", deletedFilesCount)
.add("deleted_rows_count", deletedRowsCount)
.add("partitions", partitions)
+ .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
Review comment:
Given we're adding a number of encryption related PRs, most of which have very sensitive data in them (encryption keys), would it make sense to make this into a utility function, such as `EncryptionUtils.toRedactedString(byte[] value)`?
We could have a unified way of redacting, which could also reduce the null checks in the code.
It would give people the option of possibly customizing the way in which they redact keys (say, in a fork or something or via an override) that redacts in the way that allows SREs to better assist customers - for example, I can imagine that there _might_ be utility in showing the first 2 or 4 bytes or something so as to be able to check that the key is definitively not the same as another one (would defer to the experts on how insecure it is to allow logging any portion of the key or a hash of a portion at all).
Not sure how much benefit people would have in custom redaction for stringifying (either for checking if the key metadata is definitively not the same or something else), but throwing that out there as I'm curious to hear if there is any utility in not entirely redacting, from a usability / debugging standpoint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] jackye1995 commented on a change in pull request #2675: Core: add key_metadata to ManifestFile spec
Posted by GitBox <gi...@apache.org>.
jackye1995 commented on a change in pull request #2675:
URL: https://github.com/apache/iceberg/pull/2675#discussion_r651112423
##########
File path: core/src/main/java/org/apache/iceberg/GenericManifestFile.java
##########
@@ -124,6 +128,7 @@ public GenericManifestFile(String path, long length, int specId, ManifestContent
this.deletedRowsCount = deletedRowsCount;
this.partitions = partitions == null ? null : partitions.toArray(new PartitionFieldSummary[0]);
this.fromProjectionPos = null;
+ this.keyMetadata = ByteBuffers.toByteArray(keyMetadata);
Review comment:
There is already a null guard in `ByteBuffers`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org