turva-llms-txt-validator 0.8.1 → 0.8.3
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/README.md +6 -6
- package/dist/bin/cli.js +7 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +73 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,16 +82,16 @@ The two discovery checks return `pass` or `info`. They never change the summary
|
|
|
82
82
|
npx --yes turva-llms-txt-validator example.com --json --strict
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Completed validation returns `{ target, summary, checks }`, where `target` is `https://<host>/llms.txt`. Each check contains `{ id, status, label, detail }`. Read `id` and `status` in a script, because the wording of `detail` can change between versions. The `input-path` check, which reports a path given with the domain and then ignored, also carries `value`, that path cut to 120 characters.
|
|
85
|
+
Completed validation returns `{ target, summary, checks }`, where `target` is `https://<host>/llms.txt`. Each check contains `{ id, status, label, detail }`. Read `id` and `status` in a script, because the wording of `detail` can change between versions. The `input-path` check, which reports a path given with the domain and then ignored, also carries `value`, that path cut to 120 characters. When the address holds an `@` and its masked form does not show that path, the value is `/***`. That happens when a URL parser put user information into the path, as with the backslash in `https://corp.example\erik:secret@host.example`.
|
|
86
86
|
|
|
87
87
|
The validator removes C0 and C1 control characters, bidirectional controls and invisible characters from the `detail` text, which can quote the checked site. The invisible characters are chosen by Unicode class, not from a list: every format character, which is General_Category Cf, every Default_Ignorable_Code_Point and the line and paragraph separators U+2028 and U+2029. That covers the zero-width characters, the left-to-right and right-to-left marks, the Arabic letter mark, the word joiner and the invisible math operators, the soft hyphen, the byte-order mark, the variation selectors, the combining grapheme joiner, the Hangul fillers and the tag characters U+E0000 to U+E007F. Spaces stay: the no-break space and U+2000 to U+200A. The zero-width non-joiner and joiner go too, so a quoted Persian, Malayalam or Devanagari word loses its joining marks and reads without them. The Arabic number signs U+0600 to U+0605 go as well. Until 0.8.0 only the bidi controls and the C0 and C1 controls were removed, and the invisible characters stayed in the text and in the JSON. An emoji sequence in quoted text loses its zero-width joiners and its variation selector: a family emoji reads as its members side by side, a heart written with U+FE0F shows in text style, a keycap sequence loses the selector, and a tag flag shows as its black flag. The emoji themselves, skin tone modifiers, regional indicators and combining marks stay.
|
|
88
88
|
|
|
89
|
-
With `--json`, an invalid domain or a failed fetch returns `{ "error": "...", "target": "..." }` and exits with code `2`. A network error adds `code`, such as `EAI_AGAIN`. An unknown option, a second domain and a missing domain return `{ "error": "..." }` only, with no target, and also exit with code `2`.
|
|
89
|
+
With `--json`, an invalid domain or a failed fetch returns `{ "error": "...", "target": "..." }` and exits with code `2`. A network error adds `code`, such as `EAI_AGAIN`. An unknown option, a second domain and a missing domain return `{ "error": "..." }` only, with no target, and also exit with code `2`. An unknown option is named by its dashes and the letters, digits and dashes after them, and the rest of the argument is not shown, so a target typed with a leading dash, as in `-u:secret@example.com`, gives `unknown option "-u" (the rest of the argument is not shown)`.
|
|
90
90
|
|
|
91
91
|
In an error report the `target` is the address given on the command line. When it parses as a URL with a host, the user name and password are removed and each query value becomes `***`. Other values follow these cases:
|
|
92
92
|
|
|
93
93
|
- In a value such as `user:secret@example.com` or `example.org:8443#a@b`, the part before the colon reads as a URL scheme and no authority follows it, so only `//***` is shown.
|
|
94
|
-
- A value with no scheme and no slash is read as user information when a colon comes before its last `@` and before its first `?` or `#`. So `user_name:secret@example.com` and `user_name:se#cret@example.com` are shown as `***@example.com`. A backslash counts as part of the user name, as in a Windows domain account, so `CORP\erik:se#cret@example.com` is shown as `***@example.com` too. The same reading holds when such a value is a relative redirect target that is resolved against the request address, so the password does not come back in the path of the shown address. There a `?` or `#` before the last `@` shows only `***`, because the text after it could also be read as a query or a fragment. When a `?` or `#` comes before the colon, as in `user?x:secret@example.com`, the text from that character on is masked or cut, so the part before it is shown and the password is not.
|
|
94
|
+
- A value with no scheme and no slash is read as user information when a colon comes before its last `@` and before its first `?` or `#`. So `user_name:secret@example.com` and `user_name:se#cret@example.com` are shown as `***@example.com`. A backslash counts as part of the user name, as in a Windows domain account, so `CORP\erik:se#cret@example.com` is shown as `***@example.com` too. The same reading holds when such a value is a relative redirect target that is resolved against the request address, so the password does not come back in the path of the shown address. When the validator follows such a redirect, the address it reached is shown as its scheme, its host and `/***`, as in `https://example.com/***`, and so is an address reached after it while its `Location` keeps part of the earlier path or query. An address whose `Location` keeps none of it, such as an absolute address or a path from the root, is shown as usual. There a `?` or `#` before the last `@` shows only `***`, because the text after it could also be read as a query or a fragment. When a `?` or `#` comes before the colon, as in `user?x:secret@example.com`, the text from that character on is masked or cut, so the part before it is shown and the password is not.
|
|
95
95
|
- Without that colon, as in `path@2x.png` or an e-mail address, the value is shown as given and holds no password.
|
|
96
96
|
- An address that holds an `@` shows only `***`, with the scheme in front when a slash follows its colon and with no host, when a URL parser and a person would read it differently. That covers a backslash, a `?` or a `#` before the `@` and before any `/`, and a start that is not exactly a scheme, two slashes and a character other than a slash. `https://user:pa?ss@example.com/`, `https://example.org?e=a@b.com` and `https:///host?e=a@b.com` are shown as `https://***`. `user:secret@host.example://dd`, where no slash follows the scheme colon, is shown as `//***`. The same holds for a word that a URL parser refuses as a scheme when a slash or a backslash follows its colon, as in `my_app:/user:secret@host`, and for an address that the parser refuses when a `?` or `#` comes before its last `@`, as in `https://user:pa/ss?secret@example.com`. A redirect to such an address is reported as "a different host that this report does not name". A `/` before the `@` makes it a path, and a relative reference such as `/a@b` or `docs/@name` is masked as before.
|
|
97
97
|
- Spaces, C0 control characters, Unicode spaces and invisible characters such as U+200B at either end of a value are removed before it is read, so a value that starts with U+2003 before `https:/user:secret@example.com` is read as `https:/user:secret@example.com` and shown as `https://***`.
|
|
@@ -230,7 +230,7 @@ The default validation requests two documents: `https://<host>/llms.txt` and `ht
|
|
|
230
230
|
- Timeout: eight seconds per document, shared across its redirect chain.
|
|
231
231
|
- Read limit: 256 KiB, which is 262,144 bytes, per response by default. A file cut there gets the size note "over 256 KiB, read truncated". A library caller can change the limit, see the options above.
|
|
232
232
|
- Redirects: up to four hops, over HTTPS, to the same host or its `www`/apex equivalent. Off-site redirects, embedded credentials and unsupported ports are rejected. A redirect target is reported with its credentials and fragment removed and its query values masked, whether the redirect was followed or rejected.
|
|
233
|
-
- Host checks: IP literals, bracketed IPv6 addresses, localhost and the internal-use TLDs `localdomain`, `local`, `internal`, `home`, `lan`, `corp`, `test`, `invalid`, `arpa` and `onion` are rejected before a request is sent. An address that holds `@`, `?` or `#` is not repeated in the error message, because it can carry a user name, a password or a query value. One trailing dot on the host you give, as in `example.com.`, is removed first. Redirect targets are checked too, and one trailing dot on a redirect target is removed the same way.
|
|
233
|
+
- Host checks: IP literals, bracketed IPv6 addresses, localhost and the internal-use TLDs `localdomain`, `local`, `internal`, `home`, `lan`, `corp`, `test`, `invalid`, `arpa` and `onion` are rejected before a request is sent. An address that holds `@`, `?` or `#` is not repeated in the error message, because it can carry a user name, a password or a query value. The message names the host that a URL parser reads from such an address only when that host is the text right after the last `@`, or when the address holds no `@`. So `//user?@example.com`, where the parser reads the user name as the host, names no host. One trailing dot on the host you give, as in `example.com.`, is removed first. Redirect targets are checked too, and one trailing dot on a redirect target is removed the same way.
|
|
234
234
|
|
|
235
235
|
**DNS resolution is not checked for private addresses.** A syntactically public domain can resolve to a private IP, so if you expose this package through a service that accepts untrusted domains, enforce private-address restrictions at the network layer. Local and CI runs use their own network policy. The hosted validator runs on the Cloudflare edge.
|
|
236
236
|
|
|
@@ -253,12 +253,12 @@ The strict type check found two inputs that could leave `undefined` in a check's
|
|
|
253
253
|
GitHub Actions publishes every version from 0.1.3 on with npm trusted publishing, and each one carries a provenance attestation. To check one, install it in an empty directory and ask npm to verify the signatures. Replace the version with the one you want to check.
|
|
254
254
|
|
|
255
255
|
```sh
|
|
256
|
-
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.8.
|
|
256
|
+
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.8.3 --ignore-scripts && npm audit signatures
|
|
257
257
|
```
|
|
258
258
|
|
|
259
259
|
`npm audit signatures` checks the registry signature and the provenance attestation of each installed package that has one. The attestation of this package names three things to compare with what you expect: the repository `github.com/erekola/llms-txt-validator`, the workflow file `.github/workflows/publish.yml` and the commit that produced the tarball. The npm version page shows them under Provenance.
|
|
260
260
|
|
|
261
|
-
Tag `v0.8.
|
|
261
|
+
Tag `v0.8.3` must point at that same commit, and `gh api repos/erekola/llms-txt-validator/commits/v0.8.3 --jq .sha` prints it. A mismatch is a reason not to use that version. Provenance proves which workflow built a release and from which commit. It does not prove that the code is safe, so reading the source and the dependencies stays your job.
|
|
262
262
|
|
|
263
263
|
## Development
|
|
264
264
|
|
package/dist/bin/cli.js
CHANGED
|
@@ -48,8 +48,13 @@ if (flags.includes("--version") || flags.includes("-V")) {
|
|
|
48
48
|
process.exit(0);
|
|
49
49
|
}
|
|
50
50
|
const unknown = flags.find((f) => !KNOWN.has(f));
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
// Only the name of an unknown option is repeated: the dashes and the letters, digits and dashes after them. A target
|
|
52
|
+
// typed with a leading dash, as in -u:password@example.com, is read as an option, and up to 0.8.2 its first 40
|
|
53
|
+
// characters, user information included, were repeated in the error (n9, independent rerun 2026-11-22).
|
|
54
|
+
if (unknown) {
|
|
55
|
+
const name = /^-+[A-Za-z0-9-]*/.exec(unknown)[0].slice(0, 40);
|
|
56
|
+
fail("unknown option " + JSON.stringify(name) + (name === unknown ? "" : " (the rest of the argument is not shown)"));
|
|
57
|
+
}
|
|
53
58
|
if (targets.length === 0 || targets[0].trim() === "")
|
|
54
59
|
fail("no domain or URL given");
|
|
55
60
|
if (targets.length > 1)
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -23,6 +23,32 @@ export function cut(s, n) {
|
|
|
23
23
|
s = String(s).slice(0, n);
|
|
24
24
|
return /[\uD800-\uDBFF]$/.test(s) ? s.slice(0, -1) : s;
|
|
25
25
|
}
|
|
26
|
+
// Removes a run of the characters strip accepts from each end of s, with two index loops. The regex form
|
|
27
|
+
// s.replace(/^[set]+|[set]+$/g, "") tries the trailing alternative again from every position inside a long run of
|
|
28
|
+
// those characters that does not reach the end, so its time grows with the square of the run (CodeQL
|
|
29
|
+
// js/polynomial-redos, 2026-11-22). The result is the same string.
|
|
30
|
+
function trimEnds(s, strip) {
|
|
31
|
+
let a = 0;
|
|
32
|
+
let b = s.length;
|
|
33
|
+
while (a < b && strip(s.charCodeAt(a)))
|
|
34
|
+
a++;
|
|
35
|
+
while (b > a && strip(s.charCodeAt(b - 1)))
|
|
36
|
+
b--;
|
|
37
|
+
return s.slice(a, b);
|
|
38
|
+
}
|
|
39
|
+
// The characters maskLocation() removes at either end of an address: C0 controls and spaces, which a URL parser
|
|
40
|
+
// drops, and the Unicode white space, U+0085, U+180E, U+200B and U+FFFD, which a reader does not see.
|
|
41
|
+
function isUrlEdge(c) {
|
|
42
|
+
return c <= 0x20 || c === 0x85 || c === 0x180e || c === 0x200b || c === 0xfffd || /\s/.test(String.fromCharCode(c));
|
|
43
|
+
}
|
|
44
|
+
// C0 controls and spaces, the characters a URL parser removes at either end of an address.
|
|
45
|
+
function isC0OrSpace(c) {
|
|
46
|
+
return c <= 0x20;
|
|
47
|
+
}
|
|
48
|
+
// HTTP white space: tab, LF, CR and space.
|
|
49
|
+
function isHttpSpace(c) {
|
|
50
|
+
return c === 0x09 || c === 0x0a || c === 0x0d || c === 0x20;
|
|
51
|
+
}
|
|
26
52
|
// A redirect target the way a report may show it. The scheme, the host and the path stay readable,
|
|
27
53
|
// and the parts that can carry a secret do not: the user name and the password are removed, every
|
|
28
54
|
// query value becomes ***, and the fragment is dropped. The caller cuts the result to length
|
|
@@ -47,8 +73,7 @@ export function maskLocation(href, base, written) {
|
|
|
47
73
|
// The same reading also removes, at either end, the invisible characters that a URL parser keeps: the Unicode
|
|
48
74
|
// white space, U+0085, U+180E, U+200B and U+FFFD. A reader does not see them, so a value that starts with U+2003
|
|
49
75
|
// and then https:/user:pw@host is read as the address it shows (L3 of the third independent check).
|
|
50
|
-
const
|
|
51
|
-
const parserInput = (t) => t.replace(/[\t\n\r]/g, "").replace(new RegExp("^" + edge + "|" + edge + "$", "g"), "");
|
|
76
|
+
const parserInput = (t) => trimEnds(t.replace(/[\t\n\r]/g, ""), isUrlEdge);
|
|
52
77
|
const text = parserInput(String(href));
|
|
53
78
|
// Where an authority starts in a text, read from the text and not from the parser: after a scheme and two slashes, the
|
|
54
79
|
// scheme being whatever stands before "://" with no / \ ? or # in it. invalid is true when that "scheme" is not one.
|
|
@@ -99,7 +124,7 @@ export function maskLocation(href, base, written) {
|
|
|
99
124
|
const w = parserInput(String(written));
|
|
100
125
|
// A written form that lost invisible characters at its ends was resolved by the parser with them, so href is not the
|
|
101
126
|
// address the reading sees, and the written form is masked instead (differential fuzz against 3.260.6).
|
|
102
|
-
const parserOwn = String(written).replace(/[\t\n\r]/g, "")
|
|
127
|
+
const parserOwn = trimEnds(String(written).replace(/[\t\n\r]/g, ""), isC0OrSpace);
|
|
103
128
|
if (ambiguous(w) || shapeOf(w).invalid || (w !== parserOwn && w.includes("@")))
|
|
104
129
|
return maskLocation(written, base);
|
|
105
130
|
}
|
|
@@ -316,7 +341,22 @@ export function enteredPath(raw) {
|
|
|
316
341
|
return "";
|
|
317
342
|
}
|
|
318
343
|
const path = u.pathname;
|
|
319
|
-
|
|
344
|
+
if (path === "/" || path === "" || path === "/llms.txt")
|
|
345
|
+
return "";
|
|
346
|
+
// A typed address whose user information the parser moved into the path, as in
|
|
347
|
+
// https://corp.example\erik:password@host.example, read as host corp.example and path
|
|
348
|
+
// /erik:password@host.example, repeated the password in this value (n7, independent rerun
|
|
349
|
+
// 2026-11-22). The path is shown only when maskLocation shows it for the whole typed address.
|
|
350
|
+
return s.includes("@") && !maskLocation(s).includes(path) ? "/***" : path;
|
|
351
|
+
}
|
|
352
|
+
// The host a refused typed address is named by in an error. An address with an @, a ? or a # is named by the host the
|
|
353
|
+
// parser reads from it, and only when that host is the text right after the last @, or the text has no @: with a ? or #
|
|
354
|
+
// before the @ the parser reads the user name as the host, and //user?@example.com named "user" (n8, independent
|
|
355
|
+
// rerun 2026-11-22). Mirrors worker.ts validatorEcho().
|
|
356
|
+
function typedHostEcho(raw) {
|
|
357
|
+
const host = normalizeHostInput(raw) || "";
|
|
358
|
+
const at = raw.lastIndexOf("@");
|
|
359
|
+
return host && (at < 0 || raw.slice(at + 1).toLowerCase().startsWith(host)) ? host : "";
|
|
320
360
|
}
|
|
321
361
|
export function isValidPublicHost(host) {
|
|
322
362
|
if (!host || host.length > 253)
|
|
@@ -396,6 +436,7 @@ export async function fetchLlmsTxt(host, opts = {}) {
|
|
|
396
436
|
throw new Error("the request address does not keep the host that was checked");
|
|
397
437
|
}
|
|
398
438
|
let redirectedFrom = null;
|
|
439
|
+
let hidden = false;
|
|
399
440
|
// One budget for the whole redirect chain, not one per hop. Mirrors the hosted validator
|
|
400
441
|
// (turva.dev/llms-txt-validator), which is canonical: with five hops a per-hop signal made
|
|
401
442
|
// the caller's timeout five times longer than the value it passed in.
|
|
@@ -419,14 +460,15 @@ export async function fetchLlmsTxt(host, opts = {}) {
|
|
|
419
460
|
if (!loc)
|
|
420
461
|
return { redirect: true, reason: "no-location", status: res.status, location: "" };
|
|
421
462
|
if (hop >= 4)
|
|
422
|
-
return { redirect: true, reason: "too-many", status: res.status, location: cut(maskLocation(loc, url), 120) };
|
|
463
|
+
return { redirect: true, reason: "too-many", status: res.status, location: cut(maskLocation(loc, hidden ? undefined : url), 120) };
|
|
423
464
|
let next;
|
|
424
465
|
try {
|
|
425
466
|
next = new URL(loc, url);
|
|
426
467
|
}
|
|
427
468
|
catch {
|
|
428
|
-
return { redirect: true, reason: "bad-location", status: res.status, location: cut(maskLocation(loc, url), 120) };
|
|
469
|
+
return { redirect: true, reason: "bad-location", status: res.status, location: cut(maskLocation(loc, hidden ? undefined : url), 120) };
|
|
429
470
|
}
|
|
471
|
+
const parsedHref = next.href;
|
|
430
472
|
// LV-22 (round S3, Tek-546): one trailing dot names the same host, as it does in the typed
|
|
431
473
|
// address (normalizeHostInput), so a redirect to https://example.com./ is a same-site redirect.
|
|
432
474
|
// A second dot still fails the host test below.
|
|
@@ -438,6 +480,24 @@ export async function fetchLlmsTxt(host, opts = {}) {
|
|
|
438
480
|
return { redirect: true, reason: "unsafe-target", status: res.status, location: cut(maskLocation(next.href, undefined, loc), 120) };
|
|
439
481
|
if (!twin)
|
|
440
482
|
return { redirect: true, reason: "off-host", status: res.status, location: cut(maskLocation(next.href, undefined, loc), 120) };
|
|
483
|
+
// A followed Location that reads as user information, as user_name:password@example.com resolved into
|
|
484
|
+
// https://example.com/user_name:password@example.com, kept the password in the address the report showed (n1,
|
|
485
|
+
// independent rerun 2026-11-22). The Location is read as written, against the address it came from, as a refused
|
|
486
|
+
// one is. When that reading masks more than the parsed address shows, the chain is marked: every later address
|
|
487
|
+
// that keeps its path is resolved from this one, so the final address is shown as its scheme, its host and "/***", and a later
|
|
488
|
+
// refused Location is read without this address as its base.
|
|
489
|
+
// A later Location that keeps nothing of the marked address, such as an absolute address or a path from the root,
|
|
490
|
+
// clears the mark: it is resolved against the marked address and against the same origin with every path segment
|
|
491
|
+
// and the query replaced, at the same depth, and when both give the same address the path and the query of the
|
|
492
|
+
// marked address did not reach it. Bases one segment deep let ".." and "../x" clear the mark while the hidden
|
|
493
|
+
// segments stayed (F1 of the seventh check, 2026-11-22).
|
|
494
|
+
const inheritsBase = (() => { const u0 = new URL(url); let n = 0; const alt = u0.origin + u0.pathname.replace(/[^\/]+/g, () => "zz9q" + n++) + (u0.search ? "?zz9q" : ""); try {
|
|
495
|
+
return new URL(loc, url).href !== new URL(loc, alt).href;
|
|
496
|
+
}
|
|
497
|
+
catch {
|
|
498
|
+
return true;
|
|
499
|
+
} })();
|
|
500
|
+
hidden = maskLocation(loc, url) !== maskLocation(parsedHref) || maskLocation(next.href, undefined, loc) !== maskLocation(next.href) || (hidden && inheritsBase);
|
|
441
501
|
if (!redirectedFrom)
|
|
442
502
|
redirectedFrom = url;
|
|
443
503
|
url = next.href;
|
|
@@ -476,7 +536,8 @@ export async function fetchLlmsTxt(host, opts = {}) {
|
|
|
476
536
|
bytes,
|
|
477
537
|
truncated,
|
|
478
538
|
redirectedFrom,
|
|
479
|
-
finalUrl: url
|
|
539
|
+
finalUrl: url,
|
|
540
|
+
...(hidden ? { shownFinalUrl: "https://" + new URL(url).host + "/***" } : {})
|
|
480
541
|
};
|
|
481
542
|
}
|
|
482
543
|
}
|
|
@@ -1721,7 +1782,9 @@ export function validateLlmsTxt(f) {
|
|
|
1721
1782
|
// detail as sent. An input with redirectedFrom and no finalUrl, which fetchLlmsTxt never returns but a
|
|
1722
1783
|
// caller of this function can pass, names the address it was redirected from alone instead of ending
|
|
1723
1784
|
// in "to undefined" (Tek-668, NULL-2, mirrored from worker.ts).
|
|
1724
|
-
|
|
1785
|
+
// shownFinalUrl, when fetchLlmsTxt set it, stands in for finalUrl (n1, independent rerun 2026-11-22).
|
|
1786
|
+
const shownFinal = f.shownFinalUrl !== undefined ? maskLocation(f.shownFinalUrl) : f.finalUrl ? maskLocation(f.finalUrl) : "";
|
|
1787
|
+
add("http-status", "pass", "File exists at /llms.txt", f.redirectedFrom ? "HTTP 200, followed a redirect from " + maskLocation(f.redirectedFrom) + (shownFinal ? " to " + shownFinal : "") : "HTTP 200");
|
|
1725
1788
|
// A leading byte-order mark is stripped the same way the fetch path already strips it: the
|
|
1726
1789
|
// TextDecoder used there removes a BOM by default, so the direct API took a different
|
|
1727
1790
|
// document than the fetched one for the exact same bytes until this was measured (outside
|
|
@@ -1741,7 +1804,7 @@ export function validateLlmsTxt(f) {
|
|
|
1741
1804
|
}
|
|
1742
1805
|
// The media type is compared whole, without its parameters. A substring test passed
|
|
1743
1806
|
// application/x-text/plain and text/markdownish until 2026-09-27 (Tek-496).
|
|
1744
|
-
const mediaType = ct.split(";")[0]
|
|
1807
|
+
const mediaType = trimEnds(ct.split(";")[0], isHttpSpace);
|
|
1745
1808
|
if (mediaType === "text/plain" || mediaType === "text/markdown") {
|
|
1746
1809
|
add("content-type", "pass", "Response is plain text", mediaType);
|
|
1747
1810
|
}
|
|
@@ -3284,7 +3347,7 @@ export async function validateHost(input, opts = {}) {
|
|
|
3284
3347
|
// its first 120 characters into stderr and the --json error (Tek-496). Such an entry is
|
|
3285
3348
|
// named by the host the parser reads from it, or not at all, as the hosted form does.
|
|
3286
3349
|
const raw = String(input ?? "");
|
|
3287
|
-
const shown = /[@?#]/.test(raw) ?
|
|
3350
|
+
const shown = /[@?#]/.test(raw) ? typedHostEcho(raw) : stripControls(cut(raw, 120));
|
|
3288
3351
|
throw new Error(shown ? "not a public domain name: " + shown : "not a public domain name");
|
|
3289
3352
|
}
|
|
3290
3353
|
// opts comes from the caller, and path and accept exist for this function's own
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turva-llms-txt-validator",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Validate a site's llms.txt structure: eight checks as pass/warn/fail plus two llms.txt v2 discovery checks that read pass or info and never move the summary, JSON output. Same checks as the hosted validator at turva.dev/llms-txt-validator.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/index.js",
|