feat(aws-sqs): Add external ID support for cross-account access#6916
feat(aws-sqs): Add external ID support for cross-account access#6916JorTurFer merged 12 commits intokedacore:mainfrom
Conversation
7ddacbe to
2d88723
Compare
JorTurFer
left a comment
There was a problem hiding this comment.
Awesome improvement! ❤️
As this is part of pod identity (IRSA role assumption), WDYT if we set it as a new parameter in trigger authentication? This would make the new feature available for any AWS Scaler at once.
Please, also open a PR to docs to document the new parameter
Could you please elaborate here? |
sure, |
Thanks a lot, this make sense! Fully agree, let's proceed this direction, @tangobango5 FYI |
|
Hi @JorTurFer Please let me know if I have understood this correctly: I have done changes in:
These changes are for all the AWS scalers and Example usage (I have already tried it like this): Similarly, this TriggerAuthentication can be used for any of the AWS scalers and it's PS: I am new to KEDA, and might have misunderstood it. |
|
Hi @JorTurFer I have changed it to use podIdentity instead of using auth. We may use it like this: Is this what you requested? |
JorTurFer
left a comment
There was a problem hiding this comment.
awesome job! Just one extra thing, instead of using SQS unit test to test this feature, what about adding an e2e test for it. We have a real AWS account where we can include a role with externalID requirement -> https://github.com/[kedacore/testing-infrastructure](https://github.com/kedacore/testing-infrastructure)
The AWS IAM is managed here -> https://github.com/kedacore/testing-infrastructure/blob/main/terraform/modules/aws/iam/main.tf
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
9c3a059 to
a226f12
Compare
a226f12 to
9c3a059
Compare
|
Hi @JorTurFer, |
d52f909 to
9b153fc
Compare
a8db283 to
1ba3a09
Compare
Signed-off-by: ritesh.chaurasia1 <ritesh.chaurasia@devo.com>
Signed-off-by: ritesh.chaurasia1 <ritesh.chaurasia@devo.com>
4a59158 to
88b1633
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds support for AWS External ID in TriggerAuthentication to enable secure cross-account access scenarios. External ID is an AWS security best practice that helps prevent the "confused deputy" problem when using AssumeRole across accounts.
Changes:
- Added
ExternalIDfield toAuthPodIdentitystruct and CRD definitions - Updated AWS authentication logic to parse and use external ID with AssumeRole operations
- Modified cache key generation to include external ID for proper cache isolation
- Added comprehensive unit and E2E tests for external ID scenarios
- Added webhook validation to ensure external ID is only used with RoleArn
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apis/keda/v1alpha1/triggerauthentication_types.go | Added ExternalID field to AuthPodIdentity struct |
| apis/keda/v1alpha1/triggerauthentication_webhook.go | Added validation to ensure ExternalID requires RoleArn |
| config/crd/bases/keda.sh_triggerauthentications.yaml | Updated CRD with ExternalID field definition |
| config/crd/bases/keda.sh_clustertriggerauthentications.yaml | Updated ClusterTriggerAuthentication CRD with ExternalID field |
| pkg/scalers/aws/aws_authorization.go | Added AwsExternalID field to AuthorizationMetadata struct |
| pkg/scalers/aws/aws_common.go | Updated GetAwsAuthorization to parse external ID and pass to AssumeRole |
| pkg/scalers/aws/aws_config_cache.go | Updated cache key generation and credential retrieval to include external ID |
| pkg/scalers/aws_sqs_queue_scaler_test.go | Added comprehensive unit test cases for external ID scenarios |
| tests/secret-providers/aws_identity_external_id/aws_identity_external_id_test.go | Added E2E test verifying external ID works and is properly validated |
| CHANGELOG.md | Documented the enhancement for all AWS scalers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
88b1633 to
2013463
Compare
Add externalID tests Signed-off-by: ritesh.chaurasia1 <ritesh.chaurasia@devo.com>
2013463 to
9e3ee94
Compare
|
@JorTurFer you may review now. |
JorTurFer
left a comment
There was a problem hiding this comment.
LGTM! Only one small thing: please include the externalID in the key generated by getCacheKey. I assume that you can never assume a role with and without the externalD, but including the value in the key ensures that connections are unique. Also, if one legit trigger is configured, not having the externalID can allow another one wrongly configured (without it) to use the right one
|
/run-e2e aws |
Signed-off-by: Ritesh Kumar Chaurasia <riteshchaurasia53@gmail.com>
Signed-off-by: ritesh.chaurasia1 <ritesh.chaurasia@devo.com>
11ca8e4 to
77b58ab
Compare
|
@JorTurFer @rickbrouwer |
|
/run-e2e aws |
|
Can we expect this to be part of the v2.20 release? |
This commit adds support for external ID in AWS SQS scaler to enable secure cross-account access scenarios. External ID is now parsed from TriggerAuthentication and passed to STS AssumeRole operations.
Changes:
The external ID is only used with AssumeRole operations and maintains backward compatibility with existing configurations.
Provide a description of what has been changed
Checklist
Fixes # #6921
Relates to #