Drop a Bare Sequence-Item Block Scalar's Body Too - #1005
Conversation
A step's `- run: |` is keyed, so _code_view() recognized it, but a bare sequence item (`- |`, e.g. a matrix string) has no key at all and was not recognized, leaving its body searchable and the requireTokensInJob/forbidTokensInJob mitigation bypassable the same way as the keyed case. The boundary for a bare scalar is the dash's own column, not a key past it, verified against a real YAML parser: content one column past the dash parses, content at or before the dash's column does not. Adds the matching regression case. Found by qodo-code-review on PR #1004.
PR Summary by QodoExclude Bare Sequence Block Scalars from Workflow Token Audits
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesYAML scalar filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This is a localized parser-recognition fix for bare sequence-item block scalars, with no actionable merge-blocking risk remaining after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Review by Qodo
1.
|
Found by qodo-code-review on PR #1005.
Follow-up to #1003 (issue #949), found by qodo-code-review on the develop -> main promotion PR #1004, which cannot carry the fix directly since its diff is develop against main.
What happened
_code_view()'s block-scalar recognition required a mapping key before the
|/>indicator, so a keyed step (- run: |) was recognized but a bare sequence item with no key at all (- |, e.g. a matrix string) was not, leaving its body searchable and the requireTokensInJob/forbidTokensInJob mitigation bypassable the same way the original issue describes.Fix
Recognizes a bare
- |/- >too. Its boundary is the dash's own column rather than a key past it, since there is no key: verified against a real YAML parser (content one column past the dash parses, content at or before the dash's column is a parse error).Verification
Ran locally from the repo root:
python3 spec/audit.py --selftest(SELFTEST PASS, including the new case),uvx ruff@latest check/format --check,uvx mypy@latest,python3 scripts/prose_lint.py(default set),python3 scripts/repo_gate.py.Summary by CodeRabbit
Bug Fixes
Tests