Skip to content

First-class AWS SSO / IAM role assumption support in model execution #371

@andrewboyd79

Description

@andrewboyd79

Problem

IAM users with long-lived access keys are a deprecated pattern. AWS SSO (IAM Identity Center) and role assumption are now the standard authentication approach across organisations. Today, swamp has no first-class support for this:

  • Model globalArguments for AWS integrations only accept static credential fields (awsAccessKeyId, awsSecretAccessKey, awsSessionToken)
  • When an SSO session expires mid-workflow, the failure surfaces deep inside a scan step with a generic credentials error rather than a clear, actionable message
  • There is no pre-flight session validation hook in the workflow execution lifecycle
  • Users must manually run aws sso login before each workflow run and hope the session does not expire during execution

Proposed Solution

First-class SSO/role assumption support should be a core capability, not a workaround. The following improvements would address this:

1. AWS profile support in execution context
Model execution should natively support an awsProfile concept that is resolved through the standard AWS credential chain (SSO token cache, credential process, instance profile, environment). A user should be able to declare the profile name and swamp handles the rest.

2. Pre-flight credential validation
Before executing any AWS-dependent model method, swamp should verify the resolved credentials are valid (e.g. via sts:GetCallerIdentity) and fail fast with a clear, actionable error if they are not — including a hint about how to refresh (e.g. aws sso login --sso-session <name>).

3. Credential process / auto-refresh support
Where the AWS profile is configured with a credential_process (e.g. aws-sso-util, custom scripts), swamp's execution environment should invoke it transparently at runtime rather than relying on statically resolved credentials baked into the model input.

4. Role chaining / assume-role
Support for specifying a role ARN to assume at execution time, using the resolved base credentials, so that cross-account access patterns work cleanly without pre-staging credentials.

Alternatives Considered

  • Vault with credential rotation: Storing SSO-derived short-lived credentials in a swamp vault before each run. This requires a manual pre-step, reintroduces the rotation problem the user was trying to avoid, and is operationally brittle.
  • Wrapper scripts: Shelling out to aws sso login as a first workflow job. aws sso login is inherently interactive (browser-based); it cannot run unattended.
  • Environment variables: Exporting credentials into the shell environment before running the workflow. Works for single-account use cases but does not scale to multi-account workflows where each job needs a different identity.

Additional Context

This came up while building a multi-account S3 audit workflow. Five parallel scan jobs each target a different AWS account via SSO profiles. The workaround (adding awsProfile to the model schema and passing AWS_PROFILE through the execution environment) works once a session is established, but the workflow has no way to ensure the session is active, validate it before starting, or recover gracefully when it expires. SSO/role assumption is the norm in any organisation that takes security posture seriously — it should be a first-class citizen in swamp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestin-discussionA feature or issue that is in active discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions