-
Notifications
You must be signed in to change notification settings - Fork 24
feat(aws-s3): add SSE-KMS support for MOVE action in S3 Trigger & Copy #667
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
base: main
Are you sure you want to change the base?
Conversation
Adds support for `serverSideEncryption` and `kmsKeyId` in S3 MOVE actions inside the Trigger and Copy operations. This enables workflows to move files into buckets that enforce encryption policies requiring SSE-KMS. Includes schema updates, parameter handling, and correct wiring inside S3Service performAction().
|
@idivanshu, could you please add some unit tests for this? Thanks! 🙏 |
…n tests - Removed deprecated @PluginProperty annotations from Copy.CopyObject fields - Added runWithServerSideEncryption and runWithKmsKey tests to CopyTest
added tests |
| builder.serverSideEncryption(renderedSse); | ||
|
|
||
| if (renderedSse == ServerSideEncryption.AWS_KMS && this.to.kmsKeyId != null) { | ||
| String renderedKmsKeyId = runContext.render(this.to.kmsKeyId).as(String.class).orElse(null); |
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.
| String renderedKmsKeyId = runContext.render(this.to.kmsKeyId).as(String.class).orElse(null); | |
| String rKmsKeyId = runContext.render(this.to.kmsKeyId).as(String.class).orElse(null); |
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.
LGTM, @idivanshu, just a last nitpick!
| title = "Server side encryption to apply to the target object.", | ||
| description = "Example: AES256 or AWS_KMS" | ||
| ) | ||
| private Property<ServerSideEncryption> serverSideEncryption; |
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.
Lets extract this to our own ENUM.
closes #628
This PR adds support for configuring AWS KMS server-side encryption (serverSideEncryption, kmsKeyId) when using the MOVE action in S3 Trigger and Copy tasks.
Some S3 buckets enforce encryption with policies that deny uploads missing SSE headers.
This enhancement enables Kestra flows to move files into such buckets without failure.
Summary
Adds serverSideEncryption and kmsKeyId to the moveTo configuration.
Updates Copy task to apply SSE-KMS headers during copy operations.
Updates S3Service.performAction() to support SSE-KMS for MOVE actions triggered by S3 events.
Fully compatible with existing flows (non-breaking).
Validated using real AWS buckets enforcing encryption policies.
Example Flow (Validated)
id: test_s3_kms_move
namespace: local.test
tasks:
id: move
type: io.kestra.plugin.aws.s3.Copy
region: "us-east-1"
accessKeyId: "{{ secret('AWS_KEY') }}"
secretKeyId: "{{ secret('AWS_SECRET') }}"
from:
bucket: "kestra-test-src-bucket"
key: "input/test.txt"
to:
bucket: "kestra-cfn-test-1"
key: "moved/test.txt"
serverSideEncryption: AWS_KMS
kmsKeyId: "{{ secret('KMS_KEY_ARN') }}"
delete: true
This flow successfully writes into a bucket that rejects unencrypted uploads (explicit deny).
Testing
Manually tested using Kestra UI with plugin JAR
MOVE + SSE-KMS verified end-to-end