agentfootprint 9.114.2 → 9.115.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/AGENTS.md +1 -1
- package/CAPABILITIES.md +3 -0
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/adapters/hosting/agentCoreA2A.js +5 -0
- package/dist/adapters/hosting/agentCoreA2A.js.map +1 -1
- package/dist/adapters/hosting/agentcore.js +5 -0
- package/dist/adapters/hosting/agentcore.js.map +1 -1
- package/dist/adapters/hosting/foundryResponses.js +5 -0
- package/dist/adapters/hosting/foundryResponses.js.map +1 -1
- package/dist/adapters/observability/agentcore.js +18 -5
- package/dist/adapters/observability/agentcore.js.map +1 -1
- package/dist/adapters/observability/audit.js +17 -4
- package/dist/adapters/observability/audit.js.map +1 -1
- package/dist/adapters/observability/otel.js +890 -33
- package/dist/adapters/observability/otel.js.map +1 -1
- package/dist/artifacts/capability.js +9 -3
- package/dist/artifacts/capability.js.map +1 -1
- package/dist/bridge/eventMeta.js +40 -1
- package/dist/bridge/eventMeta.js.map +1 -1
- package/dist/core/Agent.js +40 -6
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/RunnerBase.js +32 -1
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +13 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +64 -7
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/flowchartAsTool.js +8 -2
- package/dist/core/flowchartAsTool.js.map +1 -1
- package/dist/core/runbook/runbookAsTool.js +7 -2
- package/dist/core/runbook/runbookAsTool.js.map +1 -1
- package/dist/core/toolShownArgs.js +55 -0
- package/dist/core/toolShownArgs.js.map +1 -0
- package/dist/esm/adapters/hosting/agentCoreA2A.d.ts +14 -1
- package/dist/esm/adapters/hosting/agentCoreA2A.js +5 -0
- package/dist/esm/adapters/hosting/agentCoreA2A.js.map +1 -1
- package/dist/esm/adapters/hosting/agentcore.d.ts +18 -2
- package/dist/esm/adapters/hosting/agentcore.js +5 -0
- package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
- package/dist/esm/adapters/hosting/foundryResponses.d.ts +15 -1
- package/dist/esm/adapters/hosting/foundryResponses.js +5 -0
- package/dist/esm/adapters/hosting/foundryResponses.js.map +1 -1
- package/dist/esm/adapters/observability/agentcore.d.ts +17 -5
- package/dist/esm/adapters/observability/agentcore.js +18 -5
- package/dist/esm/adapters/observability/agentcore.js.map +1 -1
- package/dist/esm/adapters/observability/audit.d.ts +6 -2
- package/dist/esm/adapters/observability/audit.js +17 -4
- package/dist/esm/adapters/observability/audit.js.map +1 -1
- package/dist/esm/adapters/observability/otel.d.ts +240 -11
- package/dist/esm/adapters/observability/otel.js +890 -33
- package/dist/esm/adapters/observability/otel.js.map +1 -1
- package/dist/esm/artifacts/capability.d.ts +3 -1
- package/dist/esm/artifacts/capability.js +9 -3
- package/dist/esm/artifacts/capability.js.map +1 -1
- package/dist/esm/bridge/eventMeta.d.ts +32 -0
- package/dist/esm/bridge/eventMeta.js +38 -0
- package/dist/esm/bridge/eventMeta.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +18 -5
- package/dist/esm/core/Agent.js +42 -8
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/RunnerBase.d.ts +20 -0
- package/dist/esm/core/RunnerBase.js +32 -1
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.js +13 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +11 -0
- package/dist/esm/core/agent/stages/toolCalls.js +64 -7
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/flowchartAsTool.js +8 -2
- package/dist/esm/core/flowchartAsTool.js.map +1 -1
- package/dist/esm/core/runbook/runbookAsTool.js +7 -2
- package/dist/esm/core/runbook/runbookAsTool.js.map +1 -1
- package/dist/esm/core/toolShownArgs.d.ts +62 -0
- package/dist/esm/core/toolShownArgs.js +49 -0
- package/dist/esm/core/toolShownArgs.js.map +1 -0
- package/dist/esm/events/payloads.d.ts +122 -6
- package/dist/esm/events/registry.d.ts +3 -1
- package/dist/esm/events/registry.js +2 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/events/types.d.ts +7 -0
- package/dist/esm/hosting/artifactWire.d.ts +10 -2
- package/dist/esm/hosting/artifactWire.js +20 -2
- package/dist/esm/hosting/artifactWire.js.map +1 -1
- package/dist/esm/hosting/doorGuard.d.ts +280 -0
- package/dist/esm/hosting/doorGuard.js +499 -0
- package/dist/esm/hosting/doorGuard.js.map +1 -0
- package/dist/esm/hosting/errors.d.ts +113 -0
- package/dist/esm/hosting/errors.js +177 -0
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/hosting/httpHost.d.ts +32 -3
- package/dist/esm/hosting/httpHost.js +218 -4
- package/dist/esm/hosting/httpHost.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +7 -5
- package/dist/esm/hosting/index.js +10 -3
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/ingressRecord.d.ts +64 -10
- package/dist/esm/hosting/ingressRecord.js +65 -6
- package/dist/esm/hosting/ingressRecord.js.map +1 -1
- package/dist/esm/hosting/nodeHost.d.ts +32 -2
- package/dist/esm/hosting/nodeHost.js +10 -0
- package/dist/esm/hosting/nodeHost.js.map +1 -1
- package/dist/esm/hosting/standingAgent.js +362 -51
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/hosting/turnArtifacts.d.ts +93 -0
- package/dist/esm/hosting/turnArtifacts.js +126 -0
- package/dist/esm/hosting/turnArtifacts.js.map +1 -0
- package/dist/esm/hosting/types.d.ts +196 -3
- package/dist/esm/hosting/types.js +10 -0
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/hosting/webSocketConversation.d.ts +15 -1
- package/dist/esm/hosting/webSocketConversation.js +54 -2
- package/dist/esm/hosting/webSocketConversation.js.map +1 -1
- package/dist/esm/integrity/disposition/ledger.d.ts +8 -0
- package/dist/esm/integrity/disposition/ledger.js +0 -0
- package/dist/esm/integrity/disposition/ledger.js.map +1 -1
- package/dist/esm/lib/mcp/mcpServe.js +39 -2
- package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
- package/dist/esm/lib/mcp/types.d.ts +30 -0
- package/dist/esm/recorders/observability/commentary/artifactPhrases.d.ts +4 -0
- package/dist/esm/recorders/observability/commentary/artifactPhrases.js +9 -0
- package/dist/esm/recorders/observability/commentary/artifactPhrases.js.map +1 -1
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +30 -3
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/esm/recorders/observability/recordRun.d.ts +12 -0
- package/dist/esm/recorders/observability/recordRun.js +17 -1
- package/dist/esm/recorders/observability/recordRun.js.map +1 -1
- package/dist/esm/strategies/attach.js +87 -1
- package/dist/esm/strategies/attach.js.map +1 -1
- package/dist/events/registry.js +2 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/hosting/artifactWire.js +21 -3
- package/dist/hosting/artifactWire.js.map +1 -1
- package/dist/hosting/doorGuard.js +509 -0
- package/dist/hosting/doorGuard.js.map +1 -0
- package/dist/hosting/errors.js +183 -1
- package/dist/hosting/errors.js.map +1 -1
- package/dist/hosting/httpHost.js +218 -4
- package/dist/hosting/httpHost.js.map +1 -1
- package/dist/hosting/index.js +19 -2
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/ingressRecord.js +66 -6
- package/dist/hosting/ingressRecord.js.map +1 -1
- package/dist/hosting/nodeHost.js +11 -1
- package/dist/hosting/nodeHost.js.map +1 -1
- package/dist/hosting/standingAgent.js +359 -48
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/hosting/turnArtifacts.js +130 -0
- package/dist/hosting/turnArtifacts.js.map +1 -0
- package/dist/hosting/types.js +11 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/hosting/webSocketConversation.js +54 -2
- package/dist/hosting/webSocketConversation.js.map +1 -1
- package/dist/integrity/disposition/ledger.js +0 -0
- package/dist/integrity/disposition/ledger.js.map +1 -1
- package/dist/lib/mcp/mcpServe.js +39 -2
- package/dist/lib/mcp/mcpServe.js.map +1 -1
- package/dist/recorders/observability/commentary/artifactPhrases.js +10 -1
- package/dist/recorders/observability/commentary/artifactPhrases.js.map +1 -1
- package/dist/recorders/observability/commentary/commentaryTemplates.js +29 -2
- package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/recorders/observability/recordRun.js +20 -3
- package/dist/recorders/observability/recordRun.js.map +1 -1
- package/dist/strategies/attach.js +87 -1
- package/dist/strategies/attach.js.map +1 -1
- package/dist/types/adapters/hosting/agentCoreA2A.d.ts +14 -1
- package/dist/types/adapters/hosting/agentCoreA2A.d.ts.map +1 -1
- package/dist/types/adapters/hosting/agentcore.d.ts +18 -2
- package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/hosting/foundryResponses.d.ts +15 -1
- package/dist/types/adapters/hosting/foundryResponses.d.ts.map +1 -1
- package/dist/types/adapters/observability/agentcore.d.ts +17 -5
- package/dist/types/adapters/observability/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/observability/audit.d.ts +6 -2
- package/dist/types/adapters/observability/audit.d.ts.map +1 -1
- package/dist/types/adapters/observability/otel.d.ts +240 -11
- package/dist/types/adapters/observability/otel.d.ts.map +1 -1
- package/dist/types/artifacts/capability.d.ts +3 -1
- package/dist/types/artifacts/capability.d.ts.map +1 -1
- package/dist/types/bridge/eventMeta.d.ts +32 -0
- package/dist/types/bridge/eventMeta.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +18 -5
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts +20 -0
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +11 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/flowchartAsTool.d.ts.map +1 -1
- package/dist/types/core/runbook/runbookAsTool.d.ts.map +1 -1
- package/dist/types/core/toolShownArgs.d.ts +63 -0
- package/dist/types/core/toolShownArgs.d.ts.map +1 -0
- package/dist/types/events/payloads.d.ts +122 -6
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +3 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/events/types.d.ts +7 -0
- package/dist/types/events/types.d.ts.map +1 -1
- package/dist/types/hosting/artifactWire.d.ts +10 -2
- package/dist/types/hosting/artifactWire.d.ts.map +1 -1
- package/dist/types/hosting/doorGuard.d.ts +281 -0
- package/dist/types/hosting/doorGuard.d.ts.map +1 -0
- package/dist/types/hosting/errors.d.ts +113 -0
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/hosting/httpHost.d.ts +32 -3
- package/dist/types/hosting/httpHost.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +7 -5
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/ingressRecord.d.ts +64 -10
- package/dist/types/hosting/ingressRecord.d.ts.map +1 -1
- package/dist/types/hosting/nodeHost.d.ts +32 -2
- package/dist/types/hosting/nodeHost.d.ts.map +1 -1
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/hosting/turnArtifacts.d.ts +94 -0
- package/dist/types/hosting/turnArtifacts.d.ts.map +1 -0
- package/dist/types/hosting/types.d.ts +196 -3
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/hosting/webSocketConversation.d.ts +15 -1
- package/dist/types/hosting/webSocketConversation.d.ts.map +1 -1
- package/dist/types/integrity/disposition/ledger.d.ts +8 -0
- package/dist/types/integrity/disposition/ledger.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
- package/dist/types/lib/mcp/types.d.ts +30 -0
- package/dist/types/lib/mcp/types.d.ts.map +1 -1
- package/dist/types/recorders/observability/commentary/artifactPhrases.d.ts +4 -0
- package/dist/types/recorders/observability/commentary/artifactPhrases.d.ts.map +1 -1
- package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordRun.d.ts +12 -0
- package/dist/types/recorders/observability/recordRun.d.ts.map +1 -1
- package/dist/types/strategies/attach.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* hosting/doorGuard — what a request has to be before any handler sees it.
|
|
4
|
+
*
|
|
5
|
+
* const guard = doorGuard({ name: 'auth', allowedHosts: ['neo.corp.example'] });
|
|
6
|
+
* const refusal = guard.check(req); // an IncomingMessage works as-is
|
|
7
|
+
* if (refusal) return answer(refusal.status, refusal.message, refusal.code);
|
|
8
|
+
*
|
|
9
|
+
* ── The threat, in one paragraph ────────────────────────────────────────────
|
|
10
|
+
* A door with no verifier, reachable only inside a company network, looks safe
|
|
11
|
+
* because the network is the fence. It is not: every person inside the fence
|
|
12
|
+
* runs a browser, and every web page they open can make that browser send
|
|
13
|
+
* requests to the door FROM INSIDE. Three ways, all live before this file:
|
|
14
|
+
*
|
|
15
|
+
* 1. **A forged request (CSRF).** A page on any site can make the browser
|
|
16
|
+
* POST a JSON-shaped body as `text/plain` (or as a form, or with no
|
|
17
|
+
* content type at all) without asking the server first — a CORS "simple"
|
|
18
|
+
* request. The door parsed it as JSON and ran a turn: model budget spent,
|
|
19
|
+
* tools called, a conversation stored. The attacker cannot read the reply;
|
|
20
|
+
* they do not need to.
|
|
21
|
+
* 2. **DNS rebinding.** A page on an attacker's domain re-points its OWN name
|
|
22
|
+
* at the door's address. The browser now treats the attacker's page as
|
|
23
|
+
* same-origin with the door, so it may send anything and READ the answer.
|
|
24
|
+
* 3. **A cross-site WebSocket.** A WebSocket is not bound by the same-origin
|
|
25
|
+
* policy at all; any page can open one, and only the server can say no.
|
|
26
|
+
*
|
|
27
|
+
* ── The rules, one owner ────────────────────────────────────────────────────
|
|
28
|
+
* `check()` judges a request that CHANGES something — every method but GET,
|
|
29
|
+
* HEAD and OPTIONS, plus every WebSocket upgrade (a GET that opens a channel):
|
|
30
|
+
*
|
|
31
|
+
* - **Host** (with `allowedHosts` set, or defaulted to the loopback names on
|
|
32
|
+
* a loopback bind; judged on EVERY method): a name this door was not
|
|
33
|
+
* configured for is refused, 421. First, because under rebinding the other
|
|
34
|
+
* two checks pass — the Host header, which no page can set, is the one
|
|
35
|
+
* fact that still names the attacker. `X-Forwarded-Host` is never read for
|
|
36
|
+
* it: a rebinding page is same-origin and may set that header itself.
|
|
37
|
+
* - **Origin**: a browser request from a page this door does not allow is
|
|
38
|
+
* refused, 403 — including `Origin: null`. A request WITHOUT an Origin is a
|
|
39
|
+
* script or a server (browsers always send one on these requests) and is
|
|
40
|
+
* not judged by it; that is what keeps every non-browser client working.
|
|
41
|
+
* - **Fetch metadata**, as defence in depth: a request the browser itself
|
|
42
|
+
* marked `Sec-Fetch-Site: cross-site` is refused (403) unless its Origin is
|
|
43
|
+
* one `allowedOrigins` LISTS — so a proxy that strips `Origin` but forwards
|
|
44
|
+
* `Sec-Fetch-*` still cannot let a forged request through. For a WebSocket
|
|
45
|
+
* handshake these two are the whole defence: the browser API cannot set a
|
|
46
|
+
* header, so there is no preflight to force.
|
|
47
|
+
* - **Content type** (not for an upgrade — it has no body): anything but
|
|
48
|
+
* `application/json` is refused, 415. A browser must ask first (a
|
|
49
|
+
* preflight, which this host never approves) before it sends that type
|
|
50
|
+
* across origins, so requiring it makes a forged request one the browser
|
|
51
|
+
* refuses to send. It is the same property a required custom header buys
|
|
52
|
+
* (RFC 10017 §6.1.3.3.2), without breaking every JSON client that already
|
|
53
|
+
* sends the header and no other.
|
|
54
|
+
*
|
|
55
|
+
* `checkSessionId()` is the fourth bound, and it is not about browsers: a
|
|
56
|
+
* session id is caller data that rides every stored row, log line and trace
|
|
57
|
+
* span of a conversation, so a door refuses one over
|
|
58
|
+
* {@link MAX_SESSION_ID_LENGTH} or carrying a control character.
|
|
59
|
+
*
|
|
60
|
+
* Where it runs: `httpHost` calls `check()` on every request to its request
|
|
61
|
+
* door and on every conversation upgrade, and `checkSessionId()` on the id each
|
|
62
|
+
* dialect reads. An application's OWN routes beside the door (a sign-in route
|
|
63
|
+
* on `onUnhandled`, say) are the application's, and arrive untouched — so this
|
|
64
|
+
* is exported for them to call, and the rule keeps one spelling.
|
|
65
|
+
*
|
|
66
|
+
* Pure: no socket, no clock, no I/O. The design note is
|
|
67
|
+
* `docs/design/2026-09-door-hardening.md`.
|
|
68
|
+
*/
|
|
69
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
|
+
exports.warnAllowedHostsUnset = exports.warnBrowserRulesOff = exports.platformFrontedDoor = exports.isLoopbackBind = exports.loopbackAllowedHosts = exports.checkSessionId = exports.doorGuard = exports.MAX_SESSION_ID_LENGTH = void 0;
|
|
71
|
+
const errors_js_1 = require("./errors.js");
|
|
72
|
+
/**
|
|
73
|
+
* The longest session id any door carries, in UTF-16 code units — JavaScript's
|
|
74
|
+
* own `string.length`.
|
|
75
|
+
*
|
|
76
|
+
* 400 is the width the reference SQL session store gives its `session_id`
|
|
77
|
+
* column (`NVARCHAR(400)`, which counts the same units), so no id this door
|
|
78
|
+
* admits is one a store refuses AFTER the model was paid for. The id formats in
|
|
79
|
+
* use fit with room to spare — a UUID is 36 — and there is deliberately no
|
|
80
|
+
* knob: a correlation handle wider than this is not one anybody needs.
|
|
81
|
+
*/
|
|
82
|
+
exports.MAX_SESSION_ID_LENGTH = 400;
|
|
83
|
+
/** Methods that change nothing, and so are not judged — the ruling's GET/HEAD/OPTIONS. */
|
|
84
|
+
const SAFE_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']);
|
|
85
|
+
/**
|
|
86
|
+
* Build a guard. Configuration a door could only ever misread is refused HERE,
|
|
87
|
+
* at construction, by name — never discovered as a mystery 403 in production.
|
|
88
|
+
*/
|
|
89
|
+
function doorGuard(options) {
|
|
90
|
+
const { name } = options;
|
|
91
|
+
const origins = readAllowedOrigins(name, options.allowedOrigins);
|
|
92
|
+
const defaulted = options.allowedHosts === undefined ? loopbackAllowedHosts(options.bindHost) : undefined;
|
|
93
|
+
const hosts = readAllowedHosts(name, options.allowedHosts ?? defaulted);
|
|
94
|
+
const hostRule = defaulted === undefined ? 'listed' : 'loopback-default';
|
|
95
|
+
const requireJson = readRequireJson(name, options.requireJsonContentType);
|
|
96
|
+
return {
|
|
97
|
+
allowedHostsUnset: options.allowedHosts === undefined && defaulted === undefined,
|
|
98
|
+
browserRulesOff: origins === 'any' && !requireJson,
|
|
99
|
+
check(request) {
|
|
100
|
+
const { headers } = request;
|
|
101
|
+
if (hosts !== 'any' && !hostAllowed(hosts, headerOf(headers, 'host'))) {
|
|
102
|
+
return new errors_js_1.HostNotAllowedError(name, hostRule);
|
|
103
|
+
}
|
|
104
|
+
const method = (request.method ?? '').toUpperCase();
|
|
105
|
+
const carriesBody = !SAFE_METHODS.has(method);
|
|
106
|
+
const upgrade = isWebSocketUpgrade(headers);
|
|
107
|
+
if (!carriesBody && !upgrade)
|
|
108
|
+
return undefined;
|
|
109
|
+
const browser = browserVerdict(origins, headers, upgrade);
|
|
110
|
+
if (browser !== undefined)
|
|
111
|
+
return new errors_js_1.OriginNotAllowedError(name, browser);
|
|
112
|
+
if (requireJson && carriesBody && !isJson(headerOf(headers, 'content-type'))) {
|
|
113
|
+
return new errors_js_1.UnsupportedMediaTypeError(name);
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
exports.doorGuard = doorGuard;
|
|
120
|
+
/**
|
|
121
|
+
* What the BROWSER said about where this request came from, judged against the
|
|
122
|
+
* origin rule — or `undefined` when it may pass.
|
|
123
|
+
*
|
|
124
|
+
* Two facts, in order. `Origin` first: present and not allowed is a refusal.
|
|
125
|
+
* Then Fetch metadata, as defence in depth: a request the browser itself
|
|
126
|
+
* marked `Sec-Fetch-Site: cross-site` is refused unless its Origin is one
|
|
127
|
+
* `allowedOrigins` LISTS — which catches the request whose `Origin` a proxy
|
|
128
|
+
* stripped while `Sec-Fetch-Site` rode through. Neither header can be set by a
|
|
129
|
+
* page, and a request carrying neither is not a browser's.
|
|
130
|
+
*
|
|
131
|
+
* One more, for a WebSocket upgrade only: a browser ALWAYS sends `Origin` on a
|
|
132
|
+
* handshake, and with it `Sec-Fetch-Site`, so a handshake carrying
|
|
133
|
+
* `Sec-Fetch-Site` but no `Origin` is a browser's with its Origin stripped —
|
|
134
|
+
* refused whatever the site says, because a handshake has no content type and
|
|
135
|
+
* no preflight to fall back on. `Sec-Fetch-Site` and not any `Sec-Fetch-*`:
|
|
136
|
+
* Node's own `WebSocket` client sends `Sec-Fetch-Mode: websocket` and no
|
|
137
|
+
* Origin, and it is not a browser page.
|
|
138
|
+
*/
|
|
139
|
+
function browserVerdict(rule, headers, upgrade) {
|
|
140
|
+
if (rule === 'any')
|
|
141
|
+
return undefined;
|
|
142
|
+
const origin = headerOf(headers, 'origin');
|
|
143
|
+
const listed = rule !== 'same-host';
|
|
144
|
+
if (origin !== undefined) {
|
|
145
|
+
if (!originAllowed(rule, origin, headers))
|
|
146
|
+
return listed ? 'listed' : 'same-host';
|
|
147
|
+
// An origin the deployment LISTED may be on another site by design.
|
|
148
|
+
if (listed)
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
else if (upgrade && headerOf(headers, 'sec-fetch-site') !== undefined) {
|
|
152
|
+
return 'fetch-metadata';
|
|
153
|
+
}
|
|
154
|
+
const site = headerOf(headers, 'sec-fetch-site');
|
|
155
|
+
return site?.trim().toLowerCase() === 'cross-site' ? 'fetch-metadata' : undefined;
|
|
156
|
+
}
|
|
157
|
+
/** Visible ASCII, `!` (0x21) to `~` (0x7E) — nothing else, from any field. */
|
|
158
|
+
const VISIBLE_ASCII = /^[\x21-\x7e]+$/;
|
|
159
|
+
/**
|
|
160
|
+
* The session-id bound — `undefined` for an id a door may carry (or none).
|
|
161
|
+
*
|
|
162
|
+
* A session id is one to {@link MAX_SESSION_ID_LENGTH} characters of VISIBLE
|
|
163
|
+
* ASCII (0x21–0x7E) — the rule MCP gives its own session ids. Why ASCII and
|
|
164
|
+
* not "Unicode minus the dangerous parts":
|
|
165
|
+
*
|
|
166
|
+
* - **One id, one byte string, from every field.** Node reads a header value
|
|
167
|
+
* as latin1 and a JSON body as UTF-8, so `café` in `x-session-id` and `café`
|
|
168
|
+
* in the body were two different stored conversations. With ASCII only,
|
|
169
|
+
* the two readings cannot differ.
|
|
170
|
+
* - **Nothing a log, a span or a store can reinterpret.** Controls, line and
|
|
171
|
+
* paragraph separators (U+2028/9), bidi overrides (U+202E), zero-width
|
|
172
|
+
* characters and lone surrogates (which any UTF-8 store rewrites to U+FFFD,
|
|
173
|
+
* merging two ids) are all outside it — no list of exceptions to keep up.
|
|
174
|
+
* - Every id format in use already fits: UUIDs, platform runtime ids, `conv_…`.
|
|
175
|
+
*
|
|
176
|
+
* The empty string is refused too: every caller that sent `""` shared ONE
|
|
177
|
+
* conversation. The length is judged first, so an over-long id costs one
|
|
178
|
+
* comparison — after a body read that `maxBodyBytes` bounds.
|
|
179
|
+
*/
|
|
180
|
+
function checkSessionId(sessionId, hostName) {
|
|
181
|
+
if (sessionId === undefined)
|
|
182
|
+
return undefined;
|
|
183
|
+
if (sessionId.length === 0) {
|
|
184
|
+
return new errors_js_1.InvalidSessionIdError('empty', hostName, 0, exports.MAX_SESSION_ID_LENGTH);
|
|
185
|
+
}
|
|
186
|
+
if (sessionId.length > exports.MAX_SESSION_ID_LENGTH) {
|
|
187
|
+
return new errors_js_1.InvalidSessionIdError('too-long', hostName, sessionId.length, exports.MAX_SESSION_ID_LENGTH);
|
|
188
|
+
}
|
|
189
|
+
if (!VISIBLE_ASCII.test(sessionId)) {
|
|
190
|
+
return new errors_js_1.InvalidSessionIdError('invalid-character', hostName, sessionId.length, exports.MAX_SESSION_ID_LENGTH);
|
|
191
|
+
}
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
exports.checkSessionId = checkSessionId;
|
|
195
|
+
/**
|
|
196
|
+
* The names a LOOPBACK-bound door answers to when `allowedHosts` was not set —
|
|
197
|
+
* `localhost`, `127.0.0.1`, `[::1]` (and the bound address itself when it is
|
|
198
|
+
* another `127.x`), any port: the socket already fixes the port, so a name is
|
|
199
|
+
* all a rebinding page can vary. `undefined` for any other bind.
|
|
200
|
+
*
|
|
201
|
+
* It closes DNS rebinding on the classic victim, a developer's own machine,
|
|
202
|
+
* and the MCP SDK's `createMcpExpressApp` does the same for a localhost bind.
|
|
203
|
+
* What it refuses that is legitimate, stated rather than discovered:
|
|
204
|
+
*
|
|
205
|
+
* - **A reverse proxy on the same machine that forwards the PUBLIC name** in
|
|
206
|
+
* `Host` (nginx `proxy_set_header Host $host`) — the common case, and the
|
|
207
|
+
* recommended "bind 127.0.0.1 behind nginx" setup. The proxy's requests
|
|
208
|
+
* arrive on loopback carrying `neo.corp.example`, which the socket cannot
|
|
209
|
+
* tell from a rebinding page. List that name in `allowedHosts`; the 421
|
|
210
|
+
* says so, naming this default (`HostNotAllowedError` · `rule`).
|
|
211
|
+
* - A hosts-file alias for a loopback address — the same fix.
|
|
212
|
+
*
|
|
213
|
+
* Both fail loudly and in the safe direction, and the fix is the option such
|
|
214
|
+
* a deployment should set anyway.
|
|
215
|
+
*
|
|
216
|
+
* @internal — `doorGuard` asks it with the address a door bound
|
|
217
|
+
* (`DoorGuardOptions.bindHost`).
|
|
218
|
+
*/
|
|
219
|
+
function loopbackAllowedHosts(bindHost) {
|
|
220
|
+
if (!isLoopbackBind(bindHost))
|
|
221
|
+
return undefined;
|
|
222
|
+
const names = ['localhost', '127.0.0.1', '[::1]'];
|
|
223
|
+
const literal = (bindHost ?? '').trim().toLowerCase();
|
|
224
|
+
if (/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(literal) && literal !== '127.0.0.1') {
|
|
225
|
+
names.push(literal);
|
|
226
|
+
}
|
|
227
|
+
return names;
|
|
228
|
+
}
|
|
229
|
+
exports.loopbackAllowedHosts = loopbackAllowedHosts;
|
|
230
|
+
/**
|
|
231
|
+
* `localhost`, any `127.x` literal, and `::1` or `::ffff:127.x` in ANY IPv6
|
|
232
|
+
* spelling (bracketed or not, `0:0:0:0:0:0:0:1`, leading zeros) — IPv6 is
|
|
233
|
+
* canonicalised by the WHATWG URL parser before it is compared.
|
|
234
|
+
*/
|
|
235
|
+
function isLoopbackBind(bindHost) {
|
|
236
|
+
if (bindHost === undefined)
|
|
237
|
+
return false;
|
|
238
|
+
const host = bindHost
|
|
239
|
+
.trim()
|
|
240
|
+
.toLowerCase()
|
|
241
|
+
.replace(/^\[|\]$/g, '');
|
|
242
|
+
if (host === 'localhost' || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host))
|
|
243
|
+
return true;
|
|
244
|
+
if (!host.includes(':'))
|
|
245
|
+
return false;
|
|
246
|
+
const canonical = parseUrl(`http://[${host}]`)?.hostname;
|
|
247
|
+
// `::ffff:127.x.y.z` canonicalises to `[::ffff:7fxx:xxxx]`.
|
|
248
|
+
return canonical === '[::1]' || /^\[::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}\]$/.test(canonical ?? '');
|
|
249
|
+
}
|
|
250
|
+
exports.isLoopbackBind = isLoopbackBind;
|
|
251
|
+
/**
|
|
252
|
+
* The cross-site rules for a door a PLATFORM fronts — the hosted-runtime
|
|
253
|
+
* adapters' defaults, with whatever the deployment set kept as given.
|
|
254
|
+
*
|
|
255
|
+
* Exempt by default, and why, once for every such adapter: the platform's own
|
|
256
|
+
* front door is the only way to the container's port, and the credential it
|
|
257
|
+
* demands is one no web page holds (a signed request, a bearer the caller
|
|
258
|
+
* attaches) — so a forged browser request cannot authenticate and no browser
|
|
259
|
+
* can reach the port to rebind it. The browser rules would protect nothing
|
|
260
|
+
* there, and which headers the platform forwards (its content type, Origin,
|
|
261
|
+
* Host) is not a fact this library has verified; enforcing them could refuse
|
|
262
|
+
* the platform's own forwarding. Any rule the deployment sets is enforced
|
|
263
|
+
* exactly as on every other door. The session-id bound is NOT exempt: it is
|
|
264
|
+
* not about browsers.
|
|
265
|
+
*
|
|
266
|
+
* @internal — the adapters' shared default, not a public setting.
|
|
267
|
+
*/
|
|
268
|
+
function platformFrontedDoor(options, bindHost) {
|
|
269
|
+
// A LOOPBACK bind is by definition not behind the platform's front door — it
|
|
270
|
+
// is a laptop or a self-hosted box, the classic victim — so it keeps every
|
|
271
|
+
// default a plain `httpHost` has (and the loopback names for `allowedHosts`).
|
|
272
|
+
if (isLoopbackBind(bindHost)) {
|
|
273
|
+
return {
|
|
274
|
+
...(options.allowedOrigins !== undefined && { allowedOrigins: options.allowedOrigins }),
|
|
275
|
+
...(options.allowedHosts !== undefined && { allowedHosts: options.allowedHosts }),
|
|
276
|
+
...(options.requireJsonContentType !== undefined && {
|
|
277
|
+
requireJsonContentType: options.requireJsonContentType,
|
|
278
|
+
}),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
allowedOrigins: options.allowedOrigins ?? 'any',
|
|
283
|
+
allowedHosts: options.allowedHosts ?? 'any',
|
|
284
|
+
requireJsonContentType: options.requireJsonContentType ?? false,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
exports.platformFrontedDoor = platformFrontedDoor;
|
|
288
|
+
const warnedHostNames = new Set();
|
|
289
|
+
const warnedRulesOff = new Set();
|
|
290
|
+
/**
|
|
291
|
+
* Said once per host name per process, at boot, when a door serves with the
|
|
292
|
+
* browser rules OFF (`allowedOrigins: 'any'` and `requireJsonContentType:
|
|
293
|
+
* false` — the hosted-runtime adapters' default on a non-loopback bind). Those
|
|
294
|
+
* rules are off because a platform's front door is supposed to be the only way
|
|
295
|
+
* in; a self-hoster on `0.0.0.0` needs to hear that it is not.
|
|
296
|
+
*
|
|
297
|
+
* @internal — the words have one owner; `httpHost` decides when.
|
|
298
|
+
*/
|
|
299
|
+
function warnBrowserRulesOff(hostName) {
|
|
300
|
+
if (warnedRulesOff.has(hostName))
|
|
301
|
+
return;
|
|
302
|
+
warnedRulesOff.add(hostName);
|
|
303
|
+
// eslint-disable-next-line no-console
|
|
304
|
+
console.warn(`[hosting] the '${hostName}' host serves with the browser rules OFF (allowedOrigins: ` +
|
|
305
|
+
`'any', requireJsonContentType: false): any web page a user opens can make their ` +
|
|
306
|
+
`browser send it requests. That is right only when the one way to this port is a ` +
|
|
307
|
+
`platform front door that demands its own credential. Anywhere else — a ` +
|
|
308
|
+
`laptop, a self-hosted VM — set allowedOrigins, allowedHosts and ` +
|
|
309
|
+
`requireJsonContentType: true, or bind to 127.0.0.1.`);
|
|
310
|
+
}
|
|
311
|
+
exports.warnBrowserRulesOff = warnBrowserRulesOff;
|
|
312
|
+
/**
|
|
313
|
+
* The staged default, said out loud: a host serving with `allowedHosts` unset
|
|
314
|
+
* prints this ONCE per host name per process, at boot. A name is how every
|
|
315
|
+
* refusal identifies a host, so two hosts sharing one are one door to anyone
|
|
316
|
+
* reading the log — and once is what keeps a warning from becoming noise.
|
|
317
|
+
*
|
|
318
|
+
* @internal — the words have one owner; `httpHost` decides when.
|
|
319
|
+
*/
|
|
320
|
+
function warnAllowedHostsUnset(hostName) {
|
|
321
|
+
if (warnedHostNames.has(hostName))
|
|
322
|
+
return;
|
|
323
|
+
warnedHostNames.add(hostName);
|
|
324
|
+
// eslint-disable-next-line no-console
|
|
325
|
+
console.warn(`[hosting] the '${hostName}' host answers a request for ANY Host name, because ` +
|
|
326
|
+
`allowedHosts is not set. A web page on another domain can re-point its own name at ` +
|
|
327
|
+
`this server's address (DNS rebinding) and then read this door's answers as if it were ` +
|
|
328
|
+
`the app itself — the Origin check cannot tell, because the page's Origin and the ` +
|
|
329
|
+
`request's Host both carry the attacker's name. Set allowedHosts: ['<the name people ` +
|
|
330
|
+
`use to reach it>'] to refuse every other name (421), or allowedHosts: 'any' to state ` +
|
|
331
|
+
`that no browser can reach this port. Serving continues: in this release an unset ` +
|
|
332
|
+
`list is a warning, not a refusal, so existing deployments keep starting.`);
|
|
333
|
+
}
|
|
334
|
+
exports.warnAllowedHostsUnset = warnAllowedHostsUnset;
|
|
335
|
+
function readAllowedOrigins(name, value) {
|
|
336
|
+
if (value === undefined)
|
|
337
|
+
return 'same-host';
|
|
338
|
+
if (value === 'any')
|
|
339
|
+
return 'any';
|
|
340
|
+
if (!Array.isArray(value)) {
|
|
341
|
+
throw new TypeError(`[hosting] ${name}: allowedOrigins must be a list of origins ` +
|
|
342
|
+
`(['https://app.example']) or 'any'; received ${describe(value)}.`);
|
|
343
|
+
}
|
|
344
|
+
const origins = new Set();
|
|
345
|
+
for (const entry of value)
|
|
346
|
+
origins.add(readOriginEntry(name, entry));
|
|
347
|
+
return origins;
|
|
348
|
+
}
|
|
349
|
+
function readOriginEntry(name, entry) {
|
|
350
|
+
const text = typeof entry === 'string' ? entry.trim() : '';
|
|
351
|
+
if (text === '*') {
|
|
352
|
+
throw new TypeError(`[hosting] ${name}: allowedOrigins cannot contain '*'. To turn the Origin check off, ` +
|
|
353
|
+
`pass allowedOrigins: 'any' — a word, so nobody reads it as a wildcard pattern.`);
|
|
354
|
+
}
|
|
355
|
+
if (text.toLowerCase() === 'null') {
|
|
356
|
+
throw new TypeError(`[hosting] ${name}: allowedOrigins cannot contain 'null'. It is the origin of every ` +
|
|
357
|
+
`sandboxed frame and data: page on every site, so allowing it would allow them all.`);
|
|
358
|
+
}
|
|
359
|
+
const url = parseUrl(text);
|
|
360
|
+
if (url === undefined || url.origin === 'null' || !bareAuthority(url)) {
|
|
361
|
+
throw new TypeError(`[hosting] ${name}: allowedOrigins entry ${JSON.stringify(entry)} is not an origin. ` +
|
|
362
|
+
`An origin is scheme://host[:port] with nothing after it — 'https://app.example'.`);
|
|
363
|
+
}
|
|
364
|
+
return url.origin;
|
|
365
|
+
}
|
|
366
|
+
function readAllowedHosts(name, value) {
|
|
367
|
+
if (value === undefined || value === 'any')
|
|
368
|
+
return 'any';
|
|
369
|
+
if (!Array.isArray(value)) {
|
|
370
|
+
throw new TypeError(`[hosting] ${name}: allowedHosts must be a list of host names ` +
|
|
371
|
+
`(['app.example']) or 'any'; received ${describe(value)}.`);
|
|
372
|
+
}
|
|
373
|
+
if (value.length === 0) {
|
|
374
|
+
throw new TypeError(`[hosting] ${name}: allowedHosts is an empty list, so every request would be refused — ` +
|
|
375
|
+
`nothing could ever be served. List the names this door is reached by, or pass 'any'.`);
|
|
376
|
+
}
|
|
377
|
+
return value.map((entry) => readHostEntry(name, entry));
|
|
378
|
+
}
|
|
379
|
+
function readHostEntry(name, entry) {
|
|
380
|
+
const parsed = typeof entry === 'string' ? parseAuthority(entry) : undefined;
|
|
381
|
+
if (parsed === undefined) {
|
|
382
|
+
throw new TypeError(`[hosting] ${name}: allowedHosts entry ${JSON.stringify(entry)} is not a host name. ` +
|
|
383
|
+
`Expected a name with an optional port — 'app.example', 'app.example:8443', or an ` +
|
|
384
|
+
`IPv6 address in brackets, '[::1]'.`);
|
|
385
|
+
}
|
|
386
|
+
return parsed;
|
|
387
|
+
}
|
|
388
|
+
function readRequireJson(name, value) {
|
|
389
|
+
if (value === undefined)
|
|
390
|
+
return true;
|
|
391
|
+
if (typeof value !== 'boolean') {
|
|
392
|
+
throw new TypeError(`[hosting] ${name}: requireJsonContentType must be true or false; received ` +
|
|
393
|
+
`${describe(value)}.`);
|
|
394
|
+
}
|
|
395
|
+
return value;
|
|
396
|
+
}
|
|
397
|
+
// ─── Judging a request (per request) ─────────────────────────────────
|
|
398
|
+
function hostAllowed(entries, host) {
|
|
399
|
+
const seen = host === undefined ? undefined : parseAuthority(host);
|
|
400
|
+
if (seen === undefined)
|
|
401
|
+
return false;
|
|
402
|
+
return entries.some((entry) => entry.hostname === seen.hostname && (entry.port === undefined || entry.port === seen.port));
|
|
403
|
+
}
|
|
404
|
+
function originAllowed(rule, origin, headers) {
|
|
405
|
+
const url = parseUrl(origin.trim());
|
|
406
|
+
if (url === undefined || url.origin === 'null')
|
|
407
|
+
return false;
|
|
408
|
+
if (rule !== 'same-host')
|
|
409
|
+
return rule.has(url.origin);
|
|
410
|
+
// The page's own name, as the browser addressed the door: the Host header,
|
|
411
|
+
// or what a proxy in front recorded before rewriting it. A cross-site page
|
|
412
|
+
// cannot set X-Forwarded-Host without a preflight this host never approves.
|
|
413
|
+
//
|
|
414
|
+
// A Host with no port is read under the scheme the client actually used
|
|
415
|
+
// when a proxy said so (`X-Forwarded-Proto`), and under the Origin's scheme
|
|
416
|
+
// otherwise — so `http://name` (port 80) and `https://name` (port 443) are
|
|
417
|
+
// two origins, as they are to a browser.
|
|
418
|
+
const own = authorityKey(url);
|
|
419
|
+
const scheme = forwardedProto(headers) ?? url.protocol;
|
|
420
|
+
const candidates = [
|
|
421
|
+
headerOf(headers, 'host'),
|
|
422
|
+
...(headerOf(headers, 'x-forwarded-host')?.split(',') ?? []),
|
|
423
|
+
];
|
|
424
|
+
return candidates.some((candidate) => {
|
|
425
|
+
const parsed = candidate === undefined ? undefined : parseUrl(`${scheme}//${candidate.trim()}`);
|
|
426
|
+
return parsed !== undefined && bareAuthority(parsed) && authorityKey(parsed) === own;
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
/** The first `X-Forwarded-Proto` entry, when it is `http` or `https`. */
|
|
430
|
+
function forwardedProto(headers) {
|
|
431
|
+
const first = headerOf(headers, 'x-forwarded-proto')?.split(',')[0]?.trim().toLowerCase();
|
|
432
|
+
return first === 'http' || first === 'https' ? `${first}:` : undefined;
|
|
433
|
+
}
|
|
434
|
+
/** The media type's essence is exactly `application/json` — never a `+json` cousin. */
|
|
435
|
+
function isJson(contentType) {
|
|
436
|
+
if (contentType === undefined)
|
|
437
|
+
return false;
|
|
438
|
+
const essence = contentType.split(';', 1)[0] ?? '';
|
|
439
|
+
return essence.trim().toLowerCase() === 'application/json';
|
|
440
|
+
}
|
|
441
|
+
function isWebSocketUpgrade(headers) {
|
|
442
|
+
const upgrade = headerOf(headers, 'upgrade');
|
|
443
|
+
if (upgrade === undefined)
|
|
444
|
+
return false;
|
|
445
|
+
return upgrade
|
|
446
|
+
.toLowerCase()
|
|
447
|
+
.split(',')
|
|
448
|
+
.some((token) => token.trim() === 'websocket');
|
|
449
|
+
}
|
|
450
|
+
// ─── Small parsers ───────────────────────────────────────────────────
|
|
451
|
+
/** One header's value, case-insensitively; repeated values joined as node joins them. */
|
|
452
|
+
function headerOf(headers, name) {
|
|
453
|
+
const direct = headers[name];
|
|
454
|
+
if (direct !== undefined)
|
|
455
|
+
return joined(direct);
|
|
456
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
457
|
+
if (key.toLowerCase() === name && value !== undefined)
|
|
458
|
+
return joined(value);
|
|
459
|
+
}
|
|
460
|
+
return undefined;
|
|
461
|
+
}
|
|
462
|
+
function joined(value) {
|
|
463
|
+
return typeof value === 'string' ? value : value.join(', ');
|
|
464
|
+
}
|
|
465
|
+
function parseUrl(text) {
|
|
466
|
+
try {
|
|
467
|
+
return new URL(text);
|
|
468
|
+
}
|
|
469
|
+
catch {
|
|
470
|
+
return undefined;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/** A URL that is nothing but scheme and authority — no credentials, path, query or fragment. */
|
|
474
|
+
function bareAuthority(url) {
|
|
475
|
+
return (url.username === '' &&
|
|
476
|
+
url.password === '' &&
|
|
477
|
+
url.pathname === '/' &&
|
|
478
|
+
url.search === '' &&
|
|
479
|
+
url.hash === '');
|
|
480
|
+
}
|
|
481
|
+
/** A `host[:port]` value as a {@link HostEntry}, or `undefined` when it is anything more. */
|
|
482
|
+
function parseAuthority(value) {
|
|
483
|
+
const url = parseUrl(`http://${value.trim()}`);
|
|
484
|
+
if (url === undefined || !bareAuthority(url) || url.hostname === '')
|
|
485
|
+
return undefined;
|
|
486
|
+
const hostname = withoutTrailingDot(url.hostname);
|
|
487
|
+
return url.port === '' ? { hostname } : { hostname, port: url.port };
|
|
488
|
+
}
|
|
489
|
+
/** Host and EFFECTIVE port as one comparable string — a default port spelled out. */
|
|
490
|
+
function authorityKey(url) {
|
|
491
|
+
const hostname = withoutTrailingDot(url.hostname);
|
|
492
|
+
const port = url.port !== '' ? url.port : DEFAULT_PORT[url.protocol] ?? '';
|
|
493
|
+
return `${hostname}:${port}`;
|
|
494
|
+
}
|
|
495
|
+
const DEFAULT_PORT = {
|
|
496
|
+
'http:': '80',
|
|
497
|
+
'https:': '443',
|
|
498
|
+
'ws:': '80',
|
|
499
|
+
'wss:': '443',
|
|
500
|
+
};
|
|
501
|
+
function withoutTrailingDot(hostname) {
|
|
502
|
+
return hostname.endsWith('.') ? hostname.slice(0, -1) : hostname;
|
|
503
|
+
}
|
|
504
|
+
function describe(value) {
|
|
505
|
+
if (typeof value === 'string')
|
|
506
|
+
return `the string ${JSON.stringify(value)}`;
|
|
507
|
+
return Array.isArray(value) ? 'an array' : typeof value;
|
|
508
|
+
}
|
|
509
|
+
//# sourceMappingURL=doorGuard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doorGuard.js","sourceRoot":"","sources":["../../src/hosting/doorGuard.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;;;AAEH,2CAMqB;AAErB;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,GAAG,CAAC;AAoHzC,0FAA0F;AAC1F,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAE9E;;;GAGG;AACH,SAAgB,SAAS,CAAC,OAAyB;IACjD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI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