Skip to content

ref-version-mismatch: handle unusual comment placement - #2394

Merged
woodruffw merged 5 commits into
mainfrom
ww/fix-2393
Sep 20, 2026
Merged

woodruffw merged 5 commits into
mainfrom
ww/fix-2393

Conversation

@woodruffw

@woodruffw woodruffw commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

WIP, needs more tests.

The underlying bug here is that ref-version-mismatch assumed that a uses: clause that has a comment will always have that comment after the actual content. However, that's not true if the user does something like this:

uses: |- # 1.2.3
  abc/def

This is inadvisable since tools like Renovate and Dependabot won't handle it correctly, but it still shouldn't crash zizmor. The fix on zizmor's side is to track each comment's concrete location and use that for the subfeature rather than trying to guesstimate the subfeature's location relative to the end of the content in uses:.

Closes #2393.

@woodruffw woodruffw self-assigned this Sep 18, 2026
@woodruffw woodruffw added the bugfix Fixes a known bug label Sep 18, 2026
Comment thread crates/zizmor/src/finding/location.rs Resolved
@woodruffw
woodruffw merged commit 1c9a2a2 into main Sep 20, 2026
14 checks passed
@woodruffw
woodruffw deleted the ww/fix-2393 branch September 20, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a known bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Crash when uses: is represented as a literal block scalar with a comment

1 participant