renovate 43.35.1 → 43.36.1

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.
@@ -0,0 +1,34 @@
1
+ import { envDetector } from "@opentelemetry/resources";
2
+ import { awsBeanstalkDetector, awsEc2Detector, awsEcsDetector, awsEksDetector, awsLambdaDetector } from "@opentelemetry/resource-detector-aws";
3
+ import { azureAppServiceDetector, azureFunctionsDetector, azureVmDetector } from "@opentelemetry/resource-detector-azure";
4
+ import { gcpDetector } from "@opentelemetry/resource-detector-gcp";
5
+ import { gitHubDetector } from "@opentelemetry/resource-detector-github";
6
+
7
+ //#region lib/instrumentation/detectors.ts
8
+ function getResourceDetectors(env) {
9
+ const detectors = {
10
+ aws: [
11
+ awsBeanstalkDetector,
12
+ awsEc2Detector,
13
+ awsEcsDetector,
14
+ awsEksDetector,
15
+ awsLambdaDetector
16
+ ],
17
+ azure: [
18
+ azureAppServiceDetector,
19
+ azureFunctionsDetector,
20
+ azureVmDetector
21
+ ],
22
+ gcp: gcpDetector,
23
+ github: gitHubDetector,
24
+ env: envDetector
25
+ };
26
+ const resourceDetectorsFromEnv = new Set(env.OTEL_NODE_RESOURCE_DETECTORS?.split(",") ?? [env.RENOVATE_USE_CLOUD_METADATA_SERVICES?.toLocaleLowerCase() === "false" ? "env" : "all"]);
27
+ if (resourceDetectorsFromEnv.has("none")) return [];
28
+ if (resourceDetectorsFromEnv.has("all")) return Object.values(detectors).flat();
29
+ return Object.entries(detectors).filter(([name]) => resourceDetectorsFromEnv.has(name)).map(([_, value]) => value).flat();
30
+ }
31
+
32
+ //#endregion
33
+ export { getResourceDetectors };
34
+ //# sourceMappingURL=detectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectors.js","names":[],"sources":["../../lib/instrumentation/detectors.ts"],"sourcesContent":["import {\n awsBeanstalkDetector,\n awsEc2Detector,\n awsEcsDetector,\n awsEksDetector,\n awsLambdaDetector,\n} from '@opentelemetry/resource-detector-aws';\nimport {\n azureAppServiceDetector,\n azureFunctionsDetector,\n azureVmDetector,\n} from '@opentelemetry/resource-detector-azure';\nimport { gcpDetector } from '@opentelemetry/resource-detector-gcp';\nimport { gitHubDetector } from '@opentelemetry/resource-detector-github';\nimport type { ResourceDetector } from '@opentelemetry/resources';\nimport { envDetector } from '@opentelemetry/resources';\n\nexport function getResourceDetectors(\n env: NodeJS.ProcessEnv,\n): ResourceDetector[] {\n const detectors: Record<string, ResourceDetector | ResourceDetector[]> = {\n aws: [\n awsBeanstalkDetector,\n awsEc2Detector,\n awsEcsDetector,\n awsEksDetector,\n awsLambdaDetector,\n ],\n azure: [azureAppServiceDetector, azureFunctionsDetector, azureVmDetector],\n gcp: gcpDetector,\n github: gitHubDetector,\n env: envDetector,\n };\n\n const resourceDetectorsFromEnv = new Set(\n env.OTEL_NODE_RESOURCE_DETECTORS?.split(',') ?? [\n env.RENOVATE_USE_CLOUD_METADATA_SERVICES?.toLocaleLowerCase() === 'false'\n ? 'env'\n : 'all',\n ],\n );\n\n if (resourceDetectorsFromEnv.has('none')) {\n return [];\n }\n\n if (resourceDetectorsFromEnv.has('all')) {\n return Object.values(detectors).flat();\n }\n\n return Object.entries(detectors)\n .filter(([name]) => resourceDetectorsFromEnv.has(name))\n .map(([_, value]) => value)\n .flat();\n}\n"],"mappings":";;;;;;;AAiBA,SAAgB,qBACd,KACoB;CACpB,MAAM,YAAmE;EACvE,KAAK;GACH;GACA;GACA;GACA;GACA;GACD;EACD,OAAO;GAAC;GAAyB;GAAwB;GAAgB;EACzE,KAAK;EACL,QAAQ;EACR,KAAK;EACN;CAED,MAAM,2BAA2B,IAAI,IACnC,IAAI,8BAA8B,MAAM,IAAI,IAAI,CAC9C,IAAI,sCAAsC,mBAAmB,KAAK,UAC9D,QACA,MACL,CACF;AAED,KAAI,yBAAyB,IAAI,OAAO,CACtC,QAAO,EAAE;AAGX,KAAI,yBAAyB,IAAI,MAAM,CACrC,QAAO,OAAO,OAAO,UAAU,CAAC,MAAM;AAGxC,QAAO,OAAO,QAAQ,UAAU,CAC7B,QAAQ,CAAC,UAAU,yBAAyB,IAAI,KAAK,CAAC,CACtD,KAAK,CAAC,GAAG,WAAW,MAAM,CAC1B,MAAM"}
@@ -1,5 +1,6 @@
1
1
  import { pkg } from "../expose.js";
2
2
  import { GitOperationSpanProcessor } from "../util/git/span-processor.js";
3
+ import { getResourceDetectors } from "./detectors.js";
3
4
  import { isTraceDebuggingEnabled, isTraceSendingEnabled, isTracingEnabled, massageThrowable } from "./utils.js";
4
5
  import { isPromise } from "@sindresorhus/is";
5
6
  import { ClientRequest } from "node:http";
@@ -11,11 +12,7 @@ import { registerInstrumentations } from "@opentelemetry/instrumentation";
11
12
  import { BunyanInstrumentation } from "@opentelemetry/instrumentation-bunyan";
12
13
  import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
13
14
  import { RedisInstrumentation } from "@opentelemetry/instrumentation-redis";
14
- import { awsBeanstalkDetector, awsEc2Detector, awsEcsDetector, awsEksDetector, awsLambdaDetector } from "@opentelemetry/resource-detector-aws";
15
- import { azureAppServiceDetector, azureFunctionsDetector, azureVmDetector } from "@opentelemetry/resource-detector-azure";
16
- import { gcpDetector } from "@opentelemetry/resource-detector-gcp";
17
- import { gitHubDetector } from "@opentelemetry/resource-detector-github";
18
- import { detectResources, envDetector, resourceFromAttributes } from "@opentelemetry/resources";
15
+ import { detectResources, resourceFromAttributes } from "@opentelemetry/resources";
19
16
  import { BatchSpanProcessor, ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
20
17
  import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
21
18
  import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
@@ -39,19 +36,7 @@ function init() {
39
36
  ["service.namespace"]: env.OTEL_SERVICE_NAMESPACE ?? "renovatebot.com",
40
37
  [ATTR_SERVICE_VERSION]: env.OTEL_SERVICE_VERSION ?? pkg.version
41
38
  });
42
- const detectedResource = detectResources({ detectors: [
43
- awsBeanstalkDetector,
44
- awsEc2Detector,
45
- awsEcsDetector,
46
- awsEksDetector,
47
- awsLambdaDetector,
48
- azureAppServiceDetector,
49
- azureFunctionsDetector,
50
- azureVmDetector,
51
- gcpDetector,
52
- gitHubDetector,
53
- envDetector
54
- ] });
39
+ const detectedResource = detectResources({ detectors: getResourceDetectors(env) });
55
40
  const traceProvider = new NodeTracerProvider({
56
41
  resource: baseResource.merge(detectedResource),
57
42
  spanProcessors
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../lib/instrumentation/index.ts"],"sourcesContent":["import { ClientRequest } from 'node:http';\nimport type { Context, Span, Tracer, TracerProvider } from '@opentelemetry/api';\nimport * as api from '@opentelemetry/api';\nimport { ProxyTracerProvider, SpanStatusCode } from '@opentelemetry/api';\nimport { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';\nimport { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { BunyanInstrumentation } from '@opentelemetry/instrumentation-bunyan';\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http';\nimport { RedisInstrumentation } from '@opentelemetry/instrumentation-redis';\nimport {\n awsBeanstalkDetector,\n awsEc2Detector,\n awsEcsDetector,\n awsEksDetector,\n awsLambdaDetector,\n} from '@opentelemetry/resource-detector-aws';\nimport {\n azureAppServiceDetector,\n azureFunctionsDetector,\n azureVmDetector,\n} from '@opentelemetry/resource-detector-azure';\nimport { gcpDetector } from '@opentelemetry/resource-detector-gcp';\nimport { gitHubDetector } from '@opentelemetry/resource-detector-github';\nimport {\n detectResources,\n envDetector,\n resourceFromAttributes,\n} from '@opentelemetry/resources';\nimport {\n BatchSpanProcessor,\n ConsoleSpanExporter,\n SimpleSpanProcessor,\n type SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n} from '@opentelemetry/semantic-conventions';\nimport { isPromise } from '@sindresorhus/is';\nimport { pkg } from '../expose.ts';\nimport { GitOperationSpanProcessor } from '../util/git/span-processor.ts';\nimport type { RenovateSpanOptions } from './types.ts';\nimport {\n isTraceDebuggingEnabled,\n isTraceSendingEnabled,\n isTracingEnabled,\n massageThrowable,\n} from './utils.ts';\n\nlet instrumentations: Instrumentation[] = [];\n\nexport function init(): void {\n if (!isTracingEnabled()) {\n return;\n }\n\n // v8 ignore if -- TODO add tests\n if (process.env.OTEL_LOG_LEVEL) {\n api.diag.setLogger(\n new api.DiagConsoleLogger(),\n api.DiagLogLevel[\n process.env.OTEL_LOG_LEVEL.toUpperCase() as keyof typeof api.DiagLogLevel\n ],\n );\n }\n\n const spanProcessors: SpanProcessor[] = [];\n // add processors\n if (isTraceDebuggingEnabled()) {\n spanProcessors.push(new SimpleSpanProcessor(new ConsoleSpanExporter()));\n }\n\n // OTEL specification environment variable\n if (isTraceSendingEnabled()) {\n const exporter = new OTLPTraceExporter();\n spanProcessors.push(new BatchSpanProcessor(exporter));\n // TODO: fix me, transitive initializes logger\n spanProcessors.push(new GitOperationSpanProcessor());\n }\n\n const env = process.env; // don't use getEnv() here to avoid circular dependency with env variables used in the resource detectors\n const baseResource = resourceFromAttributes({\n // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#semantic-attributes-with-sdk-provided-default-value\n [ATTR_SERVICE_NAME]: env.OTEL_SERVICE_NAME ?? 'renovate',\n // https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n // https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/semantic-conventions/src/experimental_attributes.ts#L7688\n ['service.namespace']: env.OTEL_SERVICE_NAMESPACE ?? 'renovatebot.com',\n [ATTR_SERVICE_VERSION]: env.OTEL_SERVICE_VERSION ?? pkg.version,\n });\n\n const detectedResource = detectResources({\n detectors: [\n awsBeanstalkDetector,\n awsEc2Detector,\n awsEcsDetector,\n awsEksDetector,\n awsLambdaDetector,\n azureAppServiceDetector,\n azureFunctionsDetector,\n azureVmDetector,\n gcpDetector,\n gitHubDetector,\n envDetector,\n ],\n });\n\n const traceProvider = new NodeTracerProvider({\n resource: baseResource.merge(detectedResource),\n spanProcessors,\n });\n\n const contextManager = new AsyncLocalStorageContextManager();\n traceProvider.register({\n contextManager,\n });\n\n instrumentations = [\n new HttpInstrumentation({\n /* v8 ignore start -- not easily testable */\n applyCustomAttributesOnSpan: (span, request, response) => {\n // ignore 404 errors when the branch protection of Github could not be found. This is expected if no rules are configured\n if (\n request instanceof ClientRequest &&\n request.host === `api.github.com` &&\n request.path.endsWith(`/protection`) &&\n response.statusCode === 404\n ) {\n span.setStatus({ code: SpanStatusCode.OK });\n }\n },\n /* v8 ignore stop -- not easily testable */\n }),\n new BunyanInstrumentation(),\n new RedisInstrumentation(),\n ];\n registerInstrumentations({\n instrumentations,\n });\n}\n\n// https://github.com/open-telemetry/opentelemetry-js-api/issues/34\n/* v8 ignore next -- not easily testable */\nexport async function shutdown(): Promise<void> {\n const traceProvider = getTracerProvider();\n if (traceProvider instanceof NodeTracerProvider) {\n await traceProvider.shutdown();\n } else if (traceProvider instanceof ProxyTracerProvider) {\n const delegateProvider = traceProvider.getDelegate();\n if (delegateProvider instanceof NodeTracerProvider) {\n await delegateProvider.shutdown();\n }\n }\n}\n\nexport function disableInstrumentations(): void {\n for (const instrumentation of instrumentations) {\n instrumentation.disable();\n }\n}\n\nexport function getTracerProvider(): TracerProvider {\n return api.trace.getTracerProvider();\n}\n\nfunction getTracer(): Tracer {\n return getTracerProvider().getTracer('renovate');\n}\n\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n): ReturnType<F>;\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n options: RenovateSpanOptions,\n): ReturnType<F>;\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n options: RenovateSpanOptions,\n context: Context,\n): ReturnType<F>;\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n options: RenovateSpanOptions = {},\n context: Context = api.context.active(),\n): ReturnType<F> {\n return getTracer().startActiveSpan(name, options, context, (span: Span) => {\n try {\n const ret = fn();\n if (isPromise(ret)) {\n return ret\n .catch((e) => {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: massageThrowable(e),\n });\n throw e;\n })\n .finally(() => span.end()) as ReturnType<F>;\n }\n span.end();\n return ret;\n } catch (e) {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: massageThrowable(e),\n });\n span.end();\n throw e;\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoDA,IAAI,mBAAsC,EAAE;AAE5C,SAAgB,OAAa;AAC3B,KAAI,CAAC,kBAAkB,CACrB;;AAIF,KAAI,QAAQ,IAAI,eACd,KAAI,KAAK,UACP,IAAI,IAAI,mBAAmB,EAC3B,IAAI,aACF,QAAQ,IAAI,eAAe,aAAa,EAE3C;CAGH,MAAM,iBAAkC,EAAE;AAE1C,KAAI,yBAAyB,CAC3B,gBAAe,KAAK,IAAI,oBAAoB,IAAI,qBAAqB,CAAC,CAAC;AAIzE,KAAI,uBAAuB,EAAE;EAC3B,MAAM,WAAW,IAAI,mBAAmB;AACxC,iBAAe,KAAK,IAAI,mBAAmB,SAAS,CAAC;AAErD,iBAAe,KAAK,IAAI,2BAA2B,CAAC;;CAGtD,MAAM,MAAM,QAAQ;CACpB,MAAM,eAAe,uBAAuB;GAEzC,oBAAoB,IAAI,qBAAqB;GAG7C,sBAAsB,IAAI,0BAA0B;GACpD,uBAAuB,IAAI,wBAAwB,IAAI;EACzD,CAAC;CAEF,MAAM,mBAAmB,gBAAgB,EACvC,WAAW;EACT;EACA;EACA;EACA;EACA;E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ACA,GAAG;AACV,QAAK,gBAAgB,EAAE;AACvB,QAAK,UAAU;IACb,MAAM,eAAe;IACrB,SAAS,iBAAiB,EAAE;IAC7B,CAAC;AACF,QAAK,KAAK;AACV,SAAM;;GAER"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../lib/instrumentation/index.ts"],"sourcesContent":["import { ClientRequest } from 'node:http';\nimport type { Context, Span, Tracer, TracerProvider } from '@opentelemetry/api';\nimport * as api from '@opentelemetry/api';\nimport { ProxyTracerProvider, SpanStatusCode } from '@opentelemetry/api';\nimport { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';\nimport { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { BunyanInstrumentation } from '@opentelemetry/instrumentation-bunyan';\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http';\nimport { RedisInstrumentation } from '@opentelemetry/instrumentation-redis';\nimport {\n detectResources,\n resourceFromAttributes,\n} from '@opentelemetry/resources';\nimport {\n BatchSpanProcessor,\n ConsoleSpanExporter,\n SimpleSpanProcessor,\n type SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n} from '@opentelemetry/semantic-conventions';\nimport { isPromise } from '@sindresorhus/is';\nimport { pkg } from '../expose.ts';\nimport { GitOperationSpanProcessor } from '../util/git/span-processor.ts';\nimport { getResourceDetectors } from './detectors.ts';\nimport type { RenovateSpanOptions } from './types.ts';\nimport {\n isTraceDebuggingEnabled,\n isTraceSendingEnabled,\n isTracingEnabled,\n massageThrowable,\n} from './utils.ts';\n\nlet instrumentations: Instrumentation[] = [];\n\nexport function init(): void {\n if (!isTracingEnabled()) {\n return;\n }\n\n // v8 ignore if -- TODO add tests\n if (process.env.OTEL_LOG_LEVEL) {\n api.diag.setLogger(\n new api.DiagConsoleLogger(),\n api.DiagLogLevel[\n process.env.OTEL_LOG_LEVEL.toUpperCase() as keyof typeof api.DiagLogLevel\n ],\n );\n }\n\n const spanProcessors: SpanProcessor[] = [];\n // add processors\n if (isTraceDebuggingEnabled()) {\n spanProcessors.push(new SimpleSpanProcessor(new ConsoleSpanExporter()));\n }\n\n // OTEL specification environment variable\n if (isTraceSendingEnabled()) {\n const exporter = new OTLPTraceExporter();\n spanProcessors.push(new BatchSpanProcessor(exporter));\n // TODO: fix me, transitive initializes logger\n spanProcessors.push(new GitOperationSpanProcessor());\n }\n\n const env = process.env; // don't use getEnv() here to avoid circular dependency with env variables used in the resource detectors\n const baseResource = resourceFromAttributes({\n // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#semantic-attributes-with-sdk-provided-default-value\n [ATTR_SERVICE_NAME]: env.OTEL_SERVICE_NAME ?? 'renovate',\n // https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n // https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/semantic-conventions/src/experimental_attributes.ts#L7688\n ['service.namespace']: env.OTEL_SERVICE_NAMESPACE ?? 'renovatebot.com',\n [ATTR_SERVICE_VERSION]: env.OTEL_SERVICE_VERSION ?? pkg.version,\n });\n\n const detectedResource = detectResources({\n detectors: getResourceDetectors(env),\n });\n\n const traceProvider = new NodeTracerProvider({\n resource: baseResource.merge(detectedResource),\n spanProcessors,\n });\n\n const contextManager = new AsyncLocalStorageContextManager();\n traceProvider.register({\n contextManager,\n });\n\n instrumentations = [\n new HttpInstrumentation({\n /* v8 ignore start -- not easily testable */\n applyCustomAttributesOnSpan: (span, request, response) => {\n // ignore 404 errors when the branch protection of Github could not be found. This is expected if no rules are configured\n if (\n request instanceof ClientRequest &&\n request.host === `api.github.com` &&\n request.path.endsWith(`/protection`) &&\n response.statusCode === 404\n ) {\n span.setStatus({ code: SpanStatusCode.OK });\n }\n },\n /* v8 ignore stop -- not easily testable */\n }),\n new BunyanInstrumentation(),\n new RedisInstrumentation(),\n ];\n registerInstrumentations({\n instrumentations,\n });\n}\n\n// https://github.com/open-telemetry/opentelemetry-js-api/issues/34\n/* v8 ignore next -- not easily testable */\nexport async function shutdown(): Promise<void> {\n const traceProvider = getTracerProvider();\n if (traceProvider instanceof NodeTracerProvider) {\n await traceProvider.shutdown();\n } else if (traceProvider instanceof ProxyTracerProvider) {\n const delegateProvider = traceProvider.getDelegate();\n if (delegateProvider instanceof NodeTracerProvider) {\n await delegateProvider.shutdown();\n }\n }\n}\n\nexport function disableInstrumentations(): void {\n for (const instrumentation of instrumentations) {\n instrumentation.disable();\n }\n}\n\nexport function getTracerProvider(): TracerProvider {\n return api.trace.getTracerProvider();\n}\n\nfunction getTracer(): Tracer {\n return getTracerProvider().getTracer('renovate');\n}\n\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n): ReturnType<F>;\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n options: RenovateSpanOptions,\n): ReturnType<F>;\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n options: RenovateSpanOptions,\n context: Context,\n): ReturnType<F>;\nexport function instrument<F extends () => ReturnType<F>>(\n name: string,\n fn: F,\n options: RenovateSpanOptions = {},\n context: Context = api.context.active(),\n): ReturnType<F> {\n return getTracer().startActiveSpan(name, options, context, (span: Span) => {\n try {\n const ret = fn();\n if (isPromise(ret)) {\n return ret\n .catch((e) => {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: massageThrowable(e),\n });\n throw e;\n })\n .finally(() => span.end()) as ReturnType<F>;\n }\n span.end();\n return ret;\n } catch (e) {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: massageThrowable(e),\n });\n span.end();\n throw e;\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,IAAI,m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ACrB,yBAAyB,qBAAqB;EACvD,MAAM,mBAAmB,cAAc,aAAa;AACpD,MAAI,4BAA4B,mBAC9B,OAAM,iBAAiB,UAAU;;;AAWvC,SAAgB,oBAAoC;AAClD,QAAO,IAAI,MAAM,mBAAmB;;AAGtC,SAAS,YAAoB;AAC3B,QAAO,mBAAmB,CAAC,UAAU,WAAW;;AAkBlD,SAAgB,WACd,MACA,IACA,UAA+B,EAAE,EACjC,UAAmB,IAAI,QAAQ,QAAQ,EACxB;AACf,QAAO,WAAW,CAAC,gBAAgB,MAAM,SAAS,UAAU,SAAe;AACzE,MAAI;GACF,MAAM,MAAM,IAAI;AAChB,OAAI,UAAU,IAAI,CAChB,QAAO,IACJ,OAAO,MAAM;AACZ,SAAK,gBAAgB,EAAE;AACvB,SAAK,UAAU;KACb,MAAM,eAAe;KACrB,SAAS,iBAAiB,EAAE;KAC7B,CAAC;AACF,UAAM;KACN,CACD,cAAc,KAAK,KAAK,CAAC;AAE9B,QAAK,KAAK;AACV,UAAO;WACA,GAAG;AACV,QAAK,gBAAgB,EAAE;AACvB,QAAK,UAAU;IACb,MAAM,eAAe;IACrB,SAAS,iBAAiB,EAAE;IAC7B,CAAC;AACF,QAAK,KAAK;AACV,SAAM;;GAER"}
@@ -2,8 +2,21 @@ import { hiddenUnicodeCharactersRegex, toUnicodeEscape } from "./regex.js";
2
2
  import { logger } from "../logger/index.js";
3
3
 
4
4
  //#region lib/util/unicode.ts
5
+ function isBinaryContent(content) {
6
+ const sampleSize = Math.min(content.length, 8192);
7
+ for (let i = 0; i < sampleSize; i++) if (content[i] === 0) return true;
8
+ return false;
9
+ }
5
10
  function logWarningIfUnicodeHiddenCharactersInPackageFile(file, content) {
6
- const hiddenCharacters = content.toString("utf8").match(hiddenUnicodeCharactersRegex);
11
+ const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);
12
+ const hiddenCharacters = buffer.toString("utf8").match(hiddenUnicodeCharactersRegex);
13
+ if (isBinaryContent(buffer) && hiddenCharacters) {
14
+ logger.trace({
15
+ file,
16
+ hiddenCharacters: toUnicodeEscape(hiddenCharacters.join(""))
17
+ }, `Hidden Unicode characters discovered in file \`${file}\`, but not logging higher than TRACE as it appears to be a binary file`);
18
+ return;
19
+ }
7
20
  if (hiddenCharacters) if (hiddenCharacters.length === 1 && hiddenCharacters[0] === "") logger.once.trace({
8
21
  file,
9
22
  hiddenCharacters: toUnicodeEscape(hiddenCharacters.join(""))
@@ -1 +1 @@
1
- {"version":3,"file":"unicode.js","names":[],"sources":["../../lib/util/unicode.ts"],"sourcesContent":["import { logger } from '../logger/index.ts';\nimport { hiddenUnicodeCharactersRegex, toUnicodeEscape } from './regex.ts';\n\nexport function logWarningIfUnicodeHiddenCharactersInPackageFile(\n file: string,\n content: string | Buffer,\n): void {\n const hiddenCharacters = content\n .toString('utf8')\n .match(hiddenUnicodeCharactersRegex);\n if (hiddenCharacters) {\n if (hiddenCharacters.length === 1 && hiddenCharacters[0] === '\\uFEFF') {\n logger.once.trace(\n {\n file,\n hiddenCharacters: toUnicodeEscape(hiddenCharacters.join('')),\n },\n `Hidden Byte Order Mark (BOM) Unicode characters has been discovered in the file \\`${file}\\`. This is likely safe, if you are using Microsoft Windows, but please confirm that they are intended to be there, as they could be an attempt to \"smuggle\" text into your codebase, or used to confuse tools like Renovate or Large Language Models (LLMs)`,\n );\n } else {\n logger.once.warn(\n {\n file,\n hiddenCharacters: toUnicodeEscape(hiddenCharacters.join('')),\n },\n `Hidden Unicode characters have been discovered in file(s) in your repository. See your Renovate logs for more details. Please confirm that they are intended to be there, as they could be an attempt to \"smuggle\" text into your codebase, or used to confuse tools like Renovate or Large Language Models (LLMs)`,\n );\n }\n }\n}\n"],"mappings":";;;;AAGA,SAAgB,iDACd,MACA,SACM;CACN,MAAM,mBAAmB,QACtB,SAAS,OAAO,CAChB,MAAM,6BAA6B;AACtC,KAAI,iBACF,KAAI,iBAAiB,WAAW,KAAK,iBAAiB,OAAO,IAC3D,QAAO,KAAK,MACV;EACE;EACA,kBAAkB,gBAAgB,iBAAiB,KAAK,GAAG,CAAC;EAC7D,EACD,qFAAqF,KAAK,8PAC3F;KAED,QAAO,KAAK,KACV;EACE;EACA,kBAAkB,gBAAgB,iBAAiB,KAAK,GAAG,CAAC;EAC7D,EACD,qTACD"}
1
+ {"version":3,"file":"unicode.js","names":[],"sources":["../../lib/util/unicode.ts"],"sourcesContent":["import { logger } from '../logger/index.ts';\nimport { hiddenUnicodeCharactersRegex, toUnicodeEscape } from './regex.ts';\n\nfunction isBinaryContent(content: Buffer): boolean {\n // Check for null bytes in the first 8KB - a common indicator of binary content\n const sampleSize = Math.min(content.length, 8192);\n for (let i = 0; i < sampleSize; i++) {\n if (content[i] === 0) {\n return true;\n }\n }\n return false;\n}\n\nexport function logWarningIfUnicodeHiddenCharactersInPackageFile(\n file: string,\n content: string | Buffer,\n): void {\n const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);\n const hiddenCharacters = buffer\n .toString('utf8')\n .match(hiddenUnicodeCharactersRegex);\n\n if (isBinaryContent(buffer) && hiddenCharacters) {\n logger.trace(\n {\n file,\n hiddenCharacters: toUnicodeEscape(hiddenCharacters.join('')),\n },\n\n `Hidden Unicode characters discovered in file \\`${file}\\`, but not logging higher than TRACE as it appears to be a binary file`,\n );\n return;\n }\n\n if (hiddenCharacters) {\n if (hiddenCharacters.length === 1 && hiddenCharacters[0] === '\\uFEFF') {\n logger.once.trace(\n {\n file,\n hiddenCharacters: toUnicodeEscape(hiddenCharacters.join('')),\n },\n `Hidden Byte Order Mark (BOM) Unicode characters has been discovered in the file \\`${file}\\`. This is likely safe, if you are using Microsoft Windows, but please confirm that they are intended to be there, as they could be an attempt to \"smuggle\" text into your codebase, or used to confuse tools like Renovate or Large Language Models (LLMs)`,\n );\n } else {\n logger.once.warn(\n {\n file,\n hiddenCharacters: toUnicodeEscape(hiddenCharacters.join('')),\n },\n `Hidden Unicode characters have been discovered in file(s) in your repository. See your Renovate logs for more details. Please confirm that they are intended to be there, as they could be an attempt to \"smuggle\" text into your codebase, or used to confuse tools like Renovate or Large Language Models (LLMs)`,\n );\n }\n }\n}\n"],"mappings":";;;;AAGA,SAAS,gBAAgB,SAA0B;CAEjD,MAAM,aAAa,KAAK,IAAI,QAAQ,QAAQ,KAAK;AACjD,MAAK,IAAI,IAAI,GAAG,IAAI,YAAY,IAC9B,KAAI,QAAQ,OAAO,EACjB,QAAO;AAGX,QAAO;;AAGT,SAAgB,iDACd,MACA,SACM;CACN,MAAM,SAAS,OAAO,SAAS,QAAQ,GAAG,UAAU,OAAO,KAAK,QAAQ;CACxE,MAAM,mBAAmB,OACtB,SAAS,OAAO,CAChB,MAAM,6BAA6B;AAEtC,KAAI,gBAAgB,OAAO,IAAI,kBAAkB;AAC/C,SAAO,MACL;GACE;GACA,kBAAkB,gBAAgB,iBAAiB,KAAK,GAAG,CAAC;GAC7D,EAED,kDAAkD,KAAK,yEACxD;AACD;;AAGF,KAAI,iBACF,KAAI,iBAAiB,WAAW,KAAK,iBAAiB,OAAO,IAC3D,QAAO,KAAK,MACV;EACE;EACA,kBAAkB,gBAAgB,iBAAiB,KAAK,GAAG,CAAC;EAC7D,EACD,qFAAqF,KAAK,8PAC3F;KAED,QAAO,KAAK,KACV;EACE;EACA,kBAAkB,gBAAgB,iBAAiB,KAAK,GAAG,CAAC;EAC7D,EACD,qTACD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "renovate",
3
3
  "description": "Automated dependency updates. Flexible so you don't need to be.",
4
- "version": "43.35.1",
4
+ "version": "43.36.1",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "renovate": "dist/renovate.js",
@@ -1,7 +1,7 @@
1
1
  {
2
- "title": "JSON schema for Renovate 43.35.1 config files (https://renovatebot.com/)",
2
+ "title": "JSON schema for Renovate 43.36.1 config files (https://renovatebot.com/)",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
- "x-renovate-version": "43.35.1",
4
+ "x-renovate-version": "43.36.1",
5
5
  "allowComments": true,
6
6
  "type": "object",
7
7
  "properties": {