@revenexx/integrations-node-sdk 1.7.0 → 1.8.0

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.cjs CHANGED
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  extractCredentialManifests: () => extractCredentialManifests,
62
62
  extractManifest: () => extractManifest,
63
63
  extractManifests: () => extractManifests,
64
+ headerCrossesOrigin: () => headerCrossesOrigin,
64
65
  httpErrorResult: () => httpErrorResult,
65
66
  isBlockedAddress: () => isBlockedAddress,
66
67
  isNodeWithIteration: () => isNodeWithIteration,
@@ -475,6 +476,26 @@ var DEFAULT_TIMEOUT_MS = 3e4;
475
476
  var MAX_TIMEOUT_MS = 12e4;
476
477
  var MAX_REDIRECTS = 5;
477
478
  var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
479
+ var CROSS_ORIGIN_SAFE_HEADERS = /* @__PURE__ */ new Set([
480
+ "accept",
481
+ "accept-encoding",
482
+ "accept-language",
483
+ "content-encoding",
484
+ "content-language",
485
+ "content-type",
486
+ "idempotency-key",
487
+ "if-match",
488
+ "if-modified-since",
489
+ "if-none-match",
490
+ "if-range",
491
+ "if-unmodified-since",
492
+ "range",
493
+ "soapaction",
494
+ "user-agent"
495
+ ]);
496
+ function headerCrossesOrigin(name) {
497
+ return CROSS_ORIGIN_SAFE_HEADERS.has(name.trim().toLowerCase());
498
+ }
478
499
  var DEFAULT_RETRY_ATTEMPTS = 0;
479
500
  var MAX_RETRY_ATTEMPTS = 5;
480
501
  var DEFAULT_RETRY_DELAY_MS = 1e3;
@@ -557,9 +578,9 @@ async function guardedFetch(url, fetchOptions, ctxSignal, effectiveMs) {
557
578
  headers.delete("content-length");
558
579
  }
559
580
  if (nextUrl.origin !== base.origin) {
560
- headers.delete("authorization");
561
- headers.delete("cookie");
562
- headers.delete("proxy-authorization");
581
+ for (const name of [...headers.keys()]) {
582
+ if (!headerCrossesOrigin(name)) headers.delete(name);
583
+ }
563
584
  }
564
585
  currentUrl = nextUrl;
565
586
  currentInit = { ...currentInit, method, body, headers, redirect: "manual" };
@@ -1115,6 +1136,7 @@ function base64Url(buf) {
1115
1136
  extractCredentialManifests,
1116
1137
  extractManifest,
1117
1138
  extractManifests,
1139
+ headerCrossesOrigin,
1118
1140
  httpErrorResult,
1119
1141
  isBlockedAddress,
1120
1142
  isNodeWithIteration,
package/dist/index.d.cts CHANGED
@@ -771,6 +771,18 @@ declare const DEFAULT_TIMEOUT_MS = 30000;
771
771
  declare const MAX_TIMEOUT_MS = 120000;
772
772
  /** Maximum number of redirect hops `safeFetch` follows before giving up. */
773
773
  declare const MAX_REDIRECTS = 5;
774
+ /**
775
+ * Whether a request header with this name goes on to the next hop when
776
+ * {@link safeFetch} follows a redirect to another origin — `true` for `Accept`,
777
+ * `Accept-Encoding`, `Accept-Language`, `Content-Encoding`, `Content-Language`,
778
+ * `Content-Type`, `Idempotency-Key`, `If-Match`, `If-Modified-Since`,
779
+ * `If-None-Match`, `If-Range`, `If-Unmodified-Since`, `Range`, `SOAPAction` and
780
+ * `User-Agent`, in any case, and `false` for every other name. The keep-list is by
781
+ * name, so it can only keep a secret out of the headers it drops: a credential
782
+ * whose header name the author chooses must refuse a name this answers `true`
783
+ * for, or its key would cross with the harmless headers.
784
+ */
785
+ declare function headerCrossesOrigin(name: string): boolean;
774
786
  declare const DEFAULT_RETRY_ATTEMPTS = 0;
775
787
  declare const MAX_RETRY_ATTEMPTS = 5;
776
788
  declare const DEFAULT_RETRY_DELAY_MS = 1000;
@@ -1239,4 +1251,4 @@ declare abstract class OAuth2AuthCodeCredential extends BaseCredential implement
1239
1251
  test(_ctx: ICredentialContext, config: Config): Promise<ICredentialTestResult>;
1240
1252
  }
1241
1253
 
1242
- export { ApiKeyCredential, BaseCredential, BasicAuthCredential, type ConfigType, type CredentialAuthKind, type CredentialFieldType, DEFAULT_MAX_RESPONSE_BYTES, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY_MS, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, type DataType, type IConfigField, type IConfigFieldBase, type IConfigOption, type IConfigValidation, type ICredential, type ICredentialContext, type ICredentialDescription, type ICredentialField, type ICredentialOAuthAuthorize, type ICredentialResolveResult, type ICredentialTestResult, type IImage, type IInputPort, type INode, type INodeAuthorContext, type INodeContext, type INodeDescription, type INodeResult, type INodeState, type INodeWithIteration, type IOutputField, type IOutputPort, type IShowIfCondition, type ITemplateDescription, type ITemplateTrigger, type ImageCategory, type LocalizedString, type LookupAddress, type LookupFn, MANIFEST_VERSION, MAX_REDIRECTS, MAX_RESPONSE_BYTES, MAX_RETRY_ATTEMPTS, MAX_TIMEOUT_MS, type NodeCategory, NodeError, type NodeErrorOutput, type NodeManifest, type NodePackageMeta, OAuth2AuthCodeCredential, OAuth2ClientCredentialsCredential, type OAuthTokenResponse, OPERATORS, type Operator, type OutputKind, type RetryHooks, type RetryPolicy, RetryableError, type SafeFetchOptions, type SafeFetchRetry, SimpleValueCredential, type TemplateLevel, type TemplateTriggerType, VALUELESS_OPERATORS, assertPublicUrl, backoffDelay, buildManifest, clampResponseBytes, errorPort, errorResult, evaluate, extractCredentialManifest, extractCredentialManifests, extractManifest, extractManifests, httpErrorResult, isBlockedAddress, isNodeWithIteration, isOAuthAuthorizeCredential, isOperator, maxBytesConfigField, normalizeCredentialType, normalizeLocalized, packageIconProblem, parsePackageMeta, readArrayBuffer, readJsonOrText, readText, retryConfigFields, safeFetch, settingApplies, sleepWithSignal, takesValue, timeoutConfigField, toErrorOutput, toErrorResult, withRetry };
1254
+ export { ApiKeyCredential, BaseCredential, BasicAuthCredential, type ConfigType, type CredentialAuthKind, type CredentialFieldType, DEFAULT_MAX_RESPONSE_BYTES, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY_MS, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, type DataType, type IConfigField, type IConfigFieldBase, type IConfigOption, type IConfigValidation, type ICredential, type ICredentialContext, type ICredentialDescription, type ICredentialField, type ICredentialOAuthAuthorize, type ICredentialResolveResult, type ICredentialTestResult, type IImage, type IInputPort, type INode, type INodeAuthorContext, type INodeContext, type INodeDescription, type INodeResult, type INodeState, type INodeWithIteration, type IOutputField, type IOutputPort, type IShowIfCondition, type ITemplateDescription, type ITemplateTrigger, type ImageCategory, type LocalizedString, type LookupAddress, type LookupFn, MANIFEST_VERSION, MAX_REDIRECTS, MAX_RESPONSE_BYTES, MAX_RETRY_ATTEMPTS, MAX_TIMEOUT_MS, type NodeCategory, NodeError, type NodeErrorOutput, type NodeManifest, type NodePackageMeta, OAuth2AuthCodeCredential, OAuth2ClientCredentialsCredential, type OAuthTokenResponse, OPERATORS, type Operator, type OutputKind, type RetryHooks, type RetryPolicy, RetryableError, type SafeFetchOptions, type SafeFetchRetry, SimpleValueCredential, type TemplateLevel, type TemplateTriggerType, VALUELESS_OPERATORS, assertPublicUrl, backoffDelay, buildManifest, clampResponseBytes, errorPort, errorResult, evaluate, extractCredentialManifest, extractCredentialManifests, extractManifest, extractManifests, headerCrossesOrigin, httpErrorResult, isBlockedAddress, isNodeWithIteration, isOAuthAuthorizeCredential, isOperator, maxBytesConfigField, normalizeCredentialType, normalizeLocalized, packageIconProblem, parsePackageMeta, readArrayBuffer, readJsonOrText, readText, retryConfigFields, safeFetch, settingApplies, sleepWithSignal, takesValue, timeoutConfigField, toErrorOutput, toErrorResult, withRetry };
package/dist/index.d.ts CHANGED
@@ -771,6 +771,18 @@ declare const DEFAULT_TIMEOUT_MS = 30000;
771
771
  declare const MAX_TIMEOUT_MS = 120000;
772
772
  /** Maximum number of redirect hops `safeFetch` follows before giving up. */
773
773
  declare const MAX_REDIRECTS = 5;
774
+ /**
775
+ * Whether a request header with this name goes on to the next hop when
776
+ * {@link safeFetch} follows a redirect to another origin — `true` for `Accept`,
777
+ * `Accept-Encoding`, `Accept-Language`, `Content-Encoding`, `Content-Language`,
778
+ * `Content-Type`, `Idempotency-Key`, `If-Match`, `If-Modified-Since`,
779
+ * `If-None-Match`, `If-Range`, `If-Unmodified-Since`, `Range`, `SOAPAction` and
780
+ * `User-Agent`, in any case, and `false` for every other name. The keep-list is by
781
+ * name, so it can only keep a secret out of the headers it drops: a credential
782
+ * whose header name the author chooses must refuse a name this answers `true`
783
+ * for, or its key would cross with the harmless headers.
784
+ */
785
+ declare function headerCrossesOrigin(name: string): boolean;
774
786
  declare const DEFAULT_RETRY_ATTEMPTS = 0;
775
787
  declare const MAX_RETRY_ATTEMPTS = 5;
776
788
  declare const DEFAULT_RETRY_DELAY_MS = 1000;
@@ -1239,4 +1251,4 @@ declare abstract class OAuth2AuthCodeCredential extends BaseCredential implement
1239
1251
  test(_ctx: ICredentialContext, config: Config): Promise<ICredentialTestResult>;
1240
1252
  }
1241
1253
 
1242
- export { ApiKeyCredential, BaseCredential, BasicAuthCredential, type ConfigType, type CredentialAuthKind, type CredentialFieldType, DEFAULT_MAX_RESPONSE_BYTES, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY_MS, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, type DataType, type IConfigField, type IConfigFieldBase, type IConfigOption, type IConfigValidation, type ICredential, type ICredentialContext, type ICredentialDescription, type ICredentialField, type ICredentialOAuthAuthorize, type ICredentialResolveResult, type ICredentialTestResult, type IImage, type IInputPort, type INode, type INodeAuthorContext, type INodeContext, type INodeDescription, type INodeResult, type INodeState, type INodeWithIteration, type IOutputField, type IOutputPort, type IShowIfCondition, type ITemplateDescription, type ITemplateTrigger, type ImageCategory, type LocalizedString, type LookupAddress, type LookupFn, MANIFEST_VERSION, MAX_REDIRECTS, MAX_RESPONSE_BYTES, MAX_RETRY_ATTEMPTS, MAX_TIMEOUT_MS, type NodeCategory, NodeError, type NodeErrorOutput, type NodeManifest, type NodePackageMeta, OAuth2AuthCodeCredential, OAuth2ClientCredentialsCredential, type OAuthTokenResponse, OPERATORS, type Operator, type OutputKind, type RetryHooks, type RetryPolicy, RetryableError, type SafeFetchOptions, type SafeFetchRetry, SimpleValueCredential, type TemplateLevel, type TemplateTriggerType, VALUELESS_OPERATORS, assertPublicUrl, backoffDelay, buildManifest, clampResponseBytes, errorPort, errorResult, evaluate, extractCredentialManifest, extractCredentialManifests, extractManifest, extractManifests, httpErrorResult, isBlockedAddress, isNodeWithIteration, isOAuthAuthorizeCredential, isOperator, maxBytesConfigField, normalizeCredentialType, normalizeLocalized, packageIconProblem, parsePackageMeta, readArrayBuffer, readJsonOrText, readText, retryConfigFields, safeFetch, settingApplies, sleepWithSignal, takesValue, timeoutConfigField, toErrorOutput, toErrorResult, withRetry };
1254
+ export { ApiKeyCredential, BaseCredential, BasicAuthCredential, type ConfigType, type CredentialAuthKind, type CredentialFieldType, DEFAULT_MAX_RESPONSE_BYTES, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY_MS, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, type DataType, type IConfigField, type IConfigFieldBase, type IConfigOption, type IConfigValidation, type ICredential, type ICredentialContext, type ICredentialDescription, type ICredentialField, type ICredentialOAuthAuthorize, type ICredentialResolveResult, type ICredentialTestResult, type IImage, type IInputPort, type INode, type INodeAuthorContext, type INodeContext, type INodeDescription, type INodeResult, type INodeState, type INodeWithIteration, type IOutputField, type IOutputPort, type IShowIfCondition, type ITemplateDescription, type ITemplateTrigger, type ImageCategory, type LocalizedString, type LookupAddress, type LookupFn, MANIFEST_VERSION, MAX_REDIRECTS, MAX_RESPONSE_BYTES, MAX_RETRY_ATTEMPTS, MAX_TIMEOUT_MS, type NodeCategory, NodeError, type NodeErrorOutput, type NodeManifest, type NodePackageMeta, OAuth2AuthCodeCredential, OAuth2ClientCredentialsCredential, type OAuthTokenResponse, OPERATORS, type Operator, type OutputKind, type RetryHooks, type RetryPolicy, RetryableError, type SafeFetchOptions, type SafeFetchRetry, SimpleValueCredential, type TemplateLevel, type TemplateTriggerType, VALUELESS_OPERATORS, assertPublicUrl, backoffDelay, buildManifest, clampResponseBytes, errorPort, errorResult, evaluate, extractCredentialManifest, extractCredentialManifests, extractManifest, extractManifests, headerCrossesOrigin, httpErrorResult, isBlockedAddress, isNodeWithIteration, isOAuthAuthorizeCredential, isOperator, maxBytesConfigField, normalizeCredentialType, normalizeLocalized, packageIconProblem, parsePackageMeta, readArrayBuffer, readJsonOrText, readText, retryConfigFields, safeFetch, settingApplies, sleepWithSignal, takesValue, timeoutConfigField, toErrorOutput, toErrorResult, withRetry };
package/dist/index.js CHANGED
@@ -384,6 +384,26 @@ var DEFAULT_TIMEOUT_MS = 3e4;
384
384
  var MAX_TIMEOUT_MS = 12e4;
385
385
  var MAX_REDIRECTS = 5;
386
386
  var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
387
+ var CROSS_ORIGIN_SAFE_HEADERS = /* @__PURE__ */ new Set([
388
+ "accept",
389
+ "accept-encoding",
390
+ "accept-language",
391
+ "content-encoding",
392
+ "content-language",
393
+ "content-type",
394
+ "idempotency-key",
395
+ "if-match",
396
+ "if-modified-since",
397
+ "if-none-match",
398
+ "if-range",
399
+ "if-unmodified-since",
400
+ "range",
401
+ "soapaction",
402
+ "user-agent"
403
+ ]);
404
+ function headerCrossesOrigin(name) {
405
+ return CROSS_ORIGIN_SAFE_HEADERS.has(name.trim().toLowerCase());
406
+ }
387
407
  var DEFAULT_RETRY_ATTEMPTS = 0;
388
408
  var MAX_RETRY_ATTEMPTS = 5;
389
409
  var DEFAULT_RETRY_DELAY_MS = 1e3;
@@ -466,9 +486,9 @@ async function guardedFetch(url, fetchOptions, ctxSignal, effectiveMs) {
466
486
  headers.delete("content-length");
467
487
  }
468
488
  if (nextUrl.origin !== base.origin) {
469
- headers.delete("authorization");
470
- headers.delete("cookie");
471
- headers.delete("proxy-authorization");
489
+ for (const name of [...headers.keys()]) {
490
+ if (!headerCrossesOrigin(name)) headers.delete(name);
491
+ }
472
492
  }
473
493
  currentUrl = nextUrl;
474
494
  currentInit = { ...currentInit, method, body, headers, redirect: "manual" };
@@ -988,6 +1008,7 @@ export {
988
1008
  extractCredentialManifests,
989
1009
  extractManifest,
990
1010
  extractManifests,
1011
+ headerCrossesOrigin,
991
1012
  httpErrorResult,
992
1013
  isBlockedAddress,
993
1014
  isNodeWithIteration,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/integrations-node-sdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "TypeScript interfaces and utilities for Revenexx integration nodes",
5
5
  "license": "MIT",
6
6
  "author": "revenexx GmbH",