Support for AssumeRole in AWS Secrets Store CSI Provider for SecretProviderClass#555
Support for AssumeRole in AWS Secrets Store CSI Provider for SecretProviderClass#555
SecretProviderClass#555Conversation
|
Could you talk a bit more about your use case? You should be able to access secrets cross-account using their ARN https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples_cross.html. If you are an enterprise customer, I'd like to encourage you to reach out to AWS Support about your use case too. |
Thanks you for review and question. The IRSA role to have secretsmanager:GetSecretValue permissions, and A resource policy on the secret in Account B explicitly allowing access from the IRSA role. This introduces significant operational overhead when managing cross-account secrets. If the provider supported specifying an assumeRole, the IRSA role would only need permission to assume that role. All Secrets Manager actions would then be performed using the assumed role, eliminating the need for: Direct Secrets Manager permissions on the IRSA role, and Resource policies on the secret for each consuming role. This approach simplifies cross-account access patterns and aligns well with common AWS security practices. |
SecretProviderClass
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #555 +/- ##
==========================================
+ Coverage 60.10% 60.25% +0.14%
==========================================
Files 11 11
Lines 762 790 +28
==========================================
+ Hits 458 476 +18
- Misses 287 296 +9
- Partials 17 18 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hello @simonmarty I would appreciate your review on this PR again. Please do let me know if there are any other comments/questions you may have. Thank you! |
Summary
This PR adds support for assuming an IAM role at mount time via a new
SecretProviderClassparameter:assumeRoleArn. When specified, the AWS provider will perform an STSAssumeRoleusing the base credentials (IRSA or Pod Identity) and use the assumed-role credentials for all AWS Secrets Manager and SSM calls for that mount.Optional parameters are also supported:
assumeRoleDurationSecondsassumeRoleExternalIdThis enables cleaner and more scalable cross-account access patterns for secrets.
Problem Statement
Currently,
secrets-store-csi-driver-provider-awsretrieves secrets using the credentials obtained via IRSA or Pod Identity and directly calls AWS Secrets Manager or SSM with those credentials.In cross-account setups (for example, EKS in Account A accessing Secrets Manager in Account B), this requires:
secretsmanager:GetSecretValuepermissions, andThis approach introduces significant operational overhead, especially when multiple workloads or clusters need access to cross-account secrets.
Although users may specify an
assumeRoleArn(or similar) underspec.parameterstoday, the AWS provider does not parse or act on this value. Nosts:AssumeRolecall is made, and the parameter is effectively ignored. As a result, common cross-account access patterns are not supported.Proposed Solution
Add support for assuming a role per mount by introducing the following
SecretProviderClassparameters underspec.parameters:assumeRoleArn(string, required)Instructs the provider to call STS
AssumeRoleusing the base credentials (IRSA or Pod Identity).assumeRoleDurationSeconds(string or int, optional)Session duration for the assumed role.
assumeRoleExternalId(string, optional)External ID to pass to the
AssumeRolecall.When
assumeRoleArnis specified, the IRSA role only needs permission to callsts:AssumeRole. All Secrets Manager or SSM access is performed using the assumed role, eliminating the need for:Example
SecretProviderClassBehaviour & implementation notes
assumeRoleArnis present:assumeRoleArnis missing, current behaviour is unchanged.