Repository navigation
fix: robust discovery, skip unreadable/non-UTF-8 files (M1) - #5
Merged
Merged
Conversation
…can (M1)
A single unreadable or non-UTF-8 .nr file no longer aborts the whole scan
(security-review finding M1).
- zkguard-core: new SkippedFile { path, reason, kind } with SkipKind
(non_utf8 | unreadable | other_io); ScanResult gains an additive, empty-
skippable `skipped` field.
- zkguard-noir: discovery reads each .nr via read_noir_source; on failure it
records a SkippedFile in NoirProject.skipped and keeps scanning. Directory-
level read errors remain hard errors (out of M1 scope). Still no execution,
no symlink following, no network.
- CLI: warns on stderr per skipped file and carries them in ScanResult; exit
code still depends only on findings.
- Reports: human summary count + "Warnings (skipped files)" section;
Markdown "Skipped files" table + summary line; JSON additive `skipped`
array. SARIF unchanged (skips are not security results).
- Tests: discovery skip (valid + non-UTF-8), clean-project no-skips, CLI
end-to-end (scan continues, warning emitted, exit driven by findings),
core serde-default/omit-when-empty.
- Docs: security-review M1 marked fixed; architecture data flow notes
partial-tolerant discovery; CHANGELOG [Unreleased] Fixed entry.
Rule semantics unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the M1 fix from
docs/security-review.md: a single unreadable or non-UTF-8.nrfile must not abort the whole scan. First 0.3.0-line item (robustness/availability).What
zkguard-core: newSkippedFile { path, reason, kind }withSkipKind(non_utf8|unreadable|other_io).ScanResultgains an additiveskipped: Vec<SkippedFile>(#[serde(default)], omitted when empty).zkguard-noir: discovery reads each.nrviaread_noir_source; on failure it records aSkippedFileinNoirProject::skippedand keeps scanning the rest of the tree.read_to_string'sInvalidDatamaps tonon_utf8, permission/not-found tounreadable, elseother_io. Directory-level read errors stay hard errors (out of M1 scope). Still: no execution, no symlink following, no network.warning:per skipped file and carries them in the result. Exit code still depends only on findings.skipped: N+ a "Warnings (skipped files)" section; Markdown "Skipped files" table + summary line; JSON additiveskippedarray. SARIF unchanged (skips are not security results).New JSON shape (additive)
Only present when something was skipped:
No change when the scan is clean (field omitted).
Example (valid + non-UTF-8 file)
Human:
Exit code
0(driven by findings, not the warning).Tests
non_utf8; clean project has no skips.skippedin JSON, exit driven by findings.fmt/clippy -D warnings/fixtures validate(26 ok) green.Docs
docs/security-review.mdM1 marked fixed;docs/architecture.mddata flow notes partial-tolerant discovery; CHANGELOG[Unreleased]Fixed entry.Rule semantics unchanged. Not Circom, not zkVM, not ZK-REPLAY-001.