@middy/sts 4.6.0 → 4.6.2

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.
Files changed (3) hide show
  1. package/index.cjs +2 -0
  2. package/index.js +2 -0
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -13,6 +13,7 @@ const _clientsts = require("@aws-sdk/client-sts");
13
13
  const defaults = {
14
14
  AwsClient: _clientsts.STSClient,
15
15
  awsClientOptions: {},
16
+ // awsClientAssumeRole: undefined, // Not Applicable, as this is the middleware that defines the roles
16
17
  awsClientCapture: undefined,
17
18
  fetchData: {},
18
19
  disablePrefetch: false,
@@ -31,6 +32,7 @@ const stsMiddleware = (opts = {})=>{
31
32
  for (const internalKey of Object.keys(options.fetchData)){
32
33
  if (cachedValues[internalKey]) continue;
33
34
  const assumeRoleOptions = options.fetchData[internalKey];
35
+ // Date cannot be used here to assign default session name, possibility of collision when > 1 role defined
34
36
  assumeRoleOptions.RoleSessionName ??= 'middy-sts-session-' + Math.ceil(Math.random() * 99999);
35
37
  values[internalKey] = client.send(new _clientsts.AssumeRoleCommand(assumeRoleOptions)).then((resp)=>({
36
38
  accessKeyId: resp.Credentials.AccessKeyId,
package/index.js CHANGED
@@ -3,6 +3,7 @@ import { STSClient, AssumeRoleCommand } from '@aws-sdk/client-sts';
3
3
  const defaults = {
4
4
  AwsClient: STSClient,
5
5
  awsClientOptions: {},
6
+ // awsClientAssumeRole: undefined, // Not Applicable, as this is the middleware that defines the roles
6
7
  awsClientCapture: undefined,
7
8
  fetchData: {},
8
9
  disablePrefetch: false,
@@ -21,6 +22,7 @@ const stsMiddleware = (opts = {})=>{
21
22
  for (const internalKey of Object.keys(options.fetchData)){
22
23
  if (cachedValues[internalKey]) continue;
23
24
  const assumeRoleOptions = options.fetchData[internalKey];
25
+ // Date cannot be used here to assign default session name, possibility of collision when > 1 role defined
24
26
  assumeRoleOptions.RoleSessionName ??= 'middy-sts-session-' + Math.ceil(Math.random() * 99999);
25
27
  values[internalKey] = client.send(new AssumeRoleCommand(assumeRoleOptions)).then((resp)=>({
26
28
  accessKeyId: resp.Credentials.AccessKeyId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/sts",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "description": "STS (Security Token Service) credentials middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -66,13 +66,13 @@
66
66
  "url": "https://github.com/sponsors/willfarrell"
67
67
  },
68
68
  "dependencies": {
69
- "@middy/util": "4.6.0"
69
+ "@middy/util": "4.6.2"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@aws-sdk/client-sts": "^3.0.0",
73
- "@middy/core": "4.6.0",
73
+ "@middy/core": "4.6.2",
74
74
  "@types/aws-lambda": "^8.10.101",
75
75
  "aws-xray-sdk": "^3.3.3"
76
76
  },
77
- "gitHead": "34e52521a81a224e3d97de6171604c49e676f0d4"
77
+ "gitHead": "8b03a01abf5a9c08231ec5ced775e87f8be8f67d"
78
78
  }