turva-llms-txt-validator 0.3.20 → 0.3.21
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/package.json +1 -1
- package/src/index.mjs +10 -10
package/README.md
CHANGED
|
@@ -137,10 +137,10 @@ For vulnerability reporting and supported versions, see [SECURITY.md](https://gi
|
|
|
137
137
|
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.
|
|
138
138
|
|
|
139
139
|
```sh
|
|
140
|
-
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.3.
|
|
140
|
+
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.3.21 --ignore-scripts && npm audit signatures
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
`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.3.
|
|
143
|
+
`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.3.21` must point at that same commit, and `gh api repos/erekola/llms-txt-validator/commits/v0.3.21 --jq .sha` prints it. A mismatch is a reason not to use that version. Provenance proves where a release was built and from which commit. It does not prove that the code is safe, so reading the source and the dependencies stays your job.
|
|
144
144
|
|
|
145
145
|
## Hosted version and source
|
|
146
146
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turva-llms-txt-validator",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
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": "./src/index.mjs",
|
package/src/index.mjs
CHANGED
|
@@ -546,15 +546,15 @@ function isSetextH1(line, next) {
|
|
|
546
546
|
// "[a]: url" over a run of "=" warning as a second H1 although 0.3.18 passed them.
|
|
547
547
|
const HTML_BLOCK_START = /^ {0,3}<(?:[A-Za-z][A-Za-z0-9-]*(?:[\s\/>]|$)|\/[A-Za-z][A-Za-z0-9-]*(?:[\s>]|$)|!--|\?|![A-Za-z]|!\[CDATA\[)/;
|
|
548
548
|
const LINK_REF_DEF = /^ {0,3}\[[^\]]+\]:/;
|
|
549
|
-
// HTML blocks of CommonMark types 1 to 5 end at a marker, not at a blank line:
|
|
550
|
-
//
|
|
551
|
-
|
|
549
|
+
// HTML blocks of CommonMark types 1 to 5 end at a marker, not at a blank line. The end markers are plain substrings matched case-insensitively, as CommonMark defines them, and not a tag regexp (CodeQL js/bad-tag-filter): type 2 ends at "-->" only, never at "--!>".
|
|
550
|
+
// Entry is [start, ends]: </pre>, </script>, </style>, </textarea> after <pre> and kin, "-->" after "<!--", "?>" after "<?", "]]>" after "<![CDATA[", ">" after "<!X"; the marker is looked for after the start on the same line.
|
|
551
|
+
function hasRawEnd(s, ends) { const t = s.toLowerCase(); return ends.some((e) => t.includes(e)); }
|
|
552
552
|
const RAW_HTML_BLOCKS = [
|
|
553
|
-
[/^ {0,3}<(?:pre|script|style|textarea)(?:[ \t>]|$)/i,
|
|
554
|
-
[/^ {0,3}<!--/,
|
|
555
|
-
[/^ {0,3}<\?/,
|
|
556
|
-
[/^ {0,3}<!\[CDATA\[/,
|
|
557
|
-
[/^ {0,3}<![A-Za-z]/,
|
|
553
|
+
[/^ {0,3}<(?:pre|script|style|textarea)(?:[ \t>]|$)/i, ['</pre>', '</script>', '</style>', '</textarea>']],
|
|
554
|
+
[/^ {0,3}<!--/, ['-->']],
|
|
555
|
+
[/^ {0,3}<\?/, ['?>']],
|
|
556
|
+
[/^ {0,3}<!\[CDATA\[/, [']]>']],
|
|
557
|
+
[/^ {0,3}<![A-Za-z]/, ['>']]
|
|
558
558
|
];
|
|
559
559
|
function startsOtherBlock(line) {
|
|
560
560
|
return /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/.test(line)
|
|
@@ -603,12 +603,12 @@ function laterSetextH1(lines, fenced) {
|
|
|
603
603
|
blankBefore = false;
|
|
604
604
|
if (/^ {0,3}>/.test(l)) quoteCtx = true;
|
|
605
605
|
if (rawEnd) {
|
|
606
|
-
if (
|
|
606
|
+
if (hasRawEnd(l, rawEnd)) { rawEnd = null; rawDone = true; }
|
|
607
607
|
} else {
|
|
608
608
|
if (HTML_BLOCK_START.test(l) || LINK_REF_DEF.test(l)) htmlCtx = true;
|
|
609
609
|
for (const [start, end] of RAW_HTML_BLOCKS) {
|
|
610
610
|
const m = start.exec(l);
|
|
611
|
-
if (m) { if (!
|
|
611
|
+
if (m) { if (!hasRawEnd(l.slice(m[0].length), end)) rawEnd = end; break; }
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
614
|
if (!open && !listCtx && !quoteCtx && !htmlCtx && indented) continue;
|