Skip to content

Support shell-free process credentials in AWS profiles #7555

Open

Description

@Munken

Describe the feature

Allow profile-based process credentials to execute a helper directly, without requiring a shell.

ProcessCredentialsProvider.Builder.command(List<String>) already supports this, following #5033. However, ProfileCredentialsUtils.credentialProcessCredentialsProvider() still constructs the provider using the deprecated command(String) overload:

ProcessCredentialsProvider.builder()
    .command(properties.get(ProfileProperty.CREDENTIAL_PROCESS))

That overload prepends sh -c on Unix or cmd.exe /C on Windows. Consequently, configuring an executable binary through credential_process still requires a shell, even when the binary itself does not.

Use Case

We want to authenticate a Java application to AWS using its SPIFFE identity through aws-spiffe-workload-helper.

The application runs in a hardened Linux image that deliberately contains no shell. It can execute native binaries, including the helper, but cannot execute sh.

For example:

[profile spiffe]
credential_process = /app/bin/aws-spiffe-workload-helper x509-credential-process --trust-anchor-arn arn:aws:rolesanywhere:eu-central-1:123456789012:trust-anchor/example --profile-arn arn:aws:rolesanywhere:eu-central-1:123456789012:profile/example --role-arn arn:aws:iam::123456789012:role/example

Using this profile through ProfileCredentialsProvider attempts to launch sh, rather than launching the helper directly.

Programmatically supplying command(List<String>) is not always practical: libraries such as aws-advanced-jdbc-wrapper and aws-msk-iam-auth construct their own AWS credential providers. A profile-based solution would let these libraries use the same credentials configuration without custom integrations.

Proposed Solution

Provide an explicit, opt-in way to configure direct execution through AWS profiles, while preserving existing credential_process behavior.

One possible design is a separate property containing a JSON argument array:

[profile spiffe]
credential_process_argv = ["/app/bin/aws-spiffe-workload-helper", "x509-credential-process", "--trust-anchor-arn", "arn:aws:rolesanywhere:eu-central-1:123456789012:trust-anchor/example", "--profile-arn", "arn:aws:rolesanywhere:eu-central-1:123456789012:profile/example", "--role-arn", "arn:aws:iam::123456789012:role/example"]

The property name and representation are suggestions for discussion, not existing AWS configuration standards.

The SDK can parse the array using its existing JSON utilities and pass it to command(List<String>). Arguments are passed literally, without shell expansion, substitution, pipes, or redirection.

The implementation should:

  • Preserve existing credential_process behavior.
  • Validate the argument array and executable, including rejecting trailing JSON values and NUL characters.
  • Require exactly one process property when selecting process credentials; reject profiles containing both properties.
  • Retain the existing process provider's expiration, refresh, account-ID, and provider-chain behavior.
  • Reuse existing SDK dependencies rather than introduce new external libraries.

Would the SDK team prefer this structured representation, or an opt-in execution-mode setting with defined command-line parsing rules?

Other Information

Alternatives considered

Alternative Trade-off
Include a shell in the application image Conflicts with the hardening requirement.
Supply command(List<String>) programmatically Works when provider injection is available, but requires library-specific integration.
Run the helper in credential-file mode Viable, but writes temporary credentials to shared storage and introduces refresh/startup coordination.
Change existing credential_process to direct execution Could break configurations relying on shell behavior.
Add a no-shell flag for the existing command string Preserves the command format, but requires explicit quoting and escaping rules.

Proposed implementation

An implementation with regression tests is available in PR #7556. It demonstrates the proposed credential_process_argv approach as a basis for discussion; the property name and configuration format remain open to maintainer feedback.

The implementation includes tests for profile/default-provider-chain loading, literal arguments, malformed input, conflicting properties, caching, refresh, and account-ID handling. Maven checks passed for auth, profiles, STS, SSO, and sign-in.

A smoke test also passed using a Java test helper in gcr.io/distroless/java21-debian12:nonroot, with a read-only filesystem, no network, dropped capabilities, and no shell present. The argv profile resolved and cached credentials and preserved shell characters literally; the legacy string profile failed because sh was absent. This test did not perform a live SPIFFE/AWS exchange.

Related work: #5033 added direct execution through the list-based API; #1166 introduced profile credential_process support.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

The behavior was identified in 2.48.4 and verified by source inspection in 2.59.2-SNAPSHOT, upstream commit e267c72e6b4dd18aa091f36776f6d3c29bb76f2f. The implementation was built and tested against that snapshot.

JDK version used

Java 21; local builds used Eclipse Temurin 21.0.11.

Operating System and version

Target and smoke test: Debian 12 distroless Linux container (gcr.io/distroless/java21-debian12:nonroot). Local development and Maven checks: macOS.

AI tools

  • I have reviewed this issue myself, including any content generated by AI tools

Activity

  1. added
    feature-request
    needs-triage
    on Nov 16, 2026
  2. debora-ito commented on Nov 17, 2026

    @debora-ito
    Member

    Hi @Munken thank you for reaching out.

    The credential process is standardized across all SDKs and the CLI, so any change in the process should be supported by all. The proposed new profile property would be in a shared resource, it would work on the Java SDK alone but can potentially break other SDKs.

    Researching how this is handled in other SDKs, I found the same ask in the aws/aws-sdk-go-v2#2879 with a comment that basically summarizes the inconsistency in the SDKs around this point.

    I'll mark this as a cross-SDK feature request.

    As a community note: please vote by adding a 👍 reaction to the top description to show your interest in this feature.

  3. added
    p2
    and removed
    needs-triage
    on Nov 17, 2026
  4. Munken commented on Nov 17, 2026

    @Munken
    Author

    Thanks for the reply @debora-ito. Considering the other issue was opened back in 2021 is this something you expect will actually be resolved?

    just wondering whether I should reach for some of the workarounds mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cross-sdkfeature-requestp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions