-
Notifications
You must be signed in to change notification settings - Fork 2
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
Filter: load JSON definitions and policies from file #7
Conversation
...us-filter/src/test/java/io/strimzi/kafka/topicenc/kroxylicious/TopicEncryptionVaultTest.java
Outdated
Show resolved
Hide resolved
I've now refactored the tests, splitting them into tests covering Produce Encryption and Fetch Decryption, testing each side in isolation. This combined with adding tests for per-topic encryption policies would catch the issues fixed by commit #de60abe. The tests were working because of the hardcoded wildcard policy combined with the metadata request failure caching an empty string. We found a name for the topic (empty string), and that got the wildcard policy applied to it, test passes ✔️ |
...ylicious-filter/src/main/java/io/strimzi/kafka/topicenc/kroxylicious/FetchDecryptFilter.java
Show resolved
Hide resolved
To catch a comment from the demos, @SamBarker pointed out that it would be good if we could get credentials into the key manager definition file (like the vault token) in a kubernetes friendly way. So instead of directly in our JSON file, refer to a secret file or environment variable. Captured in #8 |
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.
A few cosmetic thoughts but looks good to me.
...ylicious-filter/src/main/java/io/strimzi/kafka/topicenc/kroxylicious/FetchDecryptFilter.java
Outdated
Show resolved
Hide resolved
...ylicious-filter/src/main/java/io/strimzi/kafka/topicenc/kroxylicious/FetchDecryptFilter.java
Show resolved
Hide resolved
kroxylicious-filter/src/test/java/io/strimzi/kafka/topicenc/kroxylicious/KafkaAssertions.java
Outdated
Show resolved
Hide resolved
kroxylicious-filter/src/test/java/io/strimzi/kafka/topicenc/kroxylicious/TestCrypter.java
Outdated
Show resolved
Hide resolved
...us-filter/src/test/java/io/strimzi/kafka/topicenc/kroxylicious/VaultFetchDecryptionTest.java
Outdated
Show resolved
Hide resolved
...us-filter/src/test/java/io/strimzi/kafka/topicenc/kroxylicious/VaultFetchDecryptionTest.java
Outdated
Show resolved
Hide resolved
kroxylicious-filter/src/test/java/io/strimzi/kafka/topicenc/kroxylicious/kms/MockKms.java
Show resolved
Hide resolved
95f8325
to
12c5372
Compare
Why: At apiVersion 10, the MetadataRequest is only allowed to take null topic ids. So it responds with an error when we set the id. We need to be at apiVersion 12. We were also missing a guard to prevent caching in this error condition which allowed an empty topic name to be put in the cache on error. Resulting in no decryption being applied. Signed-off-by: Robert Young <[email protected]>
Why: We want users to have access to the full Smorgasbord of configuration including different encryption policies per-topic and support for multiple KMS implementations. With this change the Kroxylicious Filter will require configuration to point to the two JSON files. This gives us the closest integration with the encryption module because `JsonPolicyLoader.loadTopicPolicies` works in terms of File objects and does some useful work like validating and associating policies and KMS implementations. In future, if we want to be able to embed the KMS definitions and topic policies in the Filter configuration it might be nice if `JsonPolicyLoader` had another method like: `List<TopicPolicy> loadTopicPolicies(List<TopicPolicy> topicPolicies, Map<String, KmsDefinition> kmsDefs)` that did the same work without the dependency on loading JSON from File. Signed-off-by: Robert Young <[email protected]>
41bf474
to
264af3c
Compare
Why:
We want users to have access to the full Smorgasbord of configuration including different encryption policies per-topic and support for multiple KMS implementations.
With this change the Kroxylicious Filter will require configuration to point to the two JSON files. This gives us the closest integration with the encryption module because
JsonPolicyLoader.loadTopicPolicies
works in terms of File objects and does some useful work like validating and associating policies and KMS implementations.example Kroxylicious configuration
In future, if we want to be able to embed the KMS definitions and topic policies in the Filter configuration it might be nice if
JsonPolicyLoader
had another method like:List<TopicPolicy> loadTopicPolicies(List<TopicPolicy> topicPolicies, Map<String, KmsDefinition> kmsDefs)
that did the same work without the dependency on loading JSON from File.Implements #3