Skip to content

Workload Identities Node-AWS Pilot private preview - #2858

Open
mark-kogan-stripe wants to merge 21 commits into
private-previewfrom
mark/DEVSDK-3242-privatepreview
Open

mark-kogan-stripe wants to merge 21 commits into
private-previewfrom
mark/DEVSDK-3242-privatepreview

Conversation

@mark-kogan-stripe

@mark-kogan-stripe mark-kogan-stripe commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Why?

This PR introduces an alternate way to create a top-level Stripe client, authenticated via AWS instead of a long-lived API key. Rather than relying on a semi-permanent secret that can be leaked or mismanaged, the SDK fetches a short-lived token backed by a public key and the guarantee that the code is running on genuine cloud provider hardware.

The change adds a separate adapter package within this repo that uses the AWS SDK to build an assertion function capable of retrieving web identity tokens. The core stripe package then uses that assertion function to mint an ephemeral key, refreshing it proactively and also on a single 401 as a fallback, for the lifetime of the session. Once constructed, the resulting Stripe client behaves identically to a standard one.

What?

  • Creates an independent package under packages/aws-workload-identity.
  • Adds packages/aws-workload-identity/src/index.ts, which uses the AWS SDK to export awsWorkloadIdentity().
  • Adds new tests under packages/ and updates ci-tests.
  • Adds src/net/WorkloadIdentityTokenTransport.ts, which hard-codes an HTTP call to the intended Stripe endpoint, designed to carry the JWT without allowing redirects.
  • Introduces a new error type for errors arising from the workload identity process.
  • Updates the request sender to allow a single retry when the authentication method in use is workloadidentity — kept separate from the normal network retry logic.
  • Updates stripe.core.ts and stripe.esm.node.ts to include the alternate constructor, along with a new _authMethod parameter that serves as the source of truth for which authentication method is in use.
  • Adds WorkloadIdentity.ts, containing the core logic for refreshing and caching the token in a thread-safe way, attaching workload identity credentials as a symbol on the config, validating types, and producing the authenticator function that takes a request and attaches the cached token.
  • Adds additional test files for workload identity.
  • Updates the README, .gitignore, and changelogs.

See Also

Configuration

  • skip-changefile: This PR is not a user-facing change, so there's no changefile.

@mark-kogan-stripe mark-kogan-stripe changed the title Mark/devsdk 3242 privatepreview Workload Identities Node-AWS Pilot private preview Sep 29, 2026
@mark-kogan-stripe
mark-kogan-stripe force-pushed the mark/DEVSDK-3242-privatepreview branch from a5e2514 to 040e8bc Compare September 30, 2026 19:46
@mark-kogan-stripe
mark-kogan-stripe force-pushed the mark/DEVSDK-3242-privatepreview branch from 040e8bc to df3dc63 Compare September 30, 2026 19:49
Co-authored-by: mark-kogan-stripe <322952142+mark-kogan-stripe@users.noreply.github.com>
@mark-kogan-stripe
mark-kogan-stripe force-pushed the mark/DEVSDK-3242-privatepreview branch from 54c3ee5 to 7e93716 Compare October 1, 2026 14:41
@mark-kogan-stripe
mark-kogan-stripe force-pushed the mark/DEVSDK-3242-privatepreview branch from 431ba50 to 848e09f Compare October 2, 2026 18:24
@mark-kogan-stripe
mark-kogan-stripe force-pushed the mark/DEVSDK-3242-privatepreview branch from b1d68d7 to 071d447 Compare October 3, 2026 19:51
@mark-kogan-stripe
mark-kogan-stripe force-pushed the mark/DEVSDK-3242-privatepreview branch from 4955996 to 394024a Compare October 5, 2026 13:46
@mark-kogan-stripe
mark-kogan-stripe marked this pull request as ready for review October 5, 2026 17:29
@mark-kogan-stripe
mark-kogan-stripe requested a review from a team as a code owner October 5, 2026 17:29
@mark-kogan-stripe
mark-kogan-stripe requested review from jar-stripe and justiny-stripe and removed request for a team and justiny-stripe October 5, 2026 17:29

@jar-stripe jar-stripe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lotsa notes 😅 . I saw a couple of patterns around comments that could be cleaned up and checks for types/shapes that really should have been enforced by the type system. It's worth a cleanup pass and then another pass to see if theres anything else like this that i missed

Comment thread .github/workflows/main.yml Outdated
Comment thread README.md
Comment thread src/net/WorkloadIdentityTokenTransport.ts Outdated
Comment thread packages/aws-workload-identity/README.md Outdated
Comment thread packages/aws-workload-identity/src/index.ts Outdated
Comment thread src/WorkloadIdentity.ts Outdated
Comment thread src/WorkloadIdentity.ts
});
}

const parsed = parseJsonOrNull(response.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a follow on ticket, its worth considering zod or runtypes for json validation here.

Comment thread test/PackageExports.spec.ts Outdated
Comment thread src/stripe.core.ts Outdated
Comment thread src/stripe.core.ts
): Stripe {
validateWorkloadIdentityProvider(identityProvider);

if (config && typeof config !== 'object') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check feels unnecessary; the type will does not allow a string form

Comment thread .hark/changes/2026-09-30_markkogan_workload-identity-aws.change.md Outdated
…able, pull aws-wif package publishing into separate workflow, remove redundant tests and message truncation, fix error convention and improve docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants