@rebilder/agent-readability 0.1.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.
@@ -0,0 +1,67 @@
1
+ import { Limiter, ProbePolicy, ProbeOptions, ProbeOutcome } from './index.cjs';
2
+ import { c as ArsRuleset } from '../types-B2FhQ1YC.cjs';
3
+
4
+ /**
5
+ * probe/local.ts — `"./probe/local"`. Private hosts and plain http, and NOTHING
6
+ * that can be reached over HTTP.
7
+ *
8
+ * WHY THIS IS A SEPARATE ENTRY POINT THAT THROWS ON IMPORT, RATHER THAN A FLAG.
9
+ *
10
+ * The obvious design is `probe(url, { allowPrivateHosts: true })`. It is wrong,
11
+ * and the reason is worth writing down because the wrong version looks fine in
12
+ * review. `ProbePolicy` is a plain object that gets built once and reused. A
13
+ * boolean on it is a boolean somebody will set to `true` — not maliciously, but
14
+ * because they are wiring a new route, the local config already works, and
15
+ * copying it is the obvious move. The moment that happens, an SSRF guard exists
16
+ * in the codebase and is switched off in production, and nothing about the diff
17
+ * looks like a security change.
18
+ *
19
+ * The concrete failure this prevents: `@rebilder/mcp-server` runs on a
20
+ * developer's machine, inside their network, driven by a model whose context
21
+ * contains web pages we did not write. "Check http://169.254.169.254/ for me"
22
+ * arriving as text inside a scraped page is not a hypothetical — it is the
23
+ * standard prompt-injection payload, and a company whose entire product is *what
24
+ * agents read* cannot ship the tool that fetches it on request.
25
+ *
26
+ * So the permission is a capability, held three ways at once:
27
+ * 1. It is a DIFFERENT MODULE. `probeStrict` cannot reach it; nothing that
28
+ * imports `"./probe"` gets it transitively.
29
+ * 2. It THROWS AT IMPORT TIME unless the process was started with
30
+ * `--allow-private`. A process argument is not configuration: a serverless
31
+ * handler's argv is set by the platform, not by our env file or our JSON,
32
+ * so there is no way to switch this on from a dashboard or a `.env`.
33
+ * 3. It REFUSES OUTRIGHT in a serverless/edge runtime, flag or no flag. If we
34
+ * are running inside a request handler, the answer is no, and there is no
35
+ * argument to be had about it.
36
+ *
37
+ * The permission is per invocation. `rebilder check --allow-private
38
+ * http://staging.internal.corp` is a thing a developer chose to type on their own
39
+ * machine. It is never a default, never an env var, and never inherited.
40
+ *
41
+ * NOTE ON THE PAIR OF GUARANTEES: the CLI and MCP server ship zero telemetry
42
+ * (CLAUDE.md § Conventions). That is not decoration next to this file — a probe
43
+ * that reaches internal hostnames and a binary that uploads what it found are
44
+ * only safe together as long as the second half stays false.
45
+ */
46
+
47
+ /** The one accepted opt-in. A CLI flag, on purpose: argv is not configuration. */
48
+ declare const ALLOW_PRIVATE_FLAG = "--allow-private";
49
+ /**
50
+ * The local policy: http allowed, non-standard ports allowed, private hosts
51
+ * allowed. Everything else — the streamed byte cap, the redirect limit, the
52
+ * timeout, the politeness limiter, the robots gate — is unchanged, because none
53
+ * of those exist to protect us from ourselves.
54
+ */
55
+ declare function localPolicy(limiter: Limiter, ruleset?: ArsRuleset): ProbePolicy;
56
+ /**
57
+ * Probes a target that may be private, loopback, or plain http.
58
+ *
59
+ * `vantage` defaults to `'self'` rather than `'public'`: someone running this
60
+ * against their own staging host is the operator of that host, and §3.7 says the
61
+ * owner can consent for their own origin. It also means the `rebilder-ars`
62
+ * robots gate does not apply, which is correct — you do not need your own
63
+ * permission to read your own site.
64
+ */
65
+ declare function probeLocal(target: string, policy: ProbePolicy, options?: ProbeOptions): Promise<ProbeOutcome>;
66
+
67
+ export { ALLOW_PRIVATE_FLAG, localPolicy, probeLocal };
@@ -0,0 +1,67 @@
1
+ import { Limiter, ProbePolicy, ProbeOptions, ProbeOutcome } from './index.js';
2
+ import { c as ArsRuleset } from '../types-B2FhQ1YC.js';
3
+
4
+ /**
5
+ * probe/local.ts — `"./probe/local"`. Private hosts and plain http, and NOTHING
6
+ * that can be reached over HTTP.
7
+ *
8
+ * WHY THIS IS A SEPARATE ENTRY POINT THAT THROWS ON IMPORT, RATHER THAN A FLAG.
9
+ *
10
+ * The obvious design is `probe(url, { allowPrivateHosts: true })`. It is wrong,
11
+ * and the reason is worth writing down because the wrong version looks fine in
12
+ * review. `ProbePolicy` is a plain object that gets built once and reused. A
13
+ * boolean on it is a boolean somebody will set to `true` — not maliciously, but
14
+ * because they are wiring a new route, the local config already works, and
15
+ * copying it is the obvious move. The moment that happens, an SSRF guard exists
16
+ * in the codebase and is switched off in production, and nothing about the diff
17
+ * looks like a security change.
18
+ *
19
+ * The concrete failure this prevents: `@rebilder/mcp-server` runs on a
20
+ * developer's machine, inside their network, driven by a model whose context
21
+ * contains web pages we did not write. "Check http://169.254.169.254/ for me"
22
+ * arriving as text inside a scraped page is not a hypothetical — it is the
23
+ * standard prompt-injection payload, and a company whose entire product is *what
24
+ * agents read* cannot ship the tool that fetches it on request.
25
+ *
26
+ * So the permission is a capability, held three ways at once:
27
+ * 1. It is a DIFFERENT MODULE. `probeStrict` cannot reach it; nothing that
28
+ * imports `"./probe"` gets it transitively.
29
+ * 2. It THROWS AT IMPORT TIME unless the process was started with
30
+ * `--allow-private`. A process argument is not configuration: a serverless
31
+ * handler's argv is set by the platform, not by our env file or our JSON,
32
+ * so there is no way to switch this on from a dashboard or a `.env`.
33
+ * 3. It REFUSES OUTRIGHT in a serverless/edge runtime, flag or no flag. If we
34
+ * are running inside a request handler, the answer is no, and there is no
35
+ * argument to be had about it.
36
+ *
37
+ * The permission is per invocation. `rebilder check --allow-private
38
+ * http://staging.internal.corp` is a thing a developer chose to type on their own
39
+ * machine. It is never a default, never an env var, and never inherited.
40
+ *
41
+ * NOTE ON THE PAIR OF GUARANTEES: the CLI and MCP server ship zero telemetry
42
+ * (CLAUDE.md § Conventions). That is not decoration next to this file — a probe
43
+ * that reaches internal hostnames and a binary that uploads what it found are
44
+ * only safe together as long as the second half stays false.
45
+ */
46
+
47
+ /** The one accepted opt-in. A CLI flag, on purpose: argv is not configuration. */
48
+ declare const ALLOW_PRIVATE_FLAG = "--allow-private";
49
+ /**
50
+ * The local policy: http allowed, non-standard ports allowed, private hosts
51
+ * allowed. Everything else — the streamed byte cap, the redirect limit, the
52
+ * timeout, the politeness limiter, the robots gate — is unchanged, because none
53
+ * of those exist to protect us from ourselves.
54
+ */
55
+ declare function localPolicy(limiter: Limiter, ruleset?: ArsRuleset): ProbePolicy;
56
+ /**
57
+ * Probes a target that may be private, loopback, or plain http.
58
+ *
59
+ * `vantage` defaults to `'self'` rather than `'public'`: someone running this
60
+ * against their own staging host is the operator of that host, and §3.7 says the
61
+ * owner can consent for their own origin. It also means the `rebilder-ars`
62
+ * robots gate does not apply, which is correct — you do not need your own
63
+ * permission to read your own site.
64
+ */
65
+ declare function probeLocal(target: string, policy: ProbePolicy, options?: ProbeOptions): Promise<ProbeOutcome>;
66
+
67
+ export { ALLOW_PRIVATE_FLAG, localPolicy, probeLocal };