Lines 9-49javascript
9 __defProp(target, name, {
13 set: __exportSetter.bind(all, name)
16var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
18// ../../../../../../packages/notifications-plugin/src/notifications.ts
19var exports_notifications = {};
20__export(exports_notifications, {
21 validateNotificationTargetUrl: () => validateNotificationTargetUrl,
22 resolveNotifyTimeoutMs: () => resolveNotifyTimeoutMs,
23 resolveNotifyAllowHttpLocalhost: () => resolveNotifyAllowHttpLocalhost,
24 resolveNotificationTargetUrl: () => resolveNotificationTargetUrl,
25 loadNotificationConfig: () => loadNotificationConfig,
26 dispatchEventToTargets: () => dispatchEventToTargets,
27 buildTargetPayload: () => buildTargetPayload,
28 NOTIFY_LOCALHOST_HTTP_OPT_IN_ENV: () => NOTIFY_LOCALHOST_HTTP_OPT_IN_ENV
30import { lookup as dnsLookup } from "dns/promises";
31import { isIP } from "net";
HighCloud Metadata Access
Source reaches cloud instance metadata or link-local credential endpoints.
dist/src/index.jsView on unpkg · L29 32import { Duration, Effect } from "effect";
33function normalizeTargetHost(host) {
34 return host.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
36function blockedTargetHostReason(host) {
37 const normalizedHost = normalizeTargetHost(host);
38 if (normalizedHost === "localhost" || normalizedHost === "::1") {
39 return "loopback addresses are not allowed";
41 if (METADATA_HOSTS[normalizedHost])
42 return "cloud metadata hosts are not allowed";
43 const embeddedIpv4 = normalizedHost.match(/(?:^|:)(\d+\.\d+\.\d+\.\d+)$/)?.[1];
44 if (embeddedIpv4 && isIP(normalizedHost) === 6) {
45 return blockedTargetHostReason(embeddedIpv4);
47 const ipv4Parts = normalizedHost.split(".");
48 if (ipv4Parts.length === 4 && ipv4Parts.every((part) => /^\d+$/.test(part))) {
49 const a = Number.parseInt(ipv4Parts[0], 10);