@azure/msal-node 7.2.0 → 7.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 (59) hide show
  1. package/dist/cache/CacheHelpers.mjs +1 -1
  2. package/dist/cache/NodeStorage.mjs +1 -1
  3. package/dist/cache/TokenCache.mjs +1 -1
  4. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  5. package/dist/cache/serializer/Deserializer.mjs +1 -1
  6. package/dist/cache/serializer/Serializer.mjs +1 -1
  7. package/dist/client/BaseClient.mjs +1 -1
  8. package/dist/client/ClientApplication.mjs +11 -15
  9. package/dist/client/ClientApplication.mjs.map +1 -1
  10. package/dist/client/ClientAssertion.mjs +1 -1
  11. package/dist/client/ClientCredentialClient.mjs +1 -1
  12. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  13. package/dist/client/DeviceCodeClient.mjs +1 -1
  14. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  15. package/dist/client/ManagedIdentityClient.mjs +1 -1
  16. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  17. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  19. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  21. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  22. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  23. package/dist/client/OnBehalfOfClient.mjs +1 -1
  24. package/dist/client/PublicClientApplication.mjs +1 -1
  25. package/dist/client/SilentRequestCoalescer.mjs +1 -1
  26. package/dist/client/UserFederatedIdentityCredentialClient.mjs +1 -1
  27. package/dist/client/UsernamePasswordClient.mjs +1 -1
  28. package/dist/config/Configuration.mjs +1 -1
  29. package/dist/config/ManagedIdentityId.mjs +1 -1
  30. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  31. package/dist/crypto/CryptoProvider.mjs +1 -1
  32. package/dist/crypto/GuidGenerator.mjs +1 -1
  33. package/dist/crypto/HashUtils.mjs +1 -1
  34. package/dist/crypto/PkceGenerator.mjs +1 -1
  35. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  36. package/dist/error/ManagedIdentityError.mjs +1 -1
  37. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  38. package/dist/error/NodeAuthError.mjs +1 -1
  39. package/dist/index.mjs +1 -1
  40. package/dist/internals.mjs +1 -1
  41. package/dist/network/HttpClient.mjs +1 -1
  42. package/dist/network/HttpClientWithRetries.mjs +1 -1
  43. package/dist/network/LoopbackClient.mjs +1 -1
  44. package/dist/packageMetadata.mjs +2 -2
  45. package/dist/protocol/Authorize.mjs +1 -1
  46. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  47. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  48. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  49. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  50. package/dist/utils/Constants.mjs +1 -1
  51. package/dist/utils/EncodingUtils.mjs +1 -1
  52. package/dist/utils/TimeUtils.mjs +1 -1
  53. package/lib/msal-node.cjs +147 -96
  54. package/lib/msal-node.cjs.map +1 -1
  55. package/package.json +2 -2
  56. package/src/client/ClientApplication.ts +10 -15
  57. package/src/packageMetadata.ts +1 -1
  58. package/types/client/ClientApplication.d.ts.map +1 -1
  59. package/types/packageMetadata.d.ts +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v7.2.0 2026-11-05 */
1
+ /*! @azure/msal-node v7.2.2 2026-11-12 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -151,7 +151,7 @@ class Serializer {
151
151
  }
152
152
  }
153
153
 
154
- /*! @azure/msal-common v16.16.0 2026-11-05 */
154
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
155
155
  /*
156
156
  * Copyright (c) Microsoft Corporation. All rights reserved.
157
157
  * Licensed under the MIT License.
@@ -215,7 +215,7 @@ const ATTRIBUTE_TOKENS = "attribute_tokens";
215
215
  */
216
216
  const POPUP_ORIGIN_CHECK_DONE = "pocd";
217
217
 
218
- /*! @azure/msal-common v16.16.0 2026-11-05 */
218
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
219
219
  /*
220
220
  * Copyright (c) Microsoft Corporation. All rights reserved.
221
221
  * Licensed under the MIT License.
@@ -473,7 +473,7 @@ const EncodingTypes = {
473
473
  UTF8: "utf-8",
474
474
  };
475
475
 
476
- /*! @azure/msal-common v16.16.0 2026-11-05 */
476
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
477
477
  /*
478
478
  * Copyright (c) Microsoft Corporation. All rights reserved.
479
479
  * Licensed under the MIT License.
@@ -502,7 +502,7 @@ function createAuthError(code, correlationId, additionalMessage) {
502
502
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
503
503
  }
504
504
 
505
- /*! @azure/msal-common v16.16.0 2026-11-05 */
505
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
506
506
 
507
507
  /*
508
508
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -525,7 +525,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
525
525
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
526
526
  }
527
527
 
528
- /*! @azure/msal-common v16.16.0 2026-11-05 */
528
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
529
529
  /*
530
530
  * Copyright (c) Microsoft Corporation. All rights reserved.
531
531
  * Licensed under the MIT License.
@@ -611,7 +611,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
611
611
  userCanceled: userCanceled
612
612
  });
613
613
 
614
- /*! @azure/msal-common v16.16.0 2026-11-05 */
614
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
615
615
 
616
616
  /*
617
617
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -649,7 +649,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
649
649
  };
650
650
  }
651
651
 
652
- /*! @azure/msal-common v16.16.0 2026-11-05 */
652
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
653
653
 
654
654
  /*
655
655
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -715,7 +715,7 @@ function getJWSPayload(authToken, correlationId) {
715
715
  return matches[2];
716
716
  }
717
717
 
718
- /*! @azure/msal-common v16.16.0 2026-11-05 */
718
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
719
719
 
720
720
  /*
721
721
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -803,7 +803,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
803
803
  return updatedAccountInfo;
804
804
  }
805
805
 
806
- /*! @azure/msal-common v16.16.0 2026-11-05 */
806
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
807
807
  /*
808
808
  * Copyright (c) Microsoft Corporation. All rights reserved.
809
809
  * Licensed under the MIT License.
@@ -817,7 +817,7 @@ const AuthorityType = {
817
817
  Ciam: 3,
818
818
  };
819
819
 
820
- /*! @azure/msal-common v16.16.0 2026-11-05 */
820
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
821
821
  /*
822
822
  * Copyright (c) Microsoft Corporation. All rights reserved.
823
823
  * Licensed under the MIT License.
@@ -839,7 +839,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
839
839
  return null;
840
840
  }
841
841
 
842
- /*! @azure/msal-common v16.16.0 2026-11-05 */
842
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
843
843
  /*
844
844
  * Copyright (c) Microsoft Corporation. All rights reserved.
845
845
  * Licensed under the MIT License.
@@ -863,7 +863,7 @@ const ProtocolMode = {
863
863
  EAR: "EAR",
864
864
  };
865
865
 
866
- /*! @azure/msal-common v16.16.0 2026-11-05 */
866
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
867
867
  /**
868
868
  * Returns the AccountInfo interface for this account.
869
869
  * @internal
@@ -1012,7 +1012,7 @@ function isAccountEntity(entity) {
1012
1012
  entity.hasOwnProperty("authorityType"));
1013
1013
  }
1014
1014
 
1015
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1015
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1016
1016
  /*
1017
1017
  * Copyright (c) Microsoft Corporation. All rights reserved.
1018
1018
  * Licensed under the MIT License.
@@ -1029,7 +1029,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
1029
1029
  unexpectedError: unexpectedError
1030
1030
  });
1031
1031
 
1032
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1032
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1033
1033
 
1034
1034
  /*
1035
1035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1049,7 +1049,7 @@ function createClientConfigurationError(errorCode, correlationId) {
1049
1049
  return new ClientConfigurationError(errorCode, correlationId);
1050
1050
  }
1051
1051
 
1052
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1052
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1053
1053
  /*
1054
1054
  * Copyright (c) Microsoft Corporation. All rights reserved.
1055
1055
  * Licensed under the MIT License.
@@ -1089,7 +1089,7 @@ function getResponseHeader(headers, name) {
1089
1089
  return headerName === undefined ? undefined : headers[headerName];
1090
1090
  }
1091
1091
 
1092
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1092
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1093
1093
  /*
1094
1094
  * Copyright (c) Microsoft Corporation. All rights reserved.
1095
1095
  * Licensed under the MIT License.
@@ -1159,7 +1159,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1159
1159
  urlParseError: urlParseError
1160
1160
  });
1161
1161
 
1162
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1162
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1163
1163
  /*
1164
1164
  * Copyright (c) Microsoft Corporation. All rights reserved.
1165
1165
  * Licensed under the MIT License.
@@ -1171,7 +1171,7 @@ function isOpenIdConfigResponse(response) {
1171
1171
  response.hasOwnProperty("jwks_uri"));
1172
1172
  }
1173
1173
 
1174
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1174
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1175
1175
  /*
1176
1176
  * Copyright (c) Microsoft Corporation. All rights reserved.
1177
1177
  * Licensed under the MIT License.
@@ -1251,12 +1251,18 @@ class StringUtils {
1251
1251
  }
1252
1252
  }
1253
1253
 
1254
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1254
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1255
1255
 
1256
1256
  /*
1257
1257
  * Copyright (c) Microsoft Corporation. All rights reserved.
1258
1258
  * Licensed under the MIT License.
1259
1259
  */
1260
+ // Matches ASCII controls, space, DEL, backslash, or the userinfo separator (@).
1261
+ const UNSAFE_AUTHORITY = /[\x00-\x20\x7f\\@]/;
1262
+ const DEFAULT_PORTS = {
1263
+ "https:": ":443",
1264
+ "http:": ":80",
1265
+ };
1260
1266
  /**
1261
1267
  * Url object class which can perform various transformations on url strings.
1262
1268
  */
@@ -1372,6 +1378,29 @@ class UrlString {
1372
1378
  AbsolutePath: match[5],
1373
1379
  QueryString: match[7],
1374
1380
  };
1381
+ let parsedUrl;
1382
+ try {
1383
+ parsedUrl = new URL(this.urlString);
1384
+ }
1385
+ catch {
1386
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1387
+ }
1388
+ const host = urlComponents.HostNameAndPort?.toLowerCase();
1389
+ const schemeAndAuthority = `${urlComponents.Protocol}//${host}`;
1390
+ const defaultPort = DEFAULT_PORTS[parsedUrl.protocol] ?? "";
1391
+ /*
1392
+ * Cross-check the original host; reparsing parsedUrl would hide parser differences.
1393
+ * URL has validated IPv6 syntax, so only bracketed hosts need a normalization comparison.
1394
+ */
1395
+ const hostMatches = host === parsedUrl.host ||
1396
+ host === `${parsedUrl.host}${defaultPort}` ||
1397
+ (host?.startsWith("[") &&
1398
+ new URL(`${urlComponents.Protocol}//${host}`).host ===
1399
+ parsedUrl.host);
1400
+ // Check authority ambiguity without restricting resource paths, queries, or fragments.
1401
+ if (UNSAFE_AUTHORITY.test(schemeAndAuthority) || !hostMatches) {
1402
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1403
+ }
1375
1404
  let pathSegments = urlComponents.AbsolutePath.split("/");
1376
1405
  pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements
1377
1406
  urlComponents.PathSegments = pathSegments;
@@ -1409,7 +1438,7 @@ class UrlString {
1409
1438
  }
1410
1439
  }
1411
1440
 
1412
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1441
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1413
1442
 
1414
1443
  /*
1415
1444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1563,7 +1592,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1563
1592
  return null;
1564
1593
  }
1565
1594
 
1566
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1595
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1567
1596
  /*
1568
1597
  * Copyright (c) Microsoft Corporation. All rights reserved.
1569
1598
  * Licensed under the MIT License.
@@ -1581,7 +1610,7 @@ const AzureCloudInstance = {
1581
1610
  AzureUsGovernment: "https://login.microsoftonline.us",
1582
1611
  };
1583
1612
 
1584
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1613
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1585
1614
  /*
1586
1615
  * Copyright (c) Microsoft Corporation. All rights reserved.
1587
1616
  * Licensed under the MIT License.
@@ -1591,7 +1620,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1591
1620
  response.hasOwnProperty("metadata"));
1592
1621
  }
1593
1622
 
1594
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1623
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1595
1624
  /*
1596
1625
  * Copyright (c) Microsoft Corporation. All rights reserved.
1597
1626
  * Licensed under the MIT License.
@@ -1601,7 +1630,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1601
1630
  response.hasOwnProperty("error_description"));
1602
1631
  }
1603
1632
 
1604
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1633
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1605
1634
  /*
1606
1635
  * Copyright (c) Microsoft Corporation. All rights reserved.
1607
1636
  * Licensed under the MIT License.
@@ -1663,7 +1692,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1663
1692
  */
1664
1693
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1665
1694
 
1666
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1695
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1667
1696
  /*
1668
1697
  * Copyright (c) Microsoft Corporation. All rights reserved.
1669
1698
  * Licensed under the MIT License.
@@ -1699,7 +1728,8 @@ const invoke = (callback, eventName, logger, telemetryClient, correlationId) =>
1699
1728
  catch (e) {
1700
1729
  logger.trace(`Error occurred in '${eventName}'`, correlationId);
1701
1730
  try {
1702
- logger.trace(JSON.stringify(e), correlationId);
1731
+ // Prevent numeric error details from being treated as minified log hashes.
1732
+ logger.tracePii(`Error details: '${JSON.stringify(e)}'`, correlationId);
1703
1733
  }
1704
1734
  catch (e) {
1705
1735
  logger.trace("Unable to print error message.", correlationId);
@@ -1743,7 +1773,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1743
1773
  .catch((e) => {
1744
1774
  logger.trace(`Error occurred in '${eventName}'`, correlationId);
1745
1775
  try {
1746
- logger.trace(JSON.stringify(e), correlationId);
1776
+ logger.tracePii(`Error details: '${JSON.stringify(e)}'`, correlationId);
1747
1777
  }
1748
1778
  catch (e) {
1749
1779
  logger.trace("Unable to print error message.", correlationId);
@@ -1756,12 +1786,26 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1756
1786
  };
1757
1787
  };
1758
1788
 
1759
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1789
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1760
1790
 
1761
1791
  /*
1762
1792
  * Copyright (c) Microsoft Corporation. All rights reserved.
1763
1793
  * Licensed under the MIT License.
1764
1794
  */
1795
+ // Starts with an ASCII letter; remaining characters are ASCII letters, digits, or hyphens.
1796
+ const REGION_NAME_PATTERN = /^[a-z][a-z0-9-]*$/i;
1797
+ // A region becomes a DNS label, limited to 63 octets by RFC 1035 section 2.3.4.
1798
+ const MAX_REGION_NAME_LENGTH = 63;
1799
+ /**
1800
+ * Whether a region can safely be used as a single DNS label.
1801
+ */
1802
+ function isValidRegion(region) {
1803
+ return (typeof region === "string" &&
1804
+ region.length <= MAX_REGION_NAME_LENGTH &&
1805
+ REGION_NAME_PATTERN.test(region) &&
1806
+ // Keep the trailing-hyphen rule explicit rather than complicating the pattern.
1807
+ !region.endsWith("-"));
1808
+ }
1765
1809
  class RegionDiscovery {
1766
1810
  constructor(networkInterface, logger, performanceClient, correlationId) {
1767
1811
  this.networkInterface = networkInterface;
@@ -1821,12 +1865,16 @@ class RegionDiscovery {
1821
1865
  regionDiscoveryMetadata.region_source =
1822
1866
  RegionDiscoverySources.ENVIRONMENT_VARIABLE;
1823
1867
  }
1824
- // If no region was auto detected from the environment or from the IMDS endpoint, mark the attempt as a FAILED_AUTO_DETECTION
1825
- if (!autodetectedRegionName) {
1868
+ // Untrusted discovery values must be a single DNS label before becoming a host prefix.
1869
+ if (!autodetectedRegionName || !isValidRegion(autodetectedRegionName)) {
1870
+ if (autodetectedRegionName) {
1871
+ this.logger.warning("Region discovery returned an invalid region. Using the global authority.", this.correlationId);
1872
+ }
1826
1873
  regionDiscoveryMetadata.region_source =
1827
1874
  RegionDiscoverySources.FAILED_AUTO_DETECTION;
1875
+ return null;
1828
1876
  }
1829
- return autodetectedRegionName || null;
1877
+ return autodetectedRegionName;
1830
1878
  }
1831
1879
  /**
1832
1880
  * Make the call to the IMDS endpoint
@@ -1867,7 +1915,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1867
1915
  },
1868
1916
  };
1869
1917
 
1870
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1918
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1871
1919
  /*
1872
1920
  * Copyright (c) Microsoft Corporation. All rights reserved.
1873
1921
  * Licensed under the MIT License.
@@ -1922,7 +1970,7 @@ function delay(t, value) {
1922
1970
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1923
1971
  }
1924
1972
 
1925
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1973
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
1926
1974
 
1927
1975
  /*
1928
1976
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2209,7 +2257,7 @@ function serializeAttributeTokens(attributeTokens) {
2209
2257
  return [...attributeTokens].sort().join(" ");
2210
2258
  }
2211
2259
 
2212
- /*! @azure/msal-common v16.16.0 2026-11-05 */
2260
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
2213
2261
 
2214
2262
  /*
2215
2263
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3062,6 +3110,9 @@ class Authority {
3062
3110
  * @param region string
3063
3111
  */
3064
3112
  static buildRegionalAuthorityString(host, region, correlationId, queryString) {
3113
+ if (!isValidRegion(region)) {
3114
+ throw createClientConfigurationError(urlParseError, correlationId);
3115
+ }
3065
3116
  // Create and validate a Url string object with the initial authority string
3066
3117
  const authorityUrlInstance = new UrlString(host, correlationId);
3067
3118
  authorityUrlInstance.validateAsUri();
@@ -3072,7 +3123,7 @@ class Authority {
3072
3123
  }
3073
3124
  // Include the query string portion of the url
3074
3125
  const url = UrlString.constructAuthorityUriFromObject({
3075
- ...authorityUrlInstance.getUrlComponents(),
3126
+ ...authorityUrlParts,
3076
3127
  HostNameAndPort: hostNameAndPort,
3077
3128
  }, correlationId).urlString;
3078
3129
  // Add the query string if a query string was provided
@@ -3177,7 +3228,7 @@ function buildStaticAuthorityOptions(authOptions) {
3177
3228
  };
3178
3229
  }
3179
3230
 
3180
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3231
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
3181
3232
 
3182
3233
  /*
3183
3234
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3211,7 +3262,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3211
3262
  }
3212
3263
  }
3213
3264
 
3214
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3265
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
3215
3266
 
3216
3267
  /*
3217
3268
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3407,7 +3458,7 @@ class ScopeSet {
3407
3458
  }
3408
3459
  }
3409
3460
 
3410
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3461
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
3411
3462
 
3412
3463
  /*
3413
3464
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3925,7 +3976,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3925
3976
  }
3926
3977
  }
3927
3978
 
3928
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3979
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
3929
3980
 
3930
3981
  /*
3931
3982
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3992,7 +4043,7 @@ function mapToQueryString(parameters) {
3992
4043
  return queryParameterArray.join("&");
3993
4044
  }
3994
4045
 
3995
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4046
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
3996
4047
 
3997
4048
  /*
3998
4049
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4040,7 +4091,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
4040
4091
  },
4041
4092
  };
4042
4093
 
4043
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4094
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
4044
4095
 
4045
4096
  /*
4046
4097
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4063,7 +4114,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
4063
4114
  },
4064
4115
  };
4065
4116
 
4066
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4117
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
4067
4118
  /*
4068
4119
  * Copyright (c) Microsoft Corporation. All rights reserved.
4069
4120
  * Licensed under the MIT License.
@@ -4338,12 +4389,12 @@ class Logger {
4338
4389
  }
4339
4390
  }
4340
4391
 
4341
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4392
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
4342
4393
  /* eslint-disable header/header */
4343
4394
  const name$1 = "@azure/msal-common";
4344
- const version$1 = "16.16.0";
4395
+ const version$1 = "16.16.2";
4345
4396
 
4346
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4397
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
4347
4398
  /*
4348
4399
  * Copyright (c) Microsoft Corporation. All rights reserved.
4349
4400
  * Licensed under the MIT License.
@@ -4351,7 +4402,7 @@ const version$1 = "16.16.0";
4351
4402
  const cacheQuotaExceeded = "cache_quota_exceeded";
4352
4403
  const cacheErrorUnknown = "cache_error_unknown";
4353
4404
 
4354
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4405
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
4355
4406
 
4356
4407
  /*
4357
4408
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4389,7 +4440,7 @@ function createCacheError(e) {
4389
4440
  }
4390
4441
  }
4391
4442
 
4392
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4443
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
4393
4444
 
4394
4445
  /*
4395
4446
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4853,19 +4904,25 @@ class CacheManager {
4853
4904
  * @param account
4854
4905
  */
4855
4906
  removeAccount(account, correlationId) {
4856
- this.removeAccountContext(account, correlationId);
4857
4907
  const accountKeys = this.getAccountKeys();
4858
4908
  const keyFilter = (key) => {
4859
4909
  return (key.includes(account.homeAccountId) &&
4860
4910
  key.includes(account.environment));
4861
4911
  };
4912
+ this.getTokenKeys()
4913
+ .idToken.filter(keyFilter)
4914
+ .forEach((key) => {
4915
+ this.removeIdToken(key, correlationId);
4916
+ });
4917
+ this.removeAccountContext(account, correlationId);
4862
4918
  accountKeys.filter(keyFilter).forEach((key) => {
4863
4919
  this.removeItem(key, correlationId);
4864
4920
  this.performanceClient.incrementFields({ accountsRemoved: 1 }, correlationId);
4865
4921
  });
4866
4922
  }
4867
4923
  /**
4868
- * Removes credentials associated with the provided account
4924
+ * Removes access and refresh tokens associated with the provided account,
4925
+ * preserving the account and its ID tokens.
4869
4926
  * @param account
4870
4927
  */
4871
4928
  removeAccountContext(account, correlationId) {
@@ -4874,9 +4931,6 @@ class CacheManager {
4874
4931
  return (key.includes(account.homeAccountId) &&
4875
4932
  key.includes(account.environment));
4876
4933
  };
4877
- allTokenKeys.idToken.filter(keyFilter).forEach((key) => {
4878
- this.removeIdToken(key, correlationId);
4879
- });
4880
4934
  allTokenKeys.accessToken.filter(keyFilter).forEach((key) => {
4881
4935
  this.removeAccessToken(key, correlationId);
4882
4936
  });
@@ -5613,7 +5667,7 @@ class DefaultStorageClass extends CacheManager {
5613
5667
  }
5614
5668
  }
5615
5669
 
5616
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5670
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5617
5671
  /*
5618
5672
  * Copyright (c) Microsoft Corporation. All rights reserved.
5619
5673
  * Licensed under the MIT License.
@@ -5627,7 +5681,7 @@ class DefaultStorageClass extends CacheManager {
5627
5681
  const PerformanceEventStatus = {
5628
5682
  InProgress: 1};
5629
5683
 
5630
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5684
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5631
5685
 
5632
5686
  /*
5633
5687
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5685,7 +5739,7 @@ class StubPerformanceClient {
5685
5739
  }
5686
5740
  }
5687
5741
 
5688
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5742
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5689
5743
 
5690
5744
  /*
5691
5745
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5783,7 +5837,7 @@ function isOidcProtocolMode(config) {
5783
5837
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5784
5838
  }
5785
5839
 
5786
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5840
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5787
5841
  /*
5788
5842
  * Copyright (c) Microsoft Corporation. All rights reserved.
5789
5843
  * Licensed under the MIT License.
@@ -5810,7 +5864,7 @@ function isOidcProtocolMode(config) {
5810
5864
  }
5811
5865
  }
5812
5866
 
5813
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5867
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5814
5868
 
5815
5869
  /*
5816
5870
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5831,7 +5885,7 @@ function createJoseHeaderError(code, correlationId) {
5831
5885
  return new JoseHeaderError(code, correlationId);
5832
5886
  }
5833
5887
 
5834
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5888
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5835
5889
  /*
5836
5890
  * Copyright (c) Microsoft Corporation. All rights reserved.
5837
5891
  * Licensed under the MIT License.
@@ -5856,7 +5910,7 @@ function isPlainObject(value) {
5856
5910
  return Object.getPrototypeOf(value) === proto;
5857
5911
  }
5858
5912
 
5859
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5913
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5860
5914
  /*
5861
5915
  * Copyright (c) Microsoft Corporation. All rights reserved.
5862
5916
  * Licensed under the MIT License.
@@ -5866,7 +5920,7 @@ const missingAlgError = "missing_alg_error";
5866
5920
  const missingJwkError = "missing_jwk_error";
5867
5921
  const invalidJwkError = "invalid_jwk_error";
5868
5922
 
5869
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5923
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5870
5924
 
5871
5925
  /*
5872
5926
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5932,7 +5986,7 @@ class JoseHeader {
5932
5986
  }
5933
5987
  }
5934
5988
 
5935
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5989
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
5936
5990
 
5937
5991
  /*
5938
5992
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6033,7 +6087,7 @@ class PopTokenGenerator {
6033
6087
  }
6034
6088
  }
6035
6089
 
6036
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6090
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6037
6091
 
6038
6092
  /*
6039
6093
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6188,7 +6242,7 @@ class DpopProofGenerator {
6188
6242
  }
6189
6243
  }
6190
6244
 
6191
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6245
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6192
6246
  /*
6193
6247
  * Copyright (c) Microsoft Corporation. All rights reserved.
6194
6248
  * Licensed under the MIT License.
@@ -6252,7 +6306,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6252
6306
  uiNotAllowed: uiNotAllowed
6253
6307
  });
6254
6308
 
6255
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6309
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6256
6310
 
6257
6311
  /*
6258
6312
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6319,7 +6373,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
6319
6373
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6320
6374
  }
6321
6375
 
6322
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6376
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6323
6377
 
6324
6378
  /*
6325
6379
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6338,7 +6392,7 @@ class ServerError extends AuthError {
6338
6392
  }
6339
6393
  }
6340
6394
 
6341
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6395
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6342
6396
 
6343
6397
  /*
6344
6398
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6406,7 +6460,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6406
6460
  }
6407
6461
  }
6408
6462
 
6409
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6463
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6410
6464
 
6411
6465
  /*
6412
6466
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6834,7 +6888,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6834
6888
  return baseAccount;
6835
6889
  }
6836
6890
 
6837
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6891
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6838
6892
  /*
6839
6893
  * Copyright (c) Microsoft Corporation. All rights reserved.
6840
6894
  * Licensed under the MIT License.
@@ -6844,7 +6898,7 @@ const CcsCredentialType = {
6844
6898
  UPN: "UPN",
6845
6899
  };
6846
6900
 
6847
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6901
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6848
6902
  /*
6849
6903
  * Copyright (c) Microsoft Corporation. All rights reserved.
6850
6904
  * Licensed under the MIT License.
@@ -6863,7 +6917,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6863
6917
  }
6864
6918
  }
6865
6919
 
6866
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6920
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6867
6921
 
6868
6922
  /*
6869
6923
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6887,7 +6941,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6887
6941
  };
6888
6942
  }
6889
6943
 
6890
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6944
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6891
6945
 
6892
6946
  /*
6893
6947
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6977,7 +7031,7 @@ function getRetryAfterHeader(response) {
6977
7031
  return undefined;
6978
7032
  }
6979
7033
 
6980
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7034
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
6981
7035
 
6982
7036
  /*
6983
7037
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7008,7 +7062,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
7008
7062
  return new NetworkError(error, httpStatus, responseHeaders);
7009
7063
  }
7010
7064
 
7011
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7065
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
7012
7066
 
7013
7067
  /*
7014
7068
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7142,7 +7196,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
7142
7196
  return response;
7143
7197
  }
7144
7198
 
7145
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7199
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
7146
7200
 
7147
7201
  /*
7148
7202
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7185,7 +7239,8 @@ class AuthorizationCodeClient {
7185
7239
  throw createClientAuthError(requestCannotBeMade, request.correlationId);
7186
7240
  }
7187
7241
  // Check for new cloud instance
7188
- if (authCodePayload && authCodePayload.cloud_instance_host_name) {
7242
+ if (this.config.authOptions.instanceAware === true &&
7243
+ authCodePayload?.cloud_instance_host_name) {
7189
7244
  await invokeAsync(this.updateTokenEndpointAuthority.bind(this), UpdateTokenEndpointAuthority, this.logger, this.performanceClient, request.correlationId)(authCodePayload.cloud_instance_host_name, request.correlationId);
7190
7245
  }
7191
7246
  const reqTimestamp = nowSeconds();
@@ -7409,7 +7464,7 @@ class AuthorizationCodeClient {
7409
7464
  }
7410
7465
  }
7411
7466
 
7412
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7467
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
7413
7468
 
7414
7469
  /*
7415
7470
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7563,7 +7618,7 @@ function extractLoginHint(account) {
7563
7618
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7564
7619
  }
7565
7620
 
7566
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7621
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
7567
7622
 
7568
7623
  /*
7569
7624
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7798,7 +7853,7 @@ class RefreshTokenClient {
7798
7853
  }
7799
7854
  }
7800
7855
 
7801
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7856
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
7802
7857
 
7803
7858
  /*
7804
7859
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8064,7 +8119,7 @@ class ServerTelemetryManager {
8064
8119
  }
8065
8120
  }
8066
8121
 
8067
- /*! @azure/msal-common v16.16.0 2026-11-05 */
8122
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
8068
8123
 
8069
8124
  /*
8070
8125
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8191,7 +8246,7 @@ class SilentFlowClient {
8191
8246
  }
8192
8247
  }
8193
8248
 
8194
- /*! @azure/msal-common v16.16.0 2026-11-05 */
8249
+ /*! @azure/msal-common v16.16.2 2026-11-12 */
8195
8250
 
8196
8251
  /*
8197
8252
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10241,7 +10296,7 @@ class ClientAssertion {
10241
10296
 
10242
10297
  /* eslint-disable header/header */
10243
10298
  const name = "@azure/msal-node";
10244
- const version = "7.2.0";
10299
+ const version = "7.2.2";
10245
10300
 
10246
10301
  /*
10247
10302
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10607,23 +10662,19 @@ class ClientApplication {
10607
10662
  */
10608
10663
  async acquireTokenByCode(request, authCodePayLoad) {
10609
10664
  this.logger.info("acquireTokenByCode called", request.correlationId || "");
10610
- let validatedAuthCodePayload = authCodePayLoad;
10611
- if (request.state && validatedAuthCodePayload) {
10665
+ // Only returned state is trusted for comparison; request values own code and nonce.
10666
+ const validatedAuthCodePayload = {
10667
+ code: request.code,
10668
+ nonce: request.nonce,
10669
+ };
10670
+ if (authCodePayLoad) {
10671
+ validatedAuthCodePayload.state = authCodePayLoad.state;
10672
+ }
10673
+ if (request.state && authCodePayLoad) {
10612
10674
  this.logger.info("acquireTokenByCode - validating state", request.correlationId || "");
10613
10675
  this.validateState(request.state, validatedAuthCodePayload.state || "", request.correlationId || "");
10614
- validatedAuthCodePayload = {
10615
- ...validatedAuthCodePayload,
10616
- state: "",
10617
- };
10676
+ validatedAuthCodePayload.state = "";
10618
10677
  }
10619
- const expectedNonce = request.nonce !== undefined
10620
- ? request.nonce
10621
- : validatedAuthCodePayload?.nonce;
10622
- validatedAuthCodePayload = {
10623
- ...validatedAuthCodePayload,
10624
- code: request.code,
10625
- nonce: expectedNonce,
10626
- };
10627
10678
  const validRequest = {
10628
10679
  ...request,
10629
10680
  ...(await this.initializeBaseRequest(request)),