turva-llms-txt-validator 0.7.2 → 0.7.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 +2 -2
- package/dist/src/index.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -222,10 +222,10 @@ The strict type check found two inputs that could leave `undefined` in a check's
|
|
|
222
222
|
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.
|
|
223
223
|
|
|
224
224
|
```sh
|
|
225
|
-
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.7.
|
|
225
|
+
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.7.3 --ignore-scripts && npm audit signatures
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
`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. Tag `v0.7.
|
|
228
|
+
`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. Tag `v0.7.3` must point at that same commit, and `gh api repos/erekola/llms-txt-validator/commits/v0.7.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.
|
|
229
229
|
|
|
230
230
|
## Development
|
|
231
231
|
|
package/dist/src/index.js
CHANGED
|
@@ -185,6 +185,16 @@ export function isValidPublicHost(host) {
|
|
|
185
185
|
// the same-host rule, the credential and port rejections and the 256 KiB cap are the
|
|
186
186
|
// guards this function was measured against.
|
|
187
187
|
export async function fetchLlmsTxt(host, opts = {}) {
|
|
188
|
+
// Host-shape check at the entry: the same normalizeHostInput and isValidPublicHost that validateHost
|
|
189
|
+
// applies, so a direct caller gets the answer validateHost would give (upper case, one trailing dot
|
|
190
|
+
// and a raw IDN name are accepted and fetched in their normalised form). The helper is exported, so
|
|
191
|
+
// without this a direct caller could make the first request to an IP literal or an internal-use name.
|
|
192
|
+
// It checks the shape of the name only and does not resolve it. The refusal reuses the unsafe-target
|
|
193
|
+
// result with no status and no location: nothing was requested, and the typed host is not echoed back.
|
|
194
|
+
const normalized = normalizeHostInput(host);
|
|
195
|
+
if (!normalized || !isValidPublicHost(normalized))
|
|
196
|
+
return { redirect: true, reason: "unsafe-target", status: 0, location: "" };
|
|
197
|
+
host = normalized;
|
|
188
198
|
const timeoutMs = opts.timeoutMs ?? 8000;
|
|
189
199
|
const cap = opts.cap ?? 262144;
|
|
190
200
|
const reqApex = host.startsWith("www.") ? host.slice(4) : host;
|
|
@@ -1391,6 +1401,8 @@ function isAbsoluteHttpUrl(t) {
|
|
|
1391
1401
|
function redirectFailDetail(f) {
|
|
1392
1402
|
if (f.reason === "off-host")
|
|
1393
1403
|
return "redirects to " + f.location + ", a different host. llms.txt is host-scoped, so validate that host directly";
|
|
1404
|
+
if (f.reason === "unsafe-target" && !f.location)
|
|
1405
|
+
return "the host is not a public domain name, so no request was made";
|
|
1394
1406
|
if (f.reason === "unsafe-target")
|
|
1395
1407
|
return "redirects to an unsupported target (" + f.location + "). Only https redirects to the same site are followed";
|
|
1396
1408
|
if (f.reason === "too-many")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turva-llms-txt-validator",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.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",
|