Repository navigation
fix(catalog): hidden-unicode scans decoded front matter strings (#1334) - #1341
vchamarthi wants to merge 3 commits into
Conversation
…l#1334) content_findings passed only the raw SKILL.md text to the hidden-unicode check, so a bidi, tag or zero-width character written as a YAML escape in a double-quoted front matter value was never reported. The decoded strings of the front matter, under any key, are now scanned too; a literal character already reported from the raw text is not reported twice. Also covers the description case of intel#1285. Fixes intel#1334 Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Decoded metadata keys can inject terminal-control sequences into warnings, while escaped-character detection can miss hidden characters or duplicate reports and quote scanning scales quadratically.
3 open issues
What changed in this PR
3 new findings.
Extends catalog check to detect hidden Unicode characters produced by YAML decoding in SKILL.md front matter, addressing #1334 and the description case in #1285.
Changes:
- Adds decoded scalar scanning with key-path diagnostics.
- Shares hidden-character rules between raw and decoded scans.
- Adds regression tests, documentation, and a changelog fragment.
| File | Description |
|---|---|
dokimi/tests/test_content_checks.py |
Tests escapes, aliases, literals, reporting limits, and malformed front matter. |
dokimi/dokimi/external/content_checks.py |
Adds decoded front matter scanning and shared detection helpers. |
dokimi/docs/external-content.md |
Documents warnings for decoded front matter escapes. |
dokimi/changelog.d/20261127_120000_hidden-unicode-front-matter-escapes.md |
Records the expanded hidden-Unicode detection. |
Review effort: Balanced
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1341 +/- ##
==========================================
- Coverage 96.19% 96.18% -0.01%
==========================================
Files 499 499
Lines 66465 66781 +316
Branches 11542 11624 +82
==========================================
+ Hits 63933 64233 +300
- Misses 1563 1570 +7
- Partials 969 978 +9
🚀 New features to boost your workflow:
|
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 4 selected item(s). CI at Test notes (2)
Review details
|
…scan (intel#1334) Track which decoded characters an escape wrote instead of subtracting codepoint counts, so a literal character no longer hides an escape or turns folded literal fillers into escape findings. Find the opening quote in linear time and write control characters of a key as escapes in the warning. Keep a blank line after an escaped line break as a newline, so the decoded value matches YAML's and its escapes are reported. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Changes:
Threads:
What I checked on the new commit:
What each test shows
|


Summary
catalog checkreportedwhen_to_use: "Use when x\u202ey"as ok, becausehidden-unicoderead only the raw file text. This change scans the YAML-decoded front matter strings as well. Fixes #1334. Related: #1285, whosedescriptioncase is covered because every key is walked.Changes
dokimi/external/content_checks.py:_front_matter_hitscomposes the front matter withyaml.compose, visits each scalar node once, and reports each hidden character that the scalar's own source text does not hold literally, with its key path and the same cap as a file's hits. It is called forSKILL.mdonly.tests/test_content_checks.py: tests for each key, nested values, the cap, the literal case, the clean controls and broken front matter.docs/external-content.md: thehidden-unicodeentry says that decoded front matter escapes are reported._hidden_indicesholds the hidden-character rules (including the filler count per line) for both the raw and the decoded scan; the decoded scan treats the start of a value as not the start of a file.Risk
Front matter is parsed a second time for each skill. Skills that held a double-quoted escape of a hidden character get a new
warn; nothing else changes. Invalid YAML adds no finding here.Testing
python -m pytest -q -p no:cacheprovider tests/test_content_checks.py tests/test_growth_ratchet.pypasses, andpython -m ruff checkon the two changed.pyfiles passes.Open questions
None beyond the listed choices.
yaml.composenode marks) and report only the surplus, with the key path in the message over A file-wide count of literal characters, which a literal character in a comment or an aliased value can use up: It is the per-string comparison the issue describes, and needs no second YAML parser. Is that the behaviour you want?Revert
Revert the commit; nothing is stored.
Checklist
See the boxes.
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)Review points edit lines of recent commits:
dokimi/dokimi/external/content_checks.py(bee8c63 fix(catalog): report runs of more than three script fillers as hidden-). Each commit's own tests still pass; none of their assertions changes except those listed above for a scenario of the issue.Checklist evidence
pytestpasses: 1 test file(s) changed; suite: 33786 passed; 1 failing test(s) fail on the base branch too: tests/test_repo_compare_interval.py::test_the_row_p_places_zero_where_large_deltas_round_p_at_zero_apart; 9 of 10 proof(s) fail before the change; 1 pin behaviour the base code already hadruff,mypy, and schema checks pass: passed: ci.yml:static / ruff check, ci.yml:typecheck / mypy, ci.yml:static / schema-check, ci.yml:static / schema_compat vs the PR basedokimi/docs/external-content.mdAGENTS.md: nothing left open; mutation of changed lines ranraise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue.github/.licenserc.yaml): no new source fileFixes #1334.