Repository navigation
fix(cli): harden uteke upgrade (tag chars, download size cap, archive path check) (#1421) - #1422
Merged
Merged
Conversation
… path check) (#1421) - restrict the version tag to [0-9A-Za-z.-] (suffix included) and re-check it before building the URL/file name - cap the archive (128 MiB) and checksums file (1 MiB) while streaming and from Content-Length - component-based archive entry path check instead of contains("..") - stronger UTEKE_UPGRADE_SKIP_CHECKSUM warning Refs #1327 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…cap (#1421) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Oct 13, 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
Hardens
uteke upgrade(crates/uteke-cli/src/commands/upgrade.rs), the signature-independent part of #1327:is_valid_version_tagnow requires the whole tag (suffix too) to be[0-9A-Za-z.-]and a single optional leadingv(it used to trim any number ofvs and never look at the suffix, sov1.2.3-../xpassed).run()re-validates the tag right before it is used in the URL and file name.checksums-sha256.txtat 1 MiB. Enforced while streaming (copy_capped, reads at most max+1 bytes) so a missing or lyingContent-Lengthcannot bypass it;check_declared_lenalso rejects early from the header.contains("..")replaced byis_safe_archive_path, which accepts onlyNormal/CurDircomponents (rejects absolute, prefix and any..component). Existing layouts (uteke,./uteke,libonnxruntime*) still pass; names likea..b, wrongly refused before, are now accepted.UTEKE_UPGRADE_SKIP_CHECKSUM: kept, but the warning is now a multi-line stderr banner stating the archive is not verified and will be executed as-is. Owner decision needed: keep or remove this escape hatch (with signature verification coming, it may no longer be justified).Not included: signature verification (needs the first signed release to pin the certificate identity), workflow and SECURITY.md changes.
Why
The unchecked tag suffix flowed into a URL and a file name, the download was unbounded, and the traversal check was substring-based. See #1327 / #1421.
Testing
New unit tests: tag suffix restriction (fails against the old validator, which accepted
v1.2.3-../x),copy_cappedwith exact/over-limit bodies and no Content-Length (stops at max+1),check_declared_len, component-based path check. No network in tests.The other tests exercise new helper functions, so they cannot pass without the change; the real streaming download was not run (no network in the session), only the pure helpers are covered.
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspaceall pass.Refs #1327
Closes #1421
🤖 Generated with Claude Code