@vercel/oidc-aws-credentials-provider 3.1.5 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @vercel/oidc
|
|
2
2
|
|
|
3
|
+
## 3.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [fb93ff6]
|
|
8
|
+
- @vercel/oidc@3.7.1
|
|
9
|
+
|
|
10
|
+
## 3.2.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 415fde0: Add optional `audience` and `jti` parameters to exchange Vercel OIDC tokens for use with AWS STS and other providers.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [415fde0]
|
|
19
|
+
- @vercel/oidc@3.7.0
|
|
20
|
+
|
|
3
21
|
## 3.1.5
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -4,6 +4,8 @@ import type { FromWebTokenInit } from '@aws-sdk/credential-provider-web-identity
|
|
|
4
4
|
* The init object for the `awsCredentialsProvider` function.
|
|
5
5
|
*
|
|
6
6
|
* @typedef {Object} AwsCredentialsProviderInit
|
|
7
|
+
* @property {string} audience - Optional audience to set on the exchanged token.
|
|
8
|
+
* @property {string} jti - Optional JTI to set on the exchanged token.
|
|
7
9
|
* @property {string} roleArn - ARN of the role that the caller is assuming.
|
|
8
10
|
* @property {Object} [clientConfig] - Custom STS client configurations overriding the default ones.
|
|
9
11
|
* @property {Array} [clientPlugins] - Custom STS client middleware plugin to modify the client default behavior.
|
|
@@ -15,12 +17,24 @@ import type { FromWebTokenInit } from '@aws-sdk/credential-provider-web-identity
|
|
|
15
17
|
* @property {number} [durationSeconds=3600] - The duration, in seconds, of the role session. Defaults to 3600 seconds.
|
|
16
18
|
*/
|
|
17
19
|
export interface AwsCredentialsProviderInit extends Omit<FromWebTokenInit, 'webIdentityToken'> {
|
|
20
|
+
/**
|
|
21
|
+
* Optional audience to set on the exchanged token.
|
|
22
|
+
* @default undefined
|
|
23
|
+
*/
|
|
24
|
+
audience?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional JTI to set on the exchanged token.
|
|
27
|
+
* @default undefined
|
|
28
|
+
*/
|
|
29
|
+
jti?: string;
|
|
18
30
|
}
|
|
19
31
|
/**
|
|
20
32
|
* Obtains the Vercel OIDC token and creates an AWS credential provider function
|
|
21
33
|
* that gets AWS credentials by calling STS AssumeRoleWithWebIdentity API.
|
|
22
34
|
*
|
|
23
35
|
* @param {AwsCredentialsProviderInit} init - The initialization object.
|
|
36
|
+
* @param {string} init.audience - Optional audience to set on the exchanged token.
|
|
37
|
+
* @param {string} init.jti - Optional JTI to set on the exchanged token.
|
|
24
38
|
* @param {string} init.roleArn - ARN of the role that the caller is assuming.
|
|
25
39
|
* @param {Object} [init.clientConfig] - Custom STS client configurations overriding the default ones.
|
|
26
40
|
* @param {Array} [init.clientPlugins] - Custom STS client middleware plugin to modify the client default behavior.
|
|
@@ -40,6 +54,8 @@ export interface AwsCredentialsProviderInit extends Omit<FromWebTokenInit, 'webI
|
|
|
40
54
|
*
|
|
41
55
|
* const s3Client = new s3.S3Client({
|
|
42
56
|
* credentials: awsCredentialsProvider({
|
|
57
|
+
* audience: 'https://sts.amazonaws.com',
|
|
58
|
+
* jti: secureRandomString(),
|
|
43
59
|
* roleArn: "arn:aws:iam::1234567890:role/RoleA",
|
|
44
60
|
* clientConfig: { region: "us-west-2" },
|
|
45
61
|
* clientPlugins: [addFooHeadersPlugin],
|
|
@@ -24,10 +24,11 @@ module.exports = __toCommonJS(aws_credentials_provider_exports);
|
|
|
24
24
|
var import_credential_provider_web_identity = require("@aws-sdk/credential-provider-web-identity");
|
|
25
25
|
var import_oidc = require("@vercel/oidc");
|
|
26
26
|
function awsCredentialsProvider(init) {
|
|
27
|
+
const { audience, jti, ...initOptions } = init;
|
|
27
28
|
return async () => {
|
|
28
29
|
return (0, import_credential_provider_web_identity.fromWebToken)({
|
|
29
|
-
...
|
|
30
|
-
webIdentityToken: (0, import_oidc.
|
|
30
|
+
...initOptions,
|
|
31
|
+
webIdentityToken: await (0, import_oidc.getVercelOidcToken)({ audience, jti })
|
|
31
32
|
})();
|
|
32
33
|
};
|
|
33
34
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> **awsCredentialsProvider**(`init`): `AwsCredentialIdentityProvider`
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:
|
|
9
|
+
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:77](https://github.com/vercel/vercel/blob/main/packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts#L77)
|
|
10
10
|
|
|
11
11
|
Obtains the Vercel OIDC token and creates an AWS credential provider function
|
|
12
12
|
that gets AWS credentials by calling STS AssumeRoleWithWebIdentity API.
|
|
@@ -33,6 +33,8 @@ import { awsCredentialsProvider } from '@vercel/functions/oidc';
|
|
|
33
33
|
|
|
34
34
|
const s3Client = new s3.S3Client({
|
|
35
35
|
credentials: awsCredentialsProvider({
|
|
36
|
+
audience: 'https://sts.amazonaws.com',
|
|
37
|
+
jti: secureRandomString(),
|
|
36
38
|
roleArn: 'arn:aws:iam::1234567890:role/RoleA',
|
|
37
39
|
clientConfig: { region: 'us-west-2' },
|
|
38
40
|
clientPlugins: [addFooHeadersPlugin],
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Interface: AwsCredentialsProviderInit
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:
|
|
7
|
+
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:22](https://github.com/vercel/vercel/blob/main/packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts#L22)
|
|
8
8
|
|
|
9
9
|
The init object for the `awsCredentialsProvider` function.
|
|
10
10
|
|
|
@@ -14,6 +14,16 @@ The init object for the `awsCredentialsProvider` function.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
+
### audience?
|
|
18
|
+
|
|
19
|
+
> `optional` **audience?**: `string`
|
|
20
|
+
|
|
21
|
+
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:28](https://github.com/vercel/vercel/blob/main/packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts#L28)
|
|
22
|
+
|
|
23
|
+
Optional audience to set on the exchanged token.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
17
27
|
### clientConfig?
|
|
18
28
|
|
|
19
29
|
> `optional` **clientConfig?**: `any`
|
|
@@ -54,6 +64,16 @@ The duration, in seconds, of the role session. Defaults to 3600 seconds.
|
|
|
54
64
|
|
|
55
65
|
---
|
|
56
66
|
|
|
67
|
+
### jti?
|
|
68
|
+
|
|
69
|
+
> `optional` **jti?**: `string`
|
|
70
|
+
|
|
71
|
+
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:33](https://github.com/vercel/vercel/blob/main/packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts#L33)
|
|
72
|
+
|
|
73
|
+
Optional JTI to set on the exchanged token.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
57
77
|
### logger?
|
|
58
78
|
|
|
59
79
|
> `optional` **logger?**: `Logger`
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"require": "./dist/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"version": "3.1
|
|
17
|
+
"version": "3.2.1",
|
|
18
18
|
"repository": {
|
|
19
19
|
"directory": "packages/oidc-aws-credentials-provider",
|
|
20
20
|
"type": "git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@aws-sdk/credential-provider-web-identity": "^3.609.0",
|
|
45
|
-
"@vercel/oidc": "3.
|
|
45
|
+
"@vercel/oidc": "3.7.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"pretest": "pnpm run build:code",
|