-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19197. S3A: KMS Encryption Context support: follow-up #7830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
steveloughran
wants to merge
2
commits into
apache:trunk
Choose a base branch
from
steveloughran:s3/HADOOP-19197-encryption-secrets
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+207
−12
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,8 @@ | |
| import org.apache.hadoop.io.Text; | ||
| import org.apache.hadoop.io.Writable; | ||
|
|
||
| import static org.apache.hadoop.fs.s3a.Constants.DEFAULT_S3_ENCRYPTION_CONTEXT; | ||
|
|
||
| /** | ||
| * Encryption options in a form which can serialized or marshalled as a hadoop | ||
| * Writeable. | ||
|
|
@@ -54,7 +56,10 @@ public class EncryptionSecrets implements Writable, Serializable { | |
|
|
||
| public static final int MAX_SECRET_LENGTH = 2048; | ||
|
|
||
| private static final long serialVersionUID = 1208329045511296375L; | ||
| /** | ||
| * Change this after any change to the payload: {@value}. | ||
| */ | ||
| private static final long serialVersionUID = 8834417969966697162L; | ||
|
|
||
| /** | ||
| * Encryption algorithm to use: must match one in | ||
|
|
@@ -70,7 +75,7 @@ public class EncryptionSecrets implements Writable, Serializable { | |
| /** | ||
| * Encryption context: base64-encoded UTF-8 string. | ||
| */ | ||
| private String encryptionContext = ""; | ||
| private String encryptionContext = DEFAULT_S3_ENCRYPTION_CONTEXT; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. encryptionAlgorithm and encryptionKey in the lines above are assigned to |
||
|
|
||
| /** | ||
| * This field isn't serialized/marshalled; it is rebuilt from the | ||
|
|
@@ -86,7 +91,24 @@ public EncryptionSecrets() { | |
| } | ||
|
|
||
| /** | ||
| * Create a pair of secrets. | ||
| * Create a tuple of secrets. The encryption context is set to "". | ||
| * This constructor is used in external implementations of S3A delegation | ||
| * tokens, sp MUST be retained even if there is no use in our own | ||
| * production code. | ||
| * @param encryptionAlgorithm algorithm enumeration. | ||
| * @param encryptionKey key/key reference. | ||
| * @throws IOException failure to initialize. | ||
| * @deprecated use {@link #EncryptionSecrets(S3AEncryptionMethods, String, String)} | ||
| * which takes an encryption context. | ||
| */ | ||
| public EncryptionSecrets(final S3AEncryptionMethods encryptionAlgorithm, | ||
| final String encryptionKey) throws IOException { | ||
| this(encryptionAlgorithm.getMethod(), encryptionKey, | ||
| DEFAULT_S3_ENCRYPTION_CONTEXT); | ||
| } | ||
|
|
||
| /** | ||
| * Create a 3/tuple of secrets. | ||
| * @param encryptionAlgorithm algorithm enumeration. | ||
| * @param encryptionKey key/key reference. | ||
| * @param encryptionContext base64-encoded string with the encryption context key-value pairs. | ||
|
|
@@ -99,7 +121,7 @@ public EncryptionSecrets(final S3AEncryptionMethods encryptionAlgorithm, | |
| } | ||
|
|
||
| /** | ||
| * Create a pair of secrets. | ||
| * Create a 3/tuple of secrets. | ||
| * @param encryptionAlgorithm algorithm name | ||
| * @param encryptionKey key/key reference. | ||
| * @param encryptionContext base64-encoded string with the encryption context key-value pairs. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you generate this id? Is there a way to introduce a unit test to validate if new fields were added and the id should be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IntelliJ has a helper
transient) changes. I think consensus is you can generate any sufficiently random number and all is good. Key is: change it.I don't worry about the java serialization so much as it'll only surface if people are trying to save delegation tokens in odd ways