Skip to content

fix(upgrade): harden temp dir, download timeouts, checksum match, and update-check opt-out - #1310

Merged
ajianaz merged 1 commit into
developfrom
fix/upgrade-scan-hardening
Oct 5, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/upgrade-scan-hardening

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

What

Hardening of the uteke upgrade / update-check surface from the post-merge cora scan triggered by #1307 (4 findings fixed, all pre-existing, none introduced by #1308/#1309):

  1. Predictable temp dir (MAJOR, security) — the upgrade workspace was /tmp/uteke-update-{version}: a local attacker can pre-create that path (or a symlink to it) and clobber files written during extraction. Now a private tempfile::TempDir (random suffix, 0700). Bonus: TempDir cleanup on drop replaces the five scattered manual fs::remove_dir_all calls, fixing the temp-dir-leak-on-early-return finding too.
  2. No download timeout (MINOR) — the archive/checksums client now has a 10s connect / 300s overall timeout; a stalled connection can no longer hang uteke upgrade forever.
  3. Substring checksum lookup (MINOR) — parse_checksum requires an exact filename match so a companion artifact (e.g. .sig) can never satisfy the lookup; regression test added.
  4. update_check = false ignored on fresh cache (MAJOR, bugs) — the CLI fast path printed the update banner without consulting the config opt-out (only the background-thread path checked it). Opt-out is now respected on every path.

Why

Follow-the-loop from #1307/#1308/#1309: post-merge cora scan of crates/uteke-cli/src/commands + crates/uteke-core/src/update_check.rs surfaced these pre-existing issues in the same surface; fixed before they ship in the next patch release.

Testing

  • cargo clippy -p uteke-core -p uteke-cli --all-features -- -D warnings — clean
  • cargo test -p uteke-cli upgrade:: — 6 passed (incl. new exact-match checksum test)
  • cargo test -p uteke-core update_check — 11 passed
  • Live E2E: uteke upgrade -y → [INFO] Already up to date (0.19.0) (resolution path unaffected)
  • Note: the real download/extract path is exercised only during an actual version change; covered here by compile + replace_binary tests, full-path E2E belongs to the next release QA.

… update-check opt-out

Findings from the post-merge cora scan of the commands surface
(#1307 thread):

- upgrade: replace the predictable shared temp dir
  (/tmp/uteke-update-{version}, symlink-attack + collision-prone)
  with a private tempfile::TempDir (random suffix, 0700) that also
  removes leftovers on every early-return path — the five manual
  fs::remove_dir_all cleanup lines are gone with it.
- upgrade: bound the archive/checksums download client (10s connect,
  300s overall) so a stalled connection cannot hang the upgrade.
- upgrade: parse_checksum now requires an exact filename match
  instead of a substring, so a companion artifact (e.g. .sig) can
  never satisfy the lookup; unit test included.
- update_check: the update_check = false opt-out in uteke.toml is
  now honored on the fresh-cache fast path too — previously it was
  only checked inside the background thread, so opt-out users still
  saw the banner whenever the 24h cache was fresh.
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit d9e3164 into develop Oct 5, 2026
15 checks passed
@ajianaz
ajianaz deleted the fix/upgrade-scan-hardening branch October 5, 2026 02:54
ajianaz added a commit that referenced this pull request Oct 5, 2026
* chore(release): v0.19.1 - version bump, changelog, docs sync

- Workspace + internal dependency versions 0.19.0 -> 0.19.1 (Cargo.lock synced)
- CHANGELOG: [0.19.1] entry - upgrade-path reliability (#1307 via #1308/#1309/#1310),
  plain /remember explicit-type fix (#1303), committed Hermes plugin package (#1301)
- Bundled uteke-memory skill + .agents canonical copy bumped in lockstep
- README/README.id current-version line synced

* chore(release): regenerate core-contract.json for 0.19.1

docgen embeds the workspace version; the API Docs Fresh gate caught
the stale generated artifact.

---------

Co-authored-by: ajianaz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant