ag-awsauth 0.0.298 → 0.0.300

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/README.md CHANGED
@@ -30,7 +30,8 @@ expired. A valid portal session can renew SAML role credentials directly;
30
30
  native AWS accounts use the OIDC access token, refreshing it when AWS rejects
31
31
  it. Rotated refresh tokens are saved immediately, even if a later request fails.
32
32
 
33
- When AWS rejects the refresh token (`InvalidGrantException`), another sign-in
33
+ When AWS rejects the refresh token or cached refresh request
34
+ (`InvalidGrantException` or `InvalidRequestException`), another sign-in
34
35
  is required. An unexpired client registration alone does not make a refresh
35
36
  token valid. The warning before the MFA prompt reports the reason. Portal
36
37
  outages and network failures are reported as errors instead of requesting login.
@@ -26,11 +26,12 @@ class InteractiveSignInRequiredError extends Error {
26
26
  }
27
27
  }
28
28
  exports.InteractiveSignInRequiredError = InteractiveSignInRequiredError;
29
- // Errors that mean the stored registration/token can never be reused.
29
+ // Cached refresh failures that require a new sign-in.
30
30
  const terminalErrorNames = [
31
31
  'InteractiveSignInRequiredError',
32
32
  'InvalidGrantException',
33
33
  'InvalidClientException',
34
+ 'InvalidRequestException',
34
35
  'UnauthorizedClientException',
35
36
  ];
36
37
  function requiresInteractiveSignIn(e) {
@@ -50,7 +51,6 @@ function needsRefresh(p) {
50
51
  }
51
52
  return p.accessTokenExpiresAt - Date.now() <= config_1.refreshWindowMs;
52
53
  }
53
- const fingerprint = (t) => (t ? `${t.slice(0, 8)}...` : 'none');
54
54
  function refreshAccessToken(p) {
55
55
  return __awaiter(this, void 0, void 0, function* () {
56
56
  if (!hasRefreshMaterial(p)) {
@@ -60,7 +60,7 @@ function refreshAccessToken(p) {
60
60
  p.clientSecretExpiresAt <= Math.floor(Date.now() / 1000)) {
61
61
  throw new InteractiveSignInRequiredError('OIDC client registration has expired');
62
62
  }
63
- (0, log_1.info)(`refreshing OIDC token with refresh token ${fingerprint(p.refreshToken)}`);
63
+ (0, log_1.info)('refreshing OIDC access token');
64
64
  const response = yield new client_sso_oidc_1.SSOOIDCClient({
65
65
  region: config_1.identityCenterRegion,
66
66
  }).send(new client_sso_oidc_1.CreateTokenCommand({
@@ -47,7 +47,8 @@ function fetchPortalJson(url, p, isValid) {
47
47
  });
48
48
  }
49
49
  const getAssumedRole = (p) => __awaiter(void 0, void 0, void 0, function* () {
50
- var _a, _b, _c, _d;
50
+ var _a, _b, _c;
51
+ var _d;
51
52
  const sso = new client_sso_1.SSOClient({ region: config_1.identityCenterRegion });
52
53
  let accountId = p.accountId;
53
54
  if (!accountId) {
@@ -42,7 +42,8 @@ function validateCredentials(credentials) {
42
42
  }
43
43
  function getApplicationCreds(p) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
- var _a, _b;
45
+ var _a;
46
+ var _b;
46
47
  const sts = new client_sts_1.STS({
47
48
  credentials: p.originCreds,
48
49
  region: p.targetRegion,
@@ -53,11 +54,11 @@ function getApplicationCreds(p) {
53
54
  SAMLAssertion: p.samlAssertion,
54
55
  DurationSeconds: config_1.stsDurationSeconds,
55
56
  });
56
- if (((_a = ret.$metadata.httpStatusCode) !== null && _a !== void 0 ? _a : 500) >= 400) {
57
+ if (((_b = ret.$metadata.httpStatusCode) !== null && _b !== void 0 ? _b : 500) >= 400) {
57
58
  (0, log_1.error)('bad assume saml role', ret);
58
59
  throw new Error('bad assume saml role');
59
60
  }
60
- if (!((_b = ret.Credentials) === null || _b === void 0 ? void 0 : _b.AccessKeyId) ||
61
+ if (!((_a = ret.Credentials) === null || _a === void 0 ? void 0 : _a.AccessKeyId) ||
61
62
  !ret.Credentials.SecretAccessKey ||
62
63
  !ret.Credentials.SessionToken) {
63
64
  throw new Error('no creds');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-awsauth",
3
- "version": "0.0.298",
3
+ "version": "0.0.300",
4
4
  "private": false,
5
5
  "description": "auth to aws sso/iamv2 easily",
6
6
  "license": "ISC",
@@ -16,27 +16,27 @@
16
16
  ],
17
17
  "main": "dist/index.js",
18
18
  "dependencies": {
19
- "@aws-sdk/client-sso": "3.972.0",
20
- "@aws-sdk/client-sso-oidc": "3.972.0",
21
- "@aws-sdk/client-sts": "3.972.0",
19
+ "@aws-sdk/client-sso": "3.1146.0",
20
+ "@aws-sdk/client-sso-oidc": "3.1146.0",
21
+ "@aws-sdk/client-sts": "3.1146.0",
22
22
  "@aws-sdk/shared-ini-file-loader": "3.374.0",
23
- "ag-common": "0.0.912",
23
+ "ag-common": "0.0.914",
24
24
  "cli-select": "1.1.2",
25
- "dotenv": "17.2.3",
25
+ "dotenv": "18.0.5",
26
26
  "envfile": "7.1.0",
27
- "eslint-config-e7npm": "0.1.68",
28
- "ini": "5.0.0",
27
+ "eslint-config-e7npm": "0.1.70",
28
+ "ini": "7.0.0",
29
29
  "node-fetch": "3.3.2",
30
- "oxfmt": "^0.65.0",
31
- "oxlint": "^1.83.0",
32
- "puppeteer": "24.35.0",
30
+ "oxfmt": "^0.71.0",
31
+ "oxlint": "^1.86.0",
32
+ "puppeteer": "25.12.0",
33
33
  "readline-sync": "1.4.10",
34
- "typescript": "5.9.3",
35
- "yargs": "18.0.0"
34
+ "typescript": "7.0.2",
35
+ "yargs": "18.2.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/ini": "4.1.1",
39
- "@types/node": "24.10.9",
39
+ "@types/node": "26.6.4",
40
40
  "@types/node-fetch": "2.6.13",
41
41
  "@types/readline-sync": "1.4.8",
42
42
  "@types/yargs": "17.0.35"