fix(okf): a flow sequence admits '#' and ':' where YAML reads them as text
1.4.0 refused a flow-sequence scalar element carrying '#' or ':' anywhere. okf writes `references: [...]` as a flow sequence of doc links, and an entry may carry a #fragment or a scheme://. claude-code-llm-wiki measured parse_frontmatter raising on 2 038 of 5 467 concepts of a bundle okf produced (2026-09-17); reproduced here on the same bundle, 2 038 / 5 467 before and 0 / 5 467 after (0 / 4 466 and 0 / 5 530 on the two other builds). The two characters are now refused by position, where PyYAML 6.0.3 gives them a meaning: '#' opening the element or following whitespace (a comment), ':' opening or ending the element or preceding whitespace (a mapping). Elsewhere they are scalar characters. The rest of the refused set, the indicator rule and the no-mixing rule are unchanged. Chosen over admitting the characters wholesale because `[a: b]` is a mapping and `[a #b]` a comment to YAML; admitting those would hand the consumer a value YAML does not read. The position checks are substring tests, no regex: CPU time stays linear in element count and length (100k -> 800k), about 10 % over 1.4.0, inside the existing 2 s bound. Pinned upstream corpus unmoved at 6 / 53. 910 passed (+17), coverage exit 0, redos-sweep exit 0, 45 LIMITATIONS entries.
This commit is contained in:
parent
79285e1265
commit
639da03f8c
4 changed files with 119 additions and 6 deletions
|
|
@ -178,7 +178,11 @@ the dotted and inline-colon routes to a mapping still raise. A
|
|||
*sequence* value has two carriers — the block list, and (as of `1.4.0`) the flow
|
||||
sequence `tags: [a, b, c]`, which is SPEC §4.1's own skeleton — whose elements
|
||||
are either all plain scalars or all flow mappings, never a mix. A scalar element
|
||||
carrying any of `{ } [ ] : , " ' #` is refused rather than guessed at. See
|
||||
carrying any of `{ } [ ] , " '` is refused rather than guessed at, and so is a
|
||||
`#` or `:` where YAML reads it (a `#` opening the element or following
|
||||
whitespace, a `:` opening or ending it or preceding whitespace); since `1.4.1`
|
||||
`[/docs/a#anchor, vscode://x, https://e.com:8443/a]` parses, as it does in
|
||||
YAML. See
|
||||
[LIMITATIONS](docs/LIMITATIONS.md) for what that admits and what it still walls
|
||||
off; **`resource` https-allowlist** (hard-rejects
|
||||
`data:`/`javascript:`/`file:` before commit — a reject-gate, not defang — on the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue