chore: update
install.ps1PS exec policy error (#281)Description
Why is this change being made?
- Update the error message in
install.ps1for the case where the PowerShell execution policy blocks the script.What is changing?
install.ps1Related Links
- Issue #, if available: N/A
Testing
How was this tested?
- N/A
When testing locally, provide testing artifact(s):
- N/A
Reviewee Checklist
Update the checklist after submitting the PR
- I have reviewed, tested and understand all changes If not, why:
- I have filled out the Description and Testing sections above If not, why:
- Build and Unit tests are passing If not, why:
- Unit test coverage check is passing If not, why:
- Integration tests pass locally If not, why:
- I have updated integration tests (if needed) If not, why:
- I have ensured no sensitive information is leaking (i.e., no logging of sensitive fields, or otherwise) If not, why:
- I have added explanatory comments for complex logic, new classes/methods and new tests If not, why:
- I have updated README/documentation (if needed) If not, why:
- I have clearly called out breaking changes (if any) If not, why:
Reviewer Checklist
All reviewers please ensure the following are true before reviewing:
- Reviewee checklist has been accurately filled out
- Code changes align with stated purpose in description
- Test coverage adequately validates the changes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
AWS Workload Credentials Provider
The AWS Workload Credentials Provider (formerly the AWS Secrets Manager Agent) is a client-side solution that helps you standardize how you consume credentials from AWS services across your compute environments. It includes the following capabilities:
Secrets Manager capability
The Workload Credentials Provider retrieves and caches secrets in memory so that your applications can consume secrets from localhost instead of making direct calls to Secrets Manager. It can only read secrets - it can’t modify them.
The Workload Credentials Provider uses the AWS credentials you provide in your environment to make calls to Secrets Manager. The Workload Credentials Provider offers protection against Server Side Request Forgery (SSRF) to help improve secret security. It also uses the post-quantum ML-KEM key exchange as the highest-priority key exchange by default. You can configure the Workload Credentials Provider by setting the maximum number of connections, the time to live (TTL), the localhost HTTP port, and the cache size.
Because the Workload Credentials Provider uses an in-memory cache, it resets when the Workload Credentials Provider restarts. The Workload Credentials Provider periodically refreshes the cached secret value. The refresh happens when you try to read a secret from the Workload Credentials Provider after the TTL has expired. The default refresh frequency (TTL) is 300 seconds, and you can change it by using a Configuration file which you pass to the Workload Credentials Provider using the
sm start --config /path/to/config.tomlcommand line argument. The Workload Credentials Provider does not include cache invalidation. For example, if a secret rotates before the cache entry expires, the Workload Credentials Provider might return a stale secret value.The Workload Credentials Provider returns secret values in the same format as the response of
GetSecretValue. Secret values are not encrypted in the cache.Certificate Management capability
The Workload Credentials Provider exports certificates from AWS Certificate Manager (ACM) and writes them as PEM files to the local filesystem. It automatically checks for updated certificates every 24 hours and optionally runs a user-configured command after each successful refresh (for example, to reload a web server). You can configure up to 50 certificates. Each certificate is managed by an independent background task, providing fault isolation so that one certificate’s failure does not affect others.
The Certificate Management capability supports Linux and Windows, and works with web servers such as NGINX and Apache.
The Workload Credentials Provider uses the AWS credentials you provide in your environment to assume the role you have configured for each certificate, and then calls ACM to export the certificate.
Important
The Certificate Management capability requires elevated permissions for the provider to write certificate files and execute refresh commands. The
installscript (Linux) orinstall.ps1script (Windows) configures these permissions automatically and is the recommended setup path. On Linux, if you need to manage specific permissions yourself, use the--no-privilegesor--no-sudoersflags rather than bypassing the install script entirely. For details on what permissions are configured, see Security considerations.You can provide a custom configuration by passing
--config /path/to/config.tomlon startup or on reload while the provider is running. On Windows, use-Config C:\path\to\config.tomlwhen invoking the PowerShell scripts and--Config C:\path\to\config.tomlwhen executing the binary command. The reload re-applies permissions and restarts the ACM service.For full configuration details, see Configure the Workload Credentials Provider.
To download the source code, see https://github.com/aws/aws-workload-credentials-provider on GitHub.
Topics
refreshNowparameter behaviorQuick install
The bootstrap installers download a released binary and the matching configuration directory, then run the install script for you. Use them unless you need to build from source, in which case follow Step 1 and Step 2 instead.
[ Linux quick install ]
AWCP_VERSIONis required and must name a released, tagged version. The script downloads the binary for your architecture from the artifact host and the service units and install scripts from thev$AWCP_VERSIONtag, then hands off to theinstallscript described in Step 2. It also accepts--dry-run, which downloads everything, keeps it, and prints where, without installing.Download to a file rather than piping into a shell:
bash -c "$(curl …)"exits 0 when the download fails, because the substitution is simply empty, so a failed install reads as a successful one. If you do use that form, options must go after a--, since the shell would otherwise consume the first one as$0.As with Step 2, add the user account that your application runs under to the
aws-wcp-tokengroup so it can read the SSRF token file.[ Windows quick install ]
Run the following in an Administrator PowerShell session. If the download fails on an older host, run
[Net.ServicePointManager]::SecurityProtocol = 'Tls12'first.Download to a file rather than running the response directly:
[scriptblock]::Create()on an empty body produces a script block that does nothing and reports success, so a truncated or empty download would read as a completed install.If your execution policy refuses to run the file, or refuses the unsigned install scripts it downloads, run it as
powershell.exe -ExecutionPolicy Bypass -File $installer -Version 3.1.1 -Config C:\path\to\config.toml. The script checks the policy before downloading anything and tells you the same thing.The script verifies the Authenticode signature on the binary and passes
-Configand-NoStartthrough to theinstall.ps1script described in Step 2. It also accepts the following parameters:-Version <x.y.z>— Version to install; required, and may also be given as theAWCP_VERSIONenvironment variable-Force— (Optional) Stop running provider services before installing-DryRun— (Optional) Download and verify, then stop without installingStep 1: Build the Workload Credentials Provider binary
To build the Workload Credentials Provider binary natively, you need the standard development tools and the Rust tools. Alternatively, you can cross-compile for systems that support it, or you can use Rust cross to cross-compile.
NOTE: To ensure a stable experience, use a specific git tag when building from source code. You can find a list of version tags here. Tags are in the pattern
/v\d+\.\d+\.\d+/and follow SemVer 2.0.0.Example:
git clone --branch <git tag> https://github.com/aws/aws-workload-credentials-provider.gitNOTE: Building the provider with the
fipsfeature enabled on macOS currently requires the following workaround:SDKROOTwhich is set to the result of runningxcrun --show-sdk-path[ RPM-based systems ]
On RPM-based systems such as AL2023, you can install the development tools by using the Development Tools group.
Follow the instructions at Install Rust in the Rust documentation.
Build the provider using the cargo build command:
You will find the executable under
target/release/aws-workload-credentials-provider.[ Debian-based systems ]
On Debian-based systems such as Ubuntu, you can install the developer tools using the build-essential package.
Follow the instructions at Install Rust in the Rust documentation.
Build the provider using the cargo build command:
You will find the executable under
target/release/aws-workload-credentials-provider.[ Windows ]
To build on Windows, follow the instructions at Set up your dev environment on Windows for Rust in the Microsoft Windows documentation.
Build the provider using the cargo build command:
You will find the executable under
target/release/aws-workload-credentials-provider.exe.[ Cross-compile natively ]
You can cross-compile for Windows from Linux using
cargo-xwin.You will find the executable at
target/x86_64-pc-windows-msvc/release/aws-workload-credentials-provider.exe.Step 2: Install the Workload Credentials Provider
Based on the type of compute, you have several options for installing the Workload Credentials Provider. The install script sets up both the Secrets Manager and Certificate Management capabilities.
[ Amazon EC2 (Linux) ]
To install the Workload Credentials Provider
cd aws_workload_credentials_provider_common/configurationRun the
installscript provided in the repository.The script accepts the following options:
--config <file>— (Optional) Bootstrap config to copy to the configuration directory--no-start— (Optional) Install but don’t start services--no-privileges— (Optional) Skip Linux capabilities on ACM service--no-sudoers— (Optional) Skip sudoers generationThe script generates a random SSRF token on startup and stores it in the file
/var/run/awssmatoken. The token is readable by theaws-wcp-tokengroup that the install script creates.To allow your application to read the token file, you need to add the user account that your application runs under to the
aws-wcp-tokengroup. For example, you can grant permissions for your application to read the token file with the following usermod command, where <APP_USER> is the user ID under which your application runs.[ Windows EC2 ]
To install the Workload Credentials Provider
cd aws_workload_credentials_provider_common\configurationRun the
install.ps1script as Administrator.The script accepts the following parameters:
-Config <file>— (Optional) Bootstrap config to use-NoStart— (Optional) Install but don’t start servicesThe script generates a random SSRF token on startup and stores it in the file
C:\ProgramData\AWS\WorkloadCredentialsProvider\awssmatoken. The token is readable by the Secrets Manager service account (NT SERVICE\AWSWorkloadCredentialsProvider-SecretsManager) that the install script configures.To allow your application to read the token file, you need to grant read access to the user account that your application runs under. For example, you can grant permissions for your application to read the token file with the following icacls command, where <APP_USER> is the user account under which your application runs.
Note: When using the install script, the provider reads the SSRF token from file via
AWS_TOKEN=file://C:\ProgramData\AWS\WorkloadCredentialsProvider\awssmatokenset on the service. Your application must also read the token from this path and pass it in theX-Aws-Parameters-Secrets-Tokenheader. If you were previously settingAWS_TOKENas an environment variable with a literal token value or a custom file path, update your application to read from the new token file path instead.[ Running as a Container Sidecar ]
You can run the Workload Credentials Provider as a sidecar container alongside your application by using Docker. Then your application can retrieve secrets from the local HTTP server the Workload Credentials Provider provides. For information about Docker, see the Docker documentation.
Note: The Certificate Management capability is not supported in container environments.
To create a sidecar container for the Workload Credentials Provider with Docker
Create a Dockerfile for the Workload Credentials Provider sidecar container. The following example creates a Docker container with the Workload Credentials Provider binary.
Create a Dockerfile for your client application.
Create a Docker Compose file to run both containers, being sure that they use the same network interface. This is necessary because the Workload Credentials Provider does not accept requests from outside the localhost interface. The following example shows a Docker Compose file where the
network_modekey attaches theworkload-credentials-providercontainer to the network namespace of theclient-applicationcontainer, which allows them to share the same network interface.Important
You must load AWS credentials and the SSRF token for the application to be able to use the Workload Credentials Provider. For EKS and ECS, see the following:
Copy the
aws-workload-credentials-providerbinary to the same directory that contains your Dockerfiles and Docker Compose file.Build and run the containers based on the provided Dockerfiles by using the following https://docs.docker.com/reference/cli/docker/compose/ command.
In your client container, you can now use the Workload Credentials Provider to retrieve secrets. For more information, see Step 3: Retrieve secrets with the Workload Credentials Provider.
[ AWS Lambda ]
You can package the Workload Credentials Provider as an AWS Lambda extension. Then you can add it to your Lambda function as a layer and call the Workload Credentials Provider from your Lambda function to get secrets.
Note: The Certificate Management capability is not supported on AWS Lambda.
The following instructions show how to get a secret named MyTest by using the example script
secrets-manager-provider-extension.shin https://github.com/aws/aws-workload-credentials-provider to install the Workload Credentials Provider as a Lambda extension.To create a Lambda extension that packages the Workload Credentials Provider
Package the provider as a layer. From the root of the Workload Credentials Provider code package, run the following example commands:
The default configuration of the provider will automatically set the SSRF token to the value set in the pre-set
AWS_SESSION_TOKENorAWS_CONTAINER_AUTHORIZATION_TOKENenvironment variables (the latter variable for Lambda functions with SnapStart enabled). Alternatively, you can define theAWS_TOKENenvironment variable with an arbitrary value for your Lambda function instead as this variable takes precedence over the other two. If you choose to use theAWS_TOKENenvironment variable, you must set that environment variable with alambda:UpdateFunctionConfigurationcall.http://localhost:2773/secretsmanager/get?secretId=MyTestwith theX-Aws-Parameters-Secrets-Tokenheader value set to the value of the SSRF token sourced from one the environment variables mentioned above to retrieve the secret. Be sure to implement retry logic in your application code to accommodate delays in initialization and registration of the Lambda extension.Step 3: Retrieve secrets with the Workload Credentials Provider
The following sections describe how to use the Secrets Manager capability.
To retrieve a secret, you call the local Workload Credentials Provider endpoint and include the name or ARN of the secret as a query parameter. By default, the Workload Credentials Provider retrieves the
AWSCURRENTversion of the secret. To retrieve a different version, you can setversionStageorversionId. To retrieve a secret using a different IAM role, you can setroleArn. For more information, see Role chaining (cross-account access).To help protect the Workload Credentials Provider, you must include a SSRF token header as part of each request:
X-Aws-Parameters-Secrets-Token. The Workload Credentials Provider denies requests that don’t have this header or that have an invalid SSRF token. You can customize the SSRF header name in the Configuration file.The Workload Credentials Provider uses the AWS SDK for Rust, which uses the https://docs.aws.amazon.com/sdk-for-rust/latest/dg/credentials.html. The identity of these IAM credentials determines the permissions the Workload Credentials Provider has to retrieve secrets.
**Required permissions: **
secretsmanager:DescribeSecretsecretsmanager:GetSecretValueFor more information, see Permissions reference.
Important
After the secret value is pulled into the Workload Credentials Provider, any user with access to the compute environment and SSRF token can access the secret from the Workload Credentials Provider cache. For more information, see Security considerations.
[ curl ]
The following curl example shows how to get a secret from the Workload Credentials Provider. The example relies on the SSRF being present in a file, which is where it is stored by the install script.
[ Python ]
The following Python example shows how to get a secret from the Workload Credentials Provider. The example relies on the SSRF being present in a file, which is where it is stored by the install script.
Force-refresh secrets with
RefreshNowLearn how to use the refreshNow parameter to force the Workload Credentials Provider to refresh secret values.
Workload Credentials Provider uses an in-memory cache to store secret values, which it refreshes periodically. By default, this refresh occurs when you request a secret after the Time to Live (TTL) has expired, typically every 300 seconds. However, this approach can sometimes result in stale secret values, especially if a secret rotates before the cache entry expires.
To address this limitation, Workload Credentials Provider supports a parameter called
refreshNowin the URL. You can use this parameter to force an immediate refresh of a secret’s value, bypassing the cache and ensuring you have the most up-to-date information.Default behavior (without
refreshNow):Behavior with
refreshNow=true:By using the
refreshNowparameter, you can ensure that you’re always working with the most current secret values, even in scenarios where frequent secret rotation is necessary.refreshNowparameter behaviorrefreshNowset totrue:refreshNowset tofalseor not specified:Using the refreshNow parameter
To use the
refreshNowparameter, include it in the URL for the Workload Credentials Provider GET request.Example - Workload Credentials Provider GET request with refreshNow parameter
[ curl ]
The following curl example shows how force Workload Credentials Provider to refresh the secret. The example relies on the SSRF being present in a file, which is where it is stored by the install script.
[ Python ]
The following Python example shows how to get a secret from the Workload Credentials Provider. The example relies on the SSRF being present in a file, which is where it is stored by the install script.
Role chaining (cross-account access)
The Workload Credentials Provider supports retrieving secrets using IAM role assumption (role chaining). This allows you to access secrets in other AWS accounts or with different IAM permissions without running separate provider instances.
To retrieve a secret using a different IAM role, include the
roleArnquery parameter in your request. The Workload Credentials Provider uses STSAssumeRoleto obtain temporary credentials for the specified role and then retrieves the secret with those credentials.The Workload Credentials Provider creates and caches a separate caching client for each unique role ARN. Role clients are created lazily on first request and reused for subsequent requests with the same role ARN. Each role client maintains its own independent cache, so the same secret fetched with different roles will have separate cache entries.
**Required permissions: **
sts:AssumeRoleon the target role ARNsecretsmanager:GetSecretValueandsecretsmanager:DescribeSecretpermissions**Error responses: **
400– If theroleArnformat is invalid or the maximum number of assumed roles has been reached.403– If the STSAssumeRolecall fails (for example, the trust policy does not allow the provider’s identity to assume the role).You can configure the maximum number of simultaneous assumed roles with the
max_rolesoption in the Configuration file. The default is 20.Note: Assumed roles are not evicted from the provider’s role cache. Once the maximum number of roles has been reached, requests with new role ARNs will be rejected with a
400error until the provider is restarted.[ curl ]
The following curl example shows how to retrieve a secret using a different IAM role.
[ Python ]
The following Python example shows how to retrieve a secret using a different IAM role.
Pre-fetching
The Workload Credentials Provider supports pre-fetching secrets into the cache at startup. This allows your application to read secrets from the cache immediately without waiting for the first request to trigger a cache miss and network call.
To enable pre-fetching, add a
[capabilities.secrets_manager.prefetch]section to your Configuration file. You can specify secrets to pre-fetch in two ways:[[capabilities.secrets_manager.prefetch.secrets]]entries.[[capabilities.secrets_manager.prefetch.filter_tags]]entries. The provider callsBatchGetSecretValuewith tag key filters to find and cache all secrets that have the specified tag key, regardless of the tag’s value.You can use both methods together. Each entry optionally accepts a
role_arnfield for cross-account pre-fetching via role chaining.**Required permissions: **
secretsmanager:BatchGetSecretValue– Required for all pre-fetching operations.secretsmanager:ListSecrets– Required when using tag-based discovery (filter_tags).**Pre-fetch configuration options: **
Example - Pre-fetch with explicit secrets
Example - Pre-fetch with explicit secrets (inline syntax)
Example - Pre-fetch with tag-based discovery
Example - Full configuration with pre-fetching
Step 4: Retrieve certificates with the Workload Credentials Provider
The following sections describe how to use the Certificate Management capability.
To enable the Certificate Management capability, add a
[capabilities.acm]section to your configuration file withenabled = trueand one or more certificate entries. The provider will automatically export and refresh configured certificates every 24 hours.Required permissions:
sts:AssumeRole— Required on the provider’s environment credentials to assume the configured role for each certificateacm:ExportCertificate— Required on the target role (role_arn) to export the certificate and private key from ACMImportant
After certificates are written to the filesystem, any user with read access to the certificate and private key files can access them. Use the
certificate_and_chain_permissionandkey_permissionconfiguration options to restrict file access. Certificate paths, refresh commands, and file permissions are customer-configured. Validate your configuration before applying it to ensure paths are correct and refresh commands are trusted. For more information, see Security considerations.For full configuration details, see Configure the Workload Credentials Provider.
Configure the Workload Credentials Provider
To start the Workload Credentials Provider with a custom configuration, create a TOML config file, and then run
./aws-workload-credentials-provider sm start --config /path/to/config.toml.The following sections describe the configuration options available for the Workload Credentials Provider.
Note: Previous flat configuration keys for Secrets Manager (e.g.,
http_port = 2773at the root level) are still supported for backward compatibility. We recommend using the nested configuration format documented below.Common configuration
These options apply to all capabilities.
trueorfalse. The default istrue.Secrets Manager configuration
These options go under
[capabilities.secrets_manager].trueorfalse. The default istrue.AWS_TOKEN=file:///var/run/awssmatoken. The default is “AWS_TOKEN, AWS_SESSION_TOKEN, AWS_CONTAINER_AUTHORIZATION_TOKEN”.Certificate Management configuration
These options go under
[capabilities.acm].Example - Linux
Example - Fullchain mode
When
chain_pathis omitted, the certificate chain is appended to the certificate file.Example - Windows
Note: On Windows, certificate and key file permissions are inherited from parent directories. Even when
certificate_and_chain_permissionorkey_permissionis specified, the configured permission is added on top of inherited permissions. Ensure parent directories are appropriately locked down.trueorfalse. The default isfalse.scheduled-task:prefix to trigger a pre-registered scheduled task.{ mode = "<octal>" }(e.g.,{ mode = "0644" }). On Windows, specify as{ trustee_type, trustee_name, rights }. Default:0600on Linux. On Windows, creating user, Administrators, and SYSTEM, plus any permissions inherited from the parent directory.certificate_and_chain_permission.Configuration reload (Certificate Management)
You can apply a new configuration to the Certificate Management capability without manually stopping and restarting the service. The reload command validates the new configuration, re-applies permissions, and restarts the ACM service. It does not affect the Secrets Manager process or configuration.
File-based credentials
By default, the Workload Credentials Provider uses the AWS SDK default credential provider chain to authenticate with Secrets Manager. In this default mode, the SDK obtains credentials from the environment on its own (IMDS on EC2, container credentials on ECS/EKS, environment variables, etc.).
For environments where credentials are delivered to the filesystem — such as on-premises or multicloud hosts using IAM Roles Anywhere — the provider supports an alternative model: it reads credentials from a file and supplies them to the AWS SDK, rather than relying on the SDK’s built-in credential resolution. The IAM Roles Anywhere credential helper’s
updatecommand writes rotating temporary credentials to the standard AWS credentials file, and the provider automatically picks up refreshed credentials without requiring a restart.The credential flow is:
This differs from the default SDK behavior where the SDK resolves credentials on its own. Here, the SDK delegates credential resolution to the Workload Credentials Provider’s file-based credential provider, which monitors the file for changes and handles renewal.
Credentials file format
The credentials file must use the standard AWS credentials file format with a
[default]profile and must include a session token (temporary credentials):Important: The provider enforces a session token gate — credentials without an
aws_session_tokenare rejected. This ensures only temporary credentials (such as those issued by IAM Roles Anywhere or STS) can be used via the file path, preventing accidental use of long-term IAM User access keys. IAM Roles Anywhere credentials always include a session token.Configuration
Set the
credentials_file_pathparameter in your configuration file:Or in the legacy flat format:
Credential refresh behavior
The provider automatically detects and re-reads updated credentials from the file:
aws_session_tokenis present. If absent, the credentials are rejected and previously cached valid credentials are retained.Startup behavior
The provider is designed to start successfully regardless of the credentials file state:
Security
The session token gate ensures that only temporary credentials can be used via the file path.
On Unix systems, the provider logs a warning if the credentials file has permissions more permissive than owner-only (
0600). Consider restricting file permissions:Optional features
The Workload Credentials Provider can be built with optional features by passing the
--featuresflag tocargo build. The available features are:fips: restricts the cipher suites used by the provider to only FIPS-approved ciphersLogging
The Workload Credentials Provider logs locally to the following files, or to stdout/stderr depending on the
log_to_fileconfig variable:logs/secrets_manager_provider.loglogs/acm_provider.logWhen your application calls the Workload Credentials Provider to get a secret, those calls appear in the local log. When the provider exports a certificate, writes it to disk, and runs a refresh command, those actions also appear in the local log. They do not appear in the CloudTrail logs.
The Workload Credentials Provider creates a new log file when the file reaches 10 MB, and it stores up to five log files per capability.
The log does not go to Secrets Manager, ACM, CloudTrail, or CloudWatch. When the Workload Credentials Provider makes a call to Secrets Manager or ACM, that call is recorded in CloudTrail with a user agent string containing
aws-workload-credentials-provider.You can configure logging in the Configuration file.
Security considerations
For a local provider architecture, the domain of trust is where the provider endpoint, SSRF token, and credential outputs (such as certificate files) are accessible, which is usually the entire host. The domain of trust for the Workload Credentials Provider should match the domain where the AWS credentials are available in order to maintain the same security posture. For example, on Amazon EC2 the domain of trust for the Workload Credentials Provider would be the same as the domain of the credentials when using roles for Amazon EC2.
Security conscious applications that are not already using a similar solution with the Secrets Manager credentials locked down to the application should consider using the language-specific AWS SDKs or caching solutions. For more information, see Get secrets.
For the Certificate Management capability, the provider runs as a dedicated system user with no login shell. On Linux, it uses
CAP_DAC_OVERRIDEto write certificate files without requiring root, and executes refresh commands viasudo -nwith a generated sudoers entry that permits only the exact configured commands. Private key files are written with0600permissions by default. All configured paths must be absolute, and paths containing symlinks or traversal components are rejected. The provider’s base credentials only needsts:AssumeRole, whileacm:ExportCertificateis scoped to a separate role. For environments where elevated privileges are not acceptable, the install script supports--no-privilegesand--no-sudoersmodes.Running Integration Tests Locally
The AWS Workload Credentials Provider includes a comprehensive integration test suite that validates functionality against real AWS Secrets Manager. These tests cover caching behavior, security features, configuration options, version management, and error handling scenarios.
Prerequisites
ACM_TEST_CERTIFICATE_ARN— ARN of the certificate to exportACM_TEST_ROLE_ARN— IAM role the provider assumes when exporting, requiresacm:ExportCertificatepermissionRequired AWS Permissions
Your AWS credentials must have the following permissions:
secretsmanager:CreateSecretsecretsmanager:GetSecretValuesecretsmanager:DescribeSecretsecretsmanager:UpdateSecretsecretsmanager:UpdateSecretVersionStagesecretsmanager:PutSecretValuesecretsmanager:DeleteSecretsecretsmanager:BatchGetSecretValuesecretsmanager:ListSecretssts:AssumeRoleRequired IAM Roles (for role chaining tests)
The role chaining integration tests require two IAM roles in the same account:
asm-role-chaining-role— Must be assumable by the test runner’s identity and havesecretsmanager:GetSecretValue,secretsmanager:DescribeSecret, andsecretsmanager:BatchGetSecretValuepermissions.provider-no-access-role— Must be assumable by the test runner’s identity but have no Secrets Manager permissions. Used to verify access-denied behavior.Both roles must have a trust policy that allows the identity running the tests to call
sts:AssumeRole. The account ID is discovered automatically viasts:GetCallerIdentity.Running Tests
Option 1: Using the test script
Configure your AWS credentials with appropriate permissions
Run the test script:
Option 2: Manual execution
Configure your AWS credentials with appropriate permissions
Build the provider binary:
Run the integration tests:
Test Organization
The integration tests are organized into the following modules:
secret_retrieval.rs- Tests core secret retrieval functionality including name/ARN lookup, binary secrets, large secrets, and error handlingcache_behavior.rs- Tests caching mechanisms including TTL expiration, refreshNow parameter, and cache bypass (TTL=0)security.rs- Tests security features including SSRF token validation and X-Forwarded-For header rejectionversion_management.rs- Tests secret version transitions and rotation scenariosconfiguration.rs- Tests configuration parameters including health checks and path-based requestsrole_chaining.rs- Tests cross-account secret retrieval via IAM role assumption, including invalid role ARN handling, access denied scenarios, refreshNow with role chaining, and separate per-role cache isolationprefetch.rs- Tests pre-fetching secrets into the cache at startup, including explicit secrets, tag-based discovery, inline TOML syntax, cross-account pre-fetching via role chaining, and resilience to nonexistent secretscertificate_provider.rs- Tests the Certificate Management capability including certificate export, file writing, fullchain mode, refresh command execution, and file permission configurationfile_credentials.rs- Tests file-based credential loading including valid/invalid/missing credentials, session token gate enforcement (rejecting credentials that lackaws_session_tokento prevent use of long-term IAM User keys), self-healing (credentials appearing after startup), and credential rotation