@middy/sts 5.2.0 → 5.2.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 (2) hide show
  1. package/index.js +5 -2
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -5,7 +5,8 @@ import {
5
5
  getCache,
6
6
  getInternal,
7
7
  processCache,
8
- modifyCache
8
+ modifyCache,
9
+ catchInvalidSignatureException
9
10
  } from '@middy/util'
10
11
  import { STSClient, AssumeRoleCommand } from '@aws-sdk/client-sts'
11
12
 
@@ -34,8 +35,10 @@ const stsMiddleware = (opts = {}) => {
34
35
  // Date cannot be used here to assign default session name, possibility of collision when > 1 role defined
35
36
  assumeRoleOptions.RoleSessionName ??=
36
37
  'middy-sts-session-' + Math.ceil(Math.random() * 99999)
38
+ const command = new AssumeRoleCommand(assumeRoleOptions)
37
39
  values[internalKey] = client
38
- .send(new AssumeRoleCommand(assumeRoleOptions))
40
+ .send(command)
41
+ .catch((e) => catchInvalidSignatureException(e, client, command))
39
42
  .then((resp) => ({
40
43
  accessKeyId: resp.Credentials.AccessKeyId,
41
44
  secretAccessKey: resp.Credentials.SecretAccessKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/sts",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "STS (Security Token Service) credentials middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -60,13 +60,13 @@
60
60
  "url": "https://github.com/sponsors/willfarrell"
61
61
  },
62
62
  "dependencies": {
63
- "@middy/util": "5.2.0"
63
+ "@middy/util": "5.2.2"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@aws-sdk/client-sts": "^3.0.0",
67
- "@middy/core": "5.2.0",
67
+ "@middy/core": "5.2.2",
68
68
  "@types/aws-lambda": "^8.10.101",
69
69
  "aws-xray-sdk": "^3.3.3"
70
70
  },
71
- "gitHead": "2d9096a49cd8fb62359517be96d6c93609df41f0"
71
+ "gitHead": "dbfe56d5dfc783fae1e19c7dddd074c0d18d5073"
72
72
  }