Repository navigation
fix: v0.1.8 patch batch — 8 quality/security/bug fixes - #109
Conversation
Closes #87: unwrap() → expect() in ProgressStyle (llm.rs, scanner.rs) Closes #83: consolidate duplicate Severity impl blocks into one Closes #88: fix AGENT.md config validate → show/set references Closes #77: file_content_hash returns Option<String> instead of empty string on read failure (prevents rescan loop) Closes #76: log permission errors in scanner file walk at debug level Closes #72: warn if auth file has overly permissive permissions (Unix) Closes #81: replace non-deterministic DefaultHasher with sha2 for scan cache (deterministic across Rust versions) Closes #82: validate SARIF file size before upload (GitHub 10MB limit)
|
Warning Review limit reached
More reviews will be available in 32 minutes and 47 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughPR adds file permission warnings for auth files, enforces 10MB SARIF upload limits, refactors incremental scan hashing from DefaultHasher to SHA-256 with Option-based unreadable-file handling, improves file-read error logging, hardens error messages, and corrects documentation describing the config command. ChangesSecurity Hardening, Hash Refactor, and Robustness Improvements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-cli · BYOK · MIT |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/commands/scan.rs (1)
189-190: ⚡ Quick winClarify the "no truncation" comment.
The comment states "no truncation" but the code is taking only the first 8 bytes of the 32-byte SHA-256 hash. While this might refer to the hex conversion (each byte is fully represented as 2 hex digits), the phrasing could confuse future maintainers.
Consider rephrasing to be more explicit:
- // Use first 8 bytes as hex — consistent representation, no truncation + // Take first 8 bytes of 32-byte hash and format as 16-char hex string Some(hash.iter().take(8).map(|b| format!("{b:02x}")).collect())🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/scan.rs` around lines 189 - 190, The comment "no truncation" is misleading because the code takes only the first 8 bytes of the 32-byte SHA-256 digest; update the comment near the Some(hash.iter().take(8).map(|b| format!("{b:02x}")).collect()) expression to clearly state that we intentionally use an 8-byte prefix (16 hex characters) as a short identifier and that each byte is fully represented as two hex digits (i.e., bytes aren't partially truncated, but the digest is shortened to a prefix).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/upload.rs`:
- Around line 43-51: The error message uses integer division when computing MB,
causing truncation; update the check around MAX_SARIF_SIZE and the bail! call to
compute the human-readable size as a floating-point MiB value (e.g., let
size_mib = sarif_content.len() as f64 / (1024.0 * 1024.0)) and format it with a
fixed precision (such as two decimals) in the bail! message, and consider
labeling the units as "MiB" to reflect binary units; modify the code that reads
sarif_content.len() and the bail! invocation so it prints the formatted size_mib
instead of the integer division result.
---
Nitpick comments:
In `@src/commands/scan.rs`:
- Around line 189-190: The comment "no truncation" is misleading because the
code takes only the first 8 bytes of the 32-byte SHA-256 digest; update the
comment near the Some(hash.iter().take(8).map(|b| format!("{b:02x}")).collect())
expression to clearly state that we intentionally use an 8-byte prefix (16 hex
characters) as a short identifier and that each byte is fully represented as two
hex digits (i.e., bytes aren't partially truncated, but the digest is shortened
to a prefix).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 64557a6c-cc00-4e21-83aa-89123eab60e9
📒 Files selected for processing (7)
AGENT.mdsrc/commands/scan.rssrc/commands/upload.rssrc/config/loader.rssrc/engine/llm.rssrc/engine/scanner.rssrc/engine/types.rs
Prevents 'No checksums file found' warning in cora-review CI action. Checksums are generated from all release artifacts and uploaded to the GitHub release alongside binaries.
Co-authored-by: CodeCora <codecora@users.noreply.github.com>
c81fc93 to
1f5810c
Compare
Summary
8 fixes from issue backlog — quality, security, and bug fixes only. No new features.
Fixes
unwrap()→expect("valid spinner template")inProgressStyle::with_template()impl Severityblocks into oneconfig validatesubcommandfile_content_hashreturnsOption<String>instead of empty string on read failurechmod 600hint)DefaultHasherwithsha2for scan cacheValidation
cargo clippycleancargo build --releasecleanFiles Changed
src/engine/llm.rs— 1 linesrc/engine/scanner.rs— 5 linessrc/engine/types.rs— 24 lines (consolidated impl)src/commands/scan.rs— 26 lines (sha2 + Option return)src/commands/upload.rs— 10 lines (size check)src/config/loader.rs— 16 lines (permission check)AGENT.md— 4 lines (doc fix)Summary by CodeRabbit
New Features
Bug Fixes
Documentation