Repository navigation
release: v0.0.11 — audit fixes from Cora scan (#221-#231) - #234
Conversation
CRITICAL: - Fix timestamp format mismatch — aging/pruning never worked (RFC3339 vs SQLite datetime) - aging.rs + bulk.rs now compute cutoffs in Rust using chrono (#221) HIGH: - Fix namespace=None inconsistency in tag operations (#222) - Atomic model file writes (.tmp + rename) (#225) - uteke_home() returns Result instead of panic (#226) MEDIUM: - Exact path matching for DELETE /forget (#228) - splitn(2,'=') for query param parsing (#228) - Error on missing --host/--port value (#228) - Generic 404 message, no path reflection (#228) - Index lock acquired before SQLite delete in forget() (#231) LOW: - Validate memory_type against known variants (#229) Other: - Security scanning workflow (cargo audit + Trivy) (#177) - Error::Generic variant for general errors - quinn-proto 0.11.12 -> 0.11.14 (CVE-2026-31812) - Version bump to 0.0.11 - CHANGELOG updated
📝 WalkthroughWalkthroughThis release hardens error handling, file safety, and query logic. ChangesError Handling and Core API Updates
File and Data Integrity
Query Logic Refinement
Server Request and CLI Handling
Release Documentation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
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 docstrings
🧪 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❌ Blocked — critical issues found. 🔴 Error (1)
Review powered by cora-cli · BYOK · MIT |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
crates/uteke-server/src/main.rs (1)
359-367:⚠️ Potential issue | 🟠 Major | ⚡ Quick winHandle flag-like tokens as missing values for
--host/--port.On Line 361 and Line 370, the parser only checks bounds. Inputs like
--host --port 9000incorrectly treat--portas the host value instead of triggering the missing-value error path.Proposed fix
match args[i].as_str() { "--host" => { i += 1; - if i < args.len() { + if i < args.len() && !args[i].starts_with('-') { cli_host = Some(args[i].clone()); } else { eprintln!("Error: --host requires a value"); std::process::exit(1); } } "--port" => { i += 1; - if i < args.len() { + if i < args.len() && !args[i].starts_with('-') { cli_port = Some(args[i].parse().unwrap_or_else(|e| { eprintln!("Invalid port: {e}"); std::process::exit(1); })); } else { eprintln!("Error: --port requires a value"); std::process::exit(1); } }Also applies to: 368-379
🤖 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 `@crates/uteke-server/src/main.rs` around lines 359 - 367, The current argument parsing for the "--host" and "--port" branches (where cli_host and cli_port are set) only checks index bounds and therefore treats flag-like tokens (e.g., "--port") as values; update both branches to additionally verify that args[i] is not a flag (e.g., starts_with('-')) before accepting it as the value, and if it is a flag-like token, emit the existing missing-value error and exit; locate the "--host" and "--port" handling blocks in main.rs and add this extra check when assigning cli_host and cli_port.crates/uteke-core/src/operations.rs (1)
35-46:⚠️ Potential issue | 🟠 Major | ⚡ Quick winNormalize
memory_typeafter validation.Line 36 accepts case-insensitive input, but Line 46 still passes the raw string through, so
"Fact"/"FACT"will be stored verbatim later instead of the canonical lowercase values defined byMemoryType::as_str(). That leaves mixedmemory_typevalues in storage even though this change is meant to constrain them to known variants.Proposed fix
- crate::memory::types::MemoryType::from_str_opt(memory_type).ok_or_else(|| { - Error::Validation(format!( - "Unknown memory type '{memory_type}'. Valid types: fact, procedure, preference, decision, context" - )) - })?; + let memory_type = crate::memory::types::MemoryType::from_str_opt(memory_type) + .ok_or_else(|| { + Error::Validation(format!( + "Unknown memory type '{memory_type}'. Valid types: fact, procedure, preference, decision, context" + )) + })? + .as_str();🤖 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 `@crates/uteke-core/src/operations.rs` around lines 35 - 46, After validating memory_type via MemoryType::from_str_opt, convert it to the canonical lowercase form (use the matched enum's MemoryType::as_str()) and pass that normalized string into remember_precomputed instead of the original raw input; update the code path around MemoryType::from_str_opt and the subsequent call to remember_precomputed (the block that obtains embedding via self.embedder.lock().map_err(...).embed(...)) so the normalized value is used.
🤖 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 `@CHANGELOG.md`:
- Line 10: The changelog entry "## [0.0.11] — 2026-06-07" is using
reference-link style but the corresponding link definition is missing; add a
reference link definition for "[0.0.11]" at the bottom of CHANGELOG.md (and
add/update the "[Unreleased]" reference if your repo uses it) that points to the
release or compare URL for the 0.0.11 tag (e.g., a GitHub compare or release
URL), ensuring the identifier matches the heading exactly so the reference
resolves.
In `@crates/uteke-core/src/memory/aging.rs`:
- Around line 33-37: find_aged() and cleanup_aged() (in aging.rs) each compute
their own cutoff causing boundary races; change the API so the caller computes a
single cutoff once (e.g., in maintenance.rs) and passes it into both operations,
or add a shared helper (e.g., find_and_cleanup_aged_with_cutoff(cutoff: String)
or a helper that accepts chrono::DateTime<Utc>) that both preview (vector-index
removal via find_aged) and delete (cleanup_aged) call with the same cutoff;
update function signatures for find_aged and cleanup_aged to accept the cutoff
parameter and adjust callers in maintenance.rs to compute cutoff via
(chrono::Utc::now() - Duration::days(older_than_days)).to_rfc3339() (or pass
DateTime) and forward it to both operations.
In `@crates/uteke-core/src/memory/bulk.rs`:
- Around line 110-118: find_deprecated_for_prune() and prune_ttl() each compute
their own UTC cutoff which causes mismatched selection vs deletion around the
TTL boundary; compute a single cutoff once (e.g., let cutoff =
chrono::Utc::now() - chrono::Duration::days(ttl_days as i64) or its RFC3339
string) and thread that same value into both functions instead of having them
call Utc::now() internally—update the signatures of
find_deprecated_for_prune(...) and prune_ttl(...) to accept the cutoff
(DateTime<Utc> or &str) and change the call sites in maintenance.rs to compute
cutoff once and pass it into both calls so the IDs selected and the rows deleted
use the identical cutoff.
---
Outside diff comments:
In `@crates/uteke-core/src/operations.rs`:
- Around line 35-46: After validating memory_type via MemoryType::from_str_opt,
convert it to the canonical lowercase form (use the matched enum's
MemoryType::as_str()) and pass that normalized string into remember_precomputed
instead of the original raw input; update the code path around
MemoryType::from_str_opt and the subsequent call to remember_precomputed (the
block that obtains embedding via self.embedder.lock().map_err(...).embed(...))
so the normalized value is used.
In `@crates/uteke-server/src/main.rs`:
- Around line 359-367: The current argument parsing for the "--host" and
"--port" branches (where cli_host and cli_port are set) only checks index bounds
and therefore treats flag-like tokens (e.g., "--port") as values; update both
branches to additionally verify that args[i] is not a flag (e.g.,
starts_with('-')) before accepting it as the value, and if it is a flag-like
token, emit the existing missing-value error and exit; locate the "--host" and
"--port" handling blocks in main.rs and add this extra check when assigning
cli_host and cli_port.
🪄 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: 890c6b44-4131-423f-85b8-ccd7b6776375
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (11)
CHANGELOG.mdCargo.tomlcrates/uteke-core/src/embed/engine.rscrates/uteke-core/src/error.rscrates/uteke-core/src/lib.rscrates/uteke-core/src/maintenance.rscrates/uteke-core/src/memory/aging.rscrates/uteke-core/src/memory/bulk.rscrates/uteke-core/src/memory/tags.rscrates/uteke-core/src/operations.rscrates/uteke-server/src/main.rs
|
|
||
| ## [Unreleased] | ||
|
|
||
| ## [0.0.11] — 2026-06-07 |
There was a problem hiding this comment.
Add missing changelog reference links for the new heading.
## [0.0.11] uses reference-link style, but [0.0.11] (and typically [Unreleased]) link definitions are missing at the bottom, so this entry won’t resolve to a release URL.
Suggested patch
+[Unreleased]: https://github.com/ajianaz/uteke/compare/v0.0.11...HEAD
+[0.0.11]: https://github.com/ajianaz/uteke/releases/tag/v0.0.11
[0.0.10]: https://github.com/ajianaz/uteke/releases/tag/v0.0.10
[0.0.9]: https://github.com/ajianaz/uteke/releases/tag/v0.0.9🤖 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 `@CHANGELOG.md` at line 10, The changelog entry "## [0.0.11] — 2026-06-07" is
using reference-link style but the corresponding link definition is missing; add
a reference link definition for "[0.0.11]" at the bottom of CHANGELOG.md (and
add/update the "[Unreleased]" reference if your repo uses it) that points to the
release or compare URL for the 0.0.11 tag (e.g., a GitHub compare or release
URL), ensuring the identifier matches the heading exactly so the reference
resolves.
| // Compute cutoffs in Rust using chrono (RFC3339) to match stored timestamp format. | ||
| // SQLite datetime('now') returns a different format than our RFC3339 strings, | ||
| // causing lexicographic comparison to fail. | ||
| let cutoff = | ||
| (chrono::Utc::now() - chrono::Duration::days(older_than_days as i64)).to_rfc3339(); |
There was a problem hiding this comment.
Share a single aging cutoff across preview and delete.
Lines 33-37 and Lines 77-78 now compute cutoff independently, but crates/uteke-core/src/maintenance.rs first calls find_aged() to collect IDs for vector-index removal and then calls cleanup_aged() to delete from SQLite. A record near the boundary can fall into only one of those two queries, which leaves SQLite and the vector index out of sync. Compute the cutoff once in the caller and pass it through both operations, or route both methods through a shared helper that accepts an explicit cutoff.
Also applies to: 77-78
🤖 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 `@crates/uteke-core/src/memory/aging.rs` around lines 33 - 37, find_aged() and
cleanup_aged() (in aging.rs) each compute their own cutoff causing boundary
races; change the API so the caller computes a single cutoff once (e.g., in
maintenance.rs) and passes it into both operations, or add a shared helper
(e.g., find_and_cleanup_aged_with_cutoff(cutoff: String) or a helper that
accepts chrono::DateTime<Utc>) that both preview (vector-index removal via
find_aged) and delete (cleanup_aged) call with the same cutoff; update function
signatures for find_aged and cleanup_aged to accept the cutoff parameter and
adjust callers in maintenance.rs to compute cutoff via (chrono::Utc::now() -
Duration::days(older_than_days)).to_rfc3339() (or pass DateTime) and forward it
to both operations.
| // Compute cutoff in Rust (RFC3339) to match stored timestamp format. | ||
| let cutoff = (chrono::Utc::now() - chrono::Duration::days(ttl_days as i64)).to_rfc3339(); | ||
| let deleted = self | ||
| .conn | ||
| .execute( | ||
| "DELETE FROM memories WHERE namespace = ?1 | ||
| AND deprecated = 1 | ||
| AND datetime(updated_at) < datetime('now', '-' || ?2 || ' days')", | ||
| params![ns, ttl_days], | ||
| AND updated_at < ?2", | ||
| params![ns, cutoff], |
There was a problem hiding this comment.
Use one TTL cutoff for both prune selection and prune deletion.
find_deprecated_for_prune() and prune_ttl() now generate their own Utc::now() cutoffs, but crates/uteke-core/src/maintenance.rs uses the first call’s IDs to clean the vector index after the second call deletes from SQLite. That makes the selected set and deleted set drift at the TTL boundary, which can orphan index entries or remove still-live IDs from the index. Please thread a single cutoff through both queries.
Also applies to: 131-143
🤖 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 `@crates/uteke-core/src/memory/bulk.rs` around lines 110 - 118,
find_deprecated_for_prune() and prune_ttl() each compute their own UTC cutoff
which causes mismatched selection vs deletion around the TTL boundary; compute a
single cutoff once (e.g., let cutoff = chrono::Utc::now() -
chrono::Duration::days(ttl_days as i64) or its RFC3339 string) and thread that
same value into both functions instead of having them call Utc::now()
internally—update the signatures of find_deprecated_for_prune(...) and
prune_ttl(...) to accept the cutoff (DateTime<Utc> or &str) and change the call
sites in maintenance.rs to compute cutoff once and pass it into both calls so
the IDs selected and the rows deleted use the identical cutoff.
Summary
v0.0.11 release — comprehensive fixes from Cora full-project security scan. Closes #221, #222, #225, #226, #228, #229, #231.
Critical Fixes
datetime('now')format doesn't match stored RFC3339 strings. Now computes cutoffs in Rust usingchrono.High Priority Fixes
namespace=Noneinconsistency — tag operations now treatNoneas "all namespaces" consistently withunique_tags().tmp+ rename pattern, cleans up leftover temp files on startuputeke_home()returnsResultinstead of panicking when home directory can't be determinedMedium Priority Fixes
/forgetpath match,splitn(2,'=')for query params, error on missing CLI values, generic 404 messageforget()acquires index lock before SQLite delete to narrow inconsistency windowLow Priority Fixes
memory_typevalidated against known variants inremember_typed()Other Changes
Error::GenericvariantTest Results
Summary by CodeRabbit
New Features
Bug Fixes
/forgetoperationsChanged