fix: security, data safety, and stability fixes (#973-#980) - #983
Merged
Conversation
- uteke-status: use execFileSync("sqlite3", [dbPath, sql]) instead of
interpolated shell string
- pi-memory-provider: use execFileSync(bin, args) instead of joined
string, remove manual double-quoting of arguments
- Prevents command injection via shell metacharacters in paths/args
β¦974 #975 #976 #977) - aging.rs: add AND pinned = 0 to cleanup_aged DELETE to prevent pinned memory data loss (#974) - fts5.rs: fix rank column index from 14 (importance) to 19 (f.rank) in all 4 query branches β search ranking was broken (#975) - store.rs: fix pinned importance formula from 0.2*0.0 to 0.2*if pinned {1.0} else {0.0} (#976) - crud.rs: wrap update() and update_fields() in unchecked_transaction for memory+tags dual-write atomicity (#977)
β¦l.ps1 (#978 #979 #980) - Add safe_truncate() helper that respects UTF-8 char boundaries - Replace 3 unsafe &str[..N] slicing locations with safe_truncate() (lib.rs x2, room.rs x1) β prevents panic on multi-byte content - vector.rs build(): validate all items have consistent dimensions before inserting, return Error::validation on mismatch - install.ps1: add exit 1 after checksum mismatch to stop installation of corrupted/tampered archive
| "DELETE FROM memory_tags WHERE memory_id = ?1", | ||
| params![memory.id], | ||
| ) | ||
| .map_err(|e| Error::db("delete old tags", e))?; |
| .query_map(params![fts_query, ns, limit as i64], |row| { | ||
| let memory = row_to_memory(row)?; | ||
| let rank: f64 = row.get(14)?; | ||
| let rank: f64 = row.get(19)?; |
| $actualHash = (Get-FileHash -Algorithm SHA256 $archivePath).Hash.ToLower() | ||
| if ($actualHash -ne $expectedHash.ToLower()) { | ||
| Write-ErrorMsg "Checksum mismatch! Expected: $expectedHash, Got: $actualHash" | ||
| exit 1 |
π Cora AI Code Reviewβ Blocked β critical issues found. π΄ Error (3)
Correction: Upon closer inspection, the addition of Re-evaluation: This is actually a good fix. No issue. Review powered by cora-code Β· BYOK Β· MIT |
This was referenced Aug 10, 2026
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.
What
Fixes 8 validated bugs from cora re-scan across 3 priority tiers: security (P4), data safety (P5), and stability (P6).
Why
Cora re-scan found 167 findings. After validation, 10 GitHub issues were created (#973-#982). This PR addresses 8 of them β the 2 remaining (#981 CLI JSON, #982 Windows vector race) are lower priority and deferred.
Changes
P4 β Security (#973)
execSync->execFileSync("sqlite3", [dbPath, sql])β prevents shell injection via pathsexecSync->execFileSync(bin, args)β prevents shell injection, removed manual double-quotingP5 β Data Safety
AND pinned = 0tocleanup_agedDELETE β pinned memories were being deletedrow.get(14)->row.get(19)forf.rank(4 locations) β was reading importance column instead of rank0.2 * 0.0->0.2 * if m.pinned { 1.0 } else { 0.0 }β pinned bonus was always zeroupdate()andupdate_fields()inunchecked_transaction()β atomic memory + tags writeP6 β Stability
safe_truncate()helper, replaced 3 unsafe&str[..N]slicing β prevents UTF-8 panic on multi-byte contentbuild()validates all items have consistent dimensions before insert β prevents index corruptionexit 1after checksum mismatch β was printing error then continuingTesting
cargo fmt --allpasscargo clippy --workspace --all-targetsβ 0 warningscargo test --workspaceβ 476 passed, 0 failed, 26 ignored