@digipair/skill-oauth2 0.136.1 → 0.136.3

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/dist/index.esm.js CHANGED
@@ -22329,7 +22329,12 @@ var internals = {
22329
22329
  'lookup',
22330
22330
  'family',
22331
22331
  'hints'
22332
- ]
22332
+ ],
22333
+ sensitiveCrossHostHeaders: new Set([
22334
+ 'authorization',
22335
+ 'cookie',
22336
+ 'proxy-authorization'
22337
+ ])
22333
22338
  };
22334
22339
  // New instance is exported as module.exports
22335
22340
  internals.Client = /*#__PURE__*/ function() {
@@ -22541,7 +22546,7 @@ internals.Client = /*#__PURE__*/ function() {
22541
22546
  return finishOnce(Boom.badGateway('Received redirection without location', _trace));
22542
22547
  }
22543
22548
  if (!/^https?:/i.test(location)) {
22544
- location = Url.resolve(uri.href, location);
22549
+ location = new Url.URL(location, uri.href).href;
22545
22550
  }
22546
22551
  var redirectOptions = Hoek$3.clone(options, {
22547
22552
  shallow: internals.shallowOptions
@@ -22553,16 +22558,15 @@ internals.Client = /*#__PURE__*/ function() {
22553
22558
  var elapsed = Date.now() - start;
22554
22559
  redirectOptions.timeout = (redirectOptions.timeout - elapsed).toString(); // stringify to not drop timeout when === 0
22555
22560
  }
22556
- // When redirecting to a new hostname, remove the authorization and cookie headers
22561
+ // When redirecting cross-origin (scheme, host, or port differs), remove sensitive credential headers
22557
22562
  if (redirectOptions.headers) {
22558
22563
  var parsedLocation = new URL(location);
22559
- if (uri.hostname !== parsedLocation.hostname) {
22564
+ if (uri.origin !== parsedLocation.origin) {
22560
22565
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
22561
22566
  try {
22562
22567
  for(var _iterator = Object.keys(redirectOptions.headers)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
22563
22568
  var header = _step.value;
22564
- var lowerHeader = header.toLowerCase();
22565
- if (lowerHeader === 'authorization' || lowerHeader === 'cookie') {
22569
+ if (internals.sensitiveCrossHostHeaders.has(header.toLowerCase())) {
22566
22570
  delete redirectOptions.headers[header];
22567
22571
  }
22568
22572
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-oauth2",
3
- "version": "0.136.1",
3
+ "version": "0.136.3",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,2 +0,0 @@
1
- export * from './lib/skill-oauth2';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -1,13 +0,0 @@
1
- import { PinsSettings } from '@digipair/engine';
2
- export declare const authorizationCodeUrl: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
- export declare const authorizationCodeAccessToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
- export declare const authorizationCodeCreateToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
- export declare const resourceOwnerPasswordAccessToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
6
- export declare const resourceOwnerPasswordCreateToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
7
- export declare const clientCredentialsAccessToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
8
- export declare const clientCredentialsCreateToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
9
- export declare const tokenExpired: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
10
- export declare const tokenRefresh: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
11
- export declare const tokenRevoke: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
12
- export declare const tokenRevokeAll: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;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