miladyai 2.0.0-alpha.27
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/_virtual/_rolldown/runtime.js +7 -0
- package/dist/actions/emote.js +64 -0
- package/dist/actions/restart.js +81 -0
- package/dist/actions/send-message.js +152 -0
- package/dist/agent-admin-routes.js +82 -0
- package/dist/agent-lifecycle-routes.js +79 -0
- package/dist/agent-transfer-routes.js +102 -0
- package/dist/api/agent-admin-routes.js +82 -0
- package/dist/api/agent-lifecycle-routes.js +79 -0
- package/dist/api/agent-transfer-routes.js +102 -0
- package/dist/api/apps-hyperscape-routes.js +58 -0
- package/dist/api/apps-routes.js +114 -0
- package/dist/api/auth-routes.js +56 -0
- package/dist/api/autonomy-routes.js +44 -0
- package/dist/api/bug-report-routes.js +111 -0
- package/dist/api/character-routes.js +195 -0
- package/dist/api/cloud-routes.js +330 -0
- package/dist/api/cloud-status-routes.js +155 -0
- package/dist/api/compat-utils.js +111 -0
- package/dist/api/database.js +735 -0
- package/dist/api/diagnostics-routes.js +205 -0
- package/dist/api/drop-service.js +134 -0
- package/dist/api/early-logs.js +86 -0
- package/dist/api/http-helpers.js +131 -0
- package/dist/api/knowledge-routes.js +534 -0
- package/dist/api/memory-bounds.js +71 -0
- package/dist/api/models-routes.js +28 -0
- package/dist/api/og-tracker.js +36 -0
- package/dist/api/permissions-routes.js +109 -0
- package/dist/api/plugin-validation.js +198 -0
- package/dist/api/provider-switch-config.js +41 -0
- package/dist/api/registry-routes.js +86 -0
- package/dist/api/registry-service.js +164 -0
- package/dist/api/sandbox-routes.js +1112 -0
- package/dist/api/server.js +7949 -0
- package/dist/api/subscription-routes.js +172 -0
- package/dist/api/terminal-run-limits.js +24 -0
- package/dist/api/training-routes.js +158 -0
- package/dist/api/trajectory-routes.js +300 -0
- package/dist/api/trigger-routes.js +246 -0
- package/dist/api/twitter-verify.js +134 -0
- package/dist/api/tx-service.js +108 -0
- package/dist/api/wallet-routes.js +266 -0
- package/dist/api/wallet.js +568 -0
- package/dist/api/whatsapp-routes.js +182 -0
- package/dist/api/zip-utils.js +109 -0
- package/dist/apps-hyperscape-routes.js +58 -0
- package/dist/apps-routes.js +114 -0
- package/dist/ascii.js +20 -0
- package/dist/auth/anthropic.js +44 -0
- package/dist/auth/apply-stealth.js +41 -0
- package/dist/auth/claude-code-stealth.js +78 -0
- package/dist/auth/credentials.js +156 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/openai-codex.js +66 -0
- package/dist/auth/types.js +9 -0
- package/dist/auth-routes.js +56 -0
- package/dist/autonomy-routes.js +44 -0
- package/dist/bug-report-routes.js +111 -0
- package/dist/build-info.json +6 -0
- package/dist/character-routes.js +195 -0
- package/dist/cli/argv.js +63 -0
- package/dist/cli/banner.js +34 -0
- package/dist/cli/cli-name.js +21 -0
- package/dist/cli/cli-utils.js +16 -0
- package/dist/cli/git-commit.js +78 -0
- package/dist/cli/parse-duration.js +15 -0
- package/dist/cli/plugins-cli.js +590 -0
- package/dist/cli/profile-utils.js +9 -0
- package/dist/cli/profile.js +95 -0
- package/dist/cli/program/build-program.js +17 -0
- package/dist/cli/program/command-registry.js +23 -0
- package/dist/cli/program/help.js +47 -0
- package/dist/cli/program/preaction.js +33 -0
- package/dist/cli/program/register.config.js +106 -0
- package/dist/cli/program/register.configure.js +20 -0
- package/dist/cli/program/register.dashboard.js +124 -0
- package/dist/cli/program/register.models.js +23 -0
- package/dist/cli/program/register.setup.js +36 -0
- package/dist/cli/program/register.start.js +22 -0
- package/dist/cli/program/register.subclis.js +70 -0
- package/dist/cli/program/register.tui.js +163 -0
- package/dist/cli/program/register.update.js +154 -0
- package/dist/cli/program.js +3 -0
- package/dist/cli/run-main.js +37 -0
- package/dist/cli/version.js +7 -0
- package/dist/cloud/validate-url.js +93 -0
- package/dist/cloud-routes.js +330 -0
- package/dist/cloud-status-routes.js +155 -0
- package/dist/compat-utils.js +111 -0
- package/dist/config/config.js +69 -0
- package/dist/config/env-vars.js +19 -0
- package/dist/config/includes.js +121 -0
- package/dist/config/object-utils.js +7 -0
- package/dist/config/paths.js +38 -0
- package/dist/config/plugin-auto-enable.js +231 -0
- package/dist/config/schema.js +864 -0
- package/dist/config/telegram-custom-commands.js +76 -0
- package/dist/config/zod-schema.agent-runtime.js +519 -0
- package/dist/config/zod-schema.core.js +538 -0
- package/dist/config/zod-schema.hooks.js +103 -0
- package/dist/config/zod-schema.js +488 -0
- package/dist/config/zod-schema.providers-core.js +785 -0
- package/dist/config/zod-schema.session.js +73 -0
- package/dist/core-plugins.js +37 -0
- package/dist/custom-actions.js +250 -0
- package/dist/database.js +735 -0
- package/dist/diagnostics/integration-observability.js +57 -0
- package/dist/diagnostics-routes.js +205 -0
- package/dist/drop-service.js +134 -0
- package/dist/early-logs.js +24 -0
- package/dist/eliza.js +2061 -0
- package/dist/emotes/catalog.js +271 -0
- package/dist/entry.js +40 -0
- package/dist/hooks/discovery.js +167 -0
- package/dist/hooks/eligibility.js +64 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/loader.js +147 -0
- package/dist/hooks/registry.js +55 -0
- package/dist/http-helpers.js +131 -0
- package/dist/index.js +49 -0
- package/dist/knowledge-routes.js +534 -0
- package/dist/memory-bounds.js +71 -0
- package/dist/milady-plugin.js +90 -0
- package/dist/models-routes.js +28 -0
- package/dist/onboarding-names.js +78 -0
- package/dist/onboarding-presets.js +922 -0
- package/dist/package.json +1 -0
- package/dist/permissions-routes.js +109 -0
- package/dist/plugin-validation.js +107 -0
- package/dist/plugins/whatsapp/actions.js +91 -0
- package/dist/plugins/whatsapp/index.js +16 -0
- package/dist/plugins/whatsapp/service.js +270 -0
- package/dist/provider-switch-config.js +41 -0
- package/dist/providers/admin-trust.js +46 -0
- package/dist/providers/autonomous-state.js +101 -0
- package/dist/providers/session-bridge.js +86 -0
- package/dist/providers/session-utils.js +36 -0
- package/dist/providers/simple-mode.js +50 -0
- package/dist/providers/ui-catalog.js +15 -0
- package/dist/providers/workspace-provider.js +93 -0
- package/dist/providers/workspace.js +348 -0
- package/dist/registry-routes.js +86 -0
- package/dist/registry-service.js +164 -0
- package/dist/restart.js +40 -0
- package/dist/runtime/core-plugins.js +37 -0
- package/dist/runtime/custom-actions.js +250 -0
- package/dist/runtime/eliza.js +2061 -0
- package/dist/runtime/embedding-manager-support.js +185 -0
- package/dist/runtime/embedding-manager.js +193 -0
- package/dist/runtime/embedding-presets.js +54 -0
- package/dist/runtime/embedding-state.js +8 -0
- package/dist/runtime/milady-plugin.js +90 -0
- package/dist/runtime/onboarding-names.js +78 -0
- package/dist/runtime/restart.js +40 -0
- package/dist/runtime/version.js +7 -0
- package/dist/sandbox-routes.js +1112 -0
- package/dist/security/audit-log.js +149 -0
- package/dist/security/network-policy.js +70 -0
- package/dist/server.js +7949 -0
- package/dist/services/agent-export.js +559 -0
- package/dist/services/app-manager.js +389 -0
- package/dist/services/browser-capture.js +86 -0
- package/dist/services/fallback-training-service.js +128 -0
- package/dist/services/mcp-marketplace.js +134 -0
- package/dist/services/plugin-installer.js +396 -0
- package/dist/services/plugin-manager-types.js +15 -0
- package/dist/services/registry-client-app-meta.js +144 -0
- package/dist/services/registry-client-endpoints.js +166 -0
- package/dist/services/registry-client-local.js +271 -0
- package/dist/services/registry-client-network.js +93 -0
- package/dist/services/registry-client-queries.js +70 -0
- package/dist/services/registry-client.js +157 -0
- package/dist/services/sandbox-engine.js +511 -0
- package/dist/services/sandbox-manager.js +297 -0
- package/dist/services/self-updater.js +175 -0
- package/dist/services/skill-catalog-client.js +119 -0
- package/dist/services/skill-marketplace.js +521 -0
- package/dist/services/stream-manager.js +236 -0
- package/dist/services/update-checker.js +121 -0
- package/dist/services/update-notifier.js +29 -0
- package/dist/services/version-compat.js +78 -0
- package/dist/services/whatsapp-pairing.js +196 -0
- package/dist/shared/ui-catalog-prompt.js +728 -0
- package/dist/subscription-routes.js +172 -0
- package/dist/terminal/links.js +19 -0
- package/dist/terminal/palette.js +14 -0
- package/dist/terminal/theme.js +25 -0
- package/dist/terminal-run-limits.js +24 -0
- package/dist/training-routes.js +158 -0
- package/dist/trajectory-routes.js +300 -0
- package/dist/trigger-routes.js +246 -0
- package/dist/triggers/action.js +218 -0
- package/dist/triggers/runtime.js +281 -0
- package/dist/triggers/scheduling.js +295 -0
- package/dist/triggers/types.js +5 -0
- package/dist/tui/components/assistant-message.js +76 -0
- package/dist/tui/components/chat-editor.js +34 -0
- package/dist/tui/components/embeddings-overlay.js +46 -0
- package/dist/tui/components/footer.js +60 -0
- package/dist/tui/components/index.js +15 -0
- package/dist/tui/components/modal-frame.js +45 -0
- package/dist/tui/components/modal-style.js +15 -0
- package/dist/tui/components/model-selector.js +70 -0
- package/dist/tui/components/pinned-chat-layout.js +46 -0
- package/dist/tui/components/plugins-endpoints-tab.js +196 -0
- package/dist/tui/components/plugins-installed-tab-view.js +69 -0
- package/dist/tui/components/plugins-installed-tab.js +319 -0
- package/dist/tui/components/plugins-overlay-catalog.js +81 -0
- package/dist/tui/components/plugins-overlay-data-api.js +21 -0
- package/dist/tui/components/plugins-overlay-data-shared.js +20 -0
- package/dist/tui/components/plugins-overlay-data.js +323 -0
- package/dist/tui/components/plugins-overlay.js +117 -0
- package/dist/tui/components/plugins-store-tab.js +148 -0
- package/dist/tui/components/settings-overlay.js +61 -0
- package/dist/tui/components/status-bar.js +64 -0
- package/dist/tui/components/tool-execution.js +68 -0
- package/dist/tui/components/user-message.js +22 -0
- package/dist/tui/eliza-tui-bridge.js +606 -0
- package/dist/tui/index.js +370 -0
- package/dist/tui/modal-presets.js +33 -0
- package/dist/tui/model-spec.js +46 -0
- package/dist/tui/sse-parser.js +78 -0
- package/dist/tui/theme.js +110 -0
- package/dist/tui/titlebar-spinner.js +62 -0
- package/dist/tui/tui-app.js +311 -0
- package/dist/tui/ws-client.js +215 -0
- package/dist/twitter-verify.js +134 -0
- package/dist/tx-service.js +108 -0
- package/dist/utils/exec-safety.js +17 -0
- package/dist/utils/globals.js +20 -0
- package/dist/utils/milady-root.js +61 -0
- package/dist/utils/number-parsing.js +37 -0
- package/dist/version-resolver.js +37 -0
- package/dist/version.js +7 -0
- package/dist/wallet-routes.js +266 -0
- package/dist/wallet.js +568 -0
- package/dist/whatsapp-routes.js +182 -0
- package/dist/zip-utils.js +109 -0
- package/milady.mjs +14 -0
- package/package.json +111 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
//#region src/security/audit-log.ts
|
|
2
|
+
/**
|
|
3
|
+
* Append-only audit log for sandbox security events.
|
|
4
|
+
* Never log real secret values — only token IDs and metadata.
|
|
5
|
+
*/
|
|
6
|
+
const AUDIT_EVENT_TYPES = [
|
|
7
|
+
"sandbox_mode_transition",
|
|
8
|
+
"secret_token_replacement_outbound",
|
|
9
|
+
"secret_sanitization_inbound",
|
|
10
|
+
"privileged_capability_invocation",
|
|
11
|
+
"policy_decision",
|
|
12
|
+
"signing_request_submitted",
|
|
13
|
+
"signing_request_rejected",
|
|
14
|
+
"signing_request_approved",
|
|
15
|
+
"plugin_fallback_attempt",
|
|
16
|
+
"security_kill_switch",
|
|
17
|
+
"sandbox_lifecycle",
|
|
18
|
+
"fetch_proxy_error"
|
|
19
|
+
];
|
|
20
|
+
const AUDIT_SEVERITIES = [
|
|
21
|
+
"info",
|
|
22
|
+
"warn",
|
|
23
|
+
"error",
|
|
24
|
+
"critical"
|
|
25
|
+
];
|
|
26
|
+
const DEFAULT_MAX_ENTRIES = 5e3;
|
|
27
|
+
const PROCESS_FEED_MAX_ENTRIES = DEFAULT_MAX_ENTRIES;
|
|
28
|
+
const processFeedEntries = [];
|
|
29
|
+
const processFeedSubscribers = /* @__PURE__ */ new Set();
|
|
30
|
+
function trimEntries(entries, maxEntries) {
|
|
31
|
+
if (entries.length <= maxEntries) return;
|
|
32
|
+
const keep = Math.floor(maxEntries / 2);
|
|
33
|
+
if (keep <= 0) {
|
|
34
|
+
entries.length = 0;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
entries.splice(0, entries.length - keep);
|
|
38
|
+
}
|
|
39
|
+
function publishToProcessFeed(entry) {
|
|
40
|
+
processFeedEntries.push(entry);
|
|
41
|
+
trimEntries(processFeedEntries, PROCESS_FEED_MAX_ENTRIES);
|
|
42
|
+
for (const subscriber of processFeedSubscribers) try {
|
|
43
|
+
subscriber(entry);
|
|
44
|
+
} catch {}
|
|
45
|
+
}
|
|
46
|
+
function toSinceTimestamp(sinceMs) {
|
|
47
|
+
if (sinceMs === void 0) return void 0;
|
|
48
|
+
if (!Number.isFinite(sinceMs)) return void 0;
|
|
49
|
+
return Math.trunc(sinceMs);
|
|
50
|
+
}
|
|
51
|
+
function toBoundedLimit(limit) {
|
|
52
|
+
if (limit === void 0) return void 0;
|
|
53
|
+
if (!Number.isFinite(limit)) return void 0;
|
|
54
|
+
return Math.max(1, Math.trunc(limit));
|
|
55
|
+
}
|
|
56
|
+
function queryAuditFeed(query = {}) {
|
|
57
|
+
const sinceTimestamp = toSinceTimestamp(query.sinceMs);
|
|
58
|
+
const boundedLimit = toBoundedLimit(query.limit);
|
|
59
|
+
let entries = processFeedEntries;
|
|
60
|
+
if (query.type) entries = entries.filter((entry) => entry.type === query.type);
|
|
61
|
+
if (query.severity) entries = entries.filter((entry) => entry.severity === query.severity);
|
|
62
|
+
if (sinceTimestamp !== void 0) entries = entries.filter((entry) => Date.parse(entry.timestamp) >= sinceTimestamp);
|
|
63
|
+
if (boundedLimit !== void 0) return entries.slice(-boundedLimit);
|
|
64
|
+
return [...entries];
|
|
65
|
+
}
|
|
66
|
+
function getAuditFeedSize() {
|
|
67
|
+
return processFeedEntries.length;
|
|
68
|
+
}
|
|
69
|
+
function subscribeAuditFeed(subscriber) {
|
|
70
|
+
processFeedSubscribers.add(subscriber);
|
|
71
|
+
return () => {
|
|
72
|
+
processFeedSubscribers.delete(subscriber);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var SandboxAuditLog = class {
|
|
76
|
+
constructor(config = {}) {
|
|
77
|
+
this.entries = [];
|
|
78
|
+
this.consoleEnabled = config.console ?? true;
|
|
79
|
+
this.maxEntries = config.maxEntries ?? DEFAULT_MAX_ENTRIES;
|
|
80
|
+
this.sink = config.sink;
|
|
81
|
+
}
|
|
82
|
+
record(entry) {
|
|
83
|
+
const full = {
|
|
84
|
+
...entry,
|
|
85
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
86
|
+
};
|
|
87
|
+
this.entries.push(full);
|
|
88
|
+
publishToProcessFeed(full);
|
|
89
|
+
trimEntries(this.entries, this.maxEntries);
|
|
90
|
+
if (this.consoleEnabled) {
|
|
91
|
+
const line = `[AUDIT:${full.severity.toUpperCase()}] ${full.type}: ${full.summary}`;
|
|
92
|
+
if (full.severity === "critical" || full.severity === "error") console.error(line);
|
|
93
|
+
else if (full.severity === "warn") console.warn(line);
|
|
94
|
+
else console.log(line);
|
|
95
|
+
}
|
|
96
|
+
this.sink?.(full);
|
|
97
|
+
}
|
|
98
|
+
recordTokenReplacement(direction, url, tokenIds) {
|
|
99
|
+
this.record({
|
|
100
|
+
type: direction === "outbound" ? "secret_token_replacement_outbound" : "secret_sanitization_inbound",
|
|
101
|
+
summary: `${direction}: ${tokenIds.length} token(s) for ${url}`,
|
|
102
|
+
metadata: {
|
|
103
|
+
direction,
|
|
104
|
+
url,
|
|
105
|
+
tokenCount: tokenIds.length,
|
|
106
|
+
tokenIds: tokenIds.join(",")
|
|
107
|
+
},
|
|
108
|
+
severity: "info"
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
recordCapabilityInvocation(capability, detail, metadata) {
|
|
112
|
+
this.record({
|
|
113
|
+
type: "privileged_capability_invocation",
|
|
114
|
+
summary: `${capability}: ${detail}`,
|
|
115
|
+
metadata: {
|
|
116
|
+
capability,
|
|
117
|
+
...metadata
|
|
118
|
+
},
|
|
119
|
+
severity: "info"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
recordPolicyDecision(decision, reason, metadata) {
|
|
123
|
+
this.record({
|
|
124
|
+
type: "policy_decision",
|
|
125
|
+
summary: `${decision}: ${reason}`,
|
|
126
|
+
metadata: {
|
|
127
|
+
decision,
|
|
128
|
+
reason,
|
|
129
|
+
...metadata
|
|
130
|
+
},
|
|
131
|
+
severity: decision === "deny" ? "warn" : "info"
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
getRecent(count = 100) {
|
|
135
|
+
return this.entries.slice(-count);
|
|
136
|
+
}
|
|
137
|
+
getByType(type, count = 50) {
|
|
138
|
+
return this.entries.filter((e) => e.type === type).slice(-count);
|
|
139
|
+
}
|
|
140
|
+
get size() {
|
|
141
|
+
return this.entries.length;
|
|
142
|
+
}
|
|
143
|
+
clear() {
|
|
144
|
+
this.entries = [];
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
export { AUDIT_EVENT_TYPES, AUDIT_SEVERITIES, SandboxAuditLog, getAuditFeedSize, queryAuditFeed, subscribeAuditFeed };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import net from "node:net";
|
|
2
|
+
|
|
3
|
+
//#region src/security/network-policy.ts
|
|
4
|
+
const ALWAYS_BLOCKED_IP_PATTERNS = [
|
|
5
|
+
/^0\./,
|
|
6
|
+
/^169\.254\./,
|
|
7
|
+
/^fe[89ab][0-9a-f]:/i,
|
|
8
|
+
/^::$/i,
|
|
9
|
+
/^::1$/i
|
|
10
|
+
];
|
|
11
|
+
const PRIVATE_IP_PATTERNS = [
|
|
12
|
+
/^10\./,
|
|
13
|
+
/^127\./,
|
|
14
|
+
/^172\.(1[6-9]|2\d|3[01])\./,
|
|
15
|
+
/^192\.168\./,
|
|
16
|
+
/^f[cd][0-9a-f]{2}:/i
|
|
17
|
+
];
|
|
18
|
+
function normalizeHostLike(value) {
|
|
19
|
+
return value.trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
20
|
+
}
|
|
21
|
+
function decodeIpv6MappedHex(mapped) {
|
|
22
|
+
const parts = mapped.split(":");
|
|
23
|
+
if (parts.length < 1 || parts.length > 2) return null;
|
|
24
|
+
const parsed = parts.map((part) => {
|
|
25
|
+
if (!/^[0-9a-f]{1,4}$/i.test(part)) return NaN;
|
|
26
|
+
return Number.parseInt(part, 16);
|
|
27
|
+
});
|
|
28
|
+
if (parsed.some((value) => !Number.isFinite(value))) return null;
|
|
29
|
+
const [hi, lo] = parsed.length === 1 ? [0, parsed[0]] : parsed;
|
|
30
|
+
return [
|
|
31
|
+
hi >> 8,
|
|
32
|
+
hi & 255,
|
|
33
|
+
lo >> 8,
|
|
34
|
+
lo & 255
|
|
35
|
+
].join(".");
|
|
36
|
+
}
|
|
37
|
+
function canonicalizeIpv6(ip) {
|
|
38
|
+
try {
|
|
39
|
+
return new URL(`http://[${ip}]/`).hostname.replace(/^\[|\]$/g, "");
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function normalizeIpForPolicy(ip) {
|
|
45
|
+
const base = normalizeHostLike(ip).split("%")[0];
|
|
46
|
+
if (!base) return base;
|
|
47
|
+
let normalized = base;
|
|
48
|
+
if (net.isIP(normalized) === 6) normalized = canonicalizeIpv6(normalized) ?? normalized;
|
|
49
|
+
let mapped = null;
|
|
50
|
+
if (normalized.startsWith("::ffff:")) mapped = normalized.slice(7);
|
|
51
|
+
else if (normalized.startsWith("0:0:0:0:0:ffff:")) mapped = normalized.slice(15);
|
|
52
|
+
if (!mapped) return normalized;
|
|
53
|
+
if (net.isIP(mapped) === 4) return mapped;
|
|
54
|
+
return decodeIpv6MappedHex(mapped) ?? normalized;
|
|
55
|
+
}
|
|
56
|
+
function isBlockedPrivateOrLinkLocalIp(ip) {
|
|
57
|
+
const normalized = normalizeIpForPolicy(ip);
|
|
58
|
+
if (ALWAYS_BLOCKED_IP_PATTERNS.some((pattern) => pattern.test(normalized))) return true;
|
|
59
|
+
return PRIVATE_IP_PATTERNS.some((pattern) => pattern.test(normalized));
|
|
60
|
+
}
|
|
61
|
+
function isLoopbackHost(host) {
|
|
62
|
+
const normalized = normalizeIpForPolicy(host);
|
|
63
|
+
if (!normalized) return false;
|
|
64
|
+
if (normalized === "localhost" || normalized === "::1") return true;
|
|
65
|
+
if (net.isIP(normalized) === 4) return normalized.startsWith("127.");
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { isBlockedPrivateOrLinkLocalIp, isLoopbackHost, normalizeHostLike, normalizeIpForPolicy };
|