Switch from tokio-tar to astral-tokio-tar (CVE-2025-62518)#32
Conversation
tokio-tar is vulnerable to the same PAX/ustar header desynchronization issue (CVE-2025-62518) that was fixed in astral-tokio-tar 0.5.6. Since tokio-tar appears unmaintained, switch to the actively maintained fork. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use a version greater than the current Cargo.toml version for non-tag builds by bumping the patch version and appending the git sha, instead of using 0.0.0 which fails validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| cargo set-version $VERSION | ||
| else | ||
| # For non-tag builds, use 0.0.0-{git-sha} format | ||
| # For non-tag builds, use a pre-release version based on the git sha. |
There was a problem hiding this comment.
I had to make this change to fix the release build. Rust no longer allows you to create a release version < the current version, and the current version is 0.0.0, and 0.0.0-<git SHA> is less than 0.0.0.
WalkthroughThe pull request updates the release workflow to compute pre-release versions dynamically by incrementing the patch version from Cargo.toml and appending the git SHA, replacing the fixed 0.0.0-based versioning. Dependencies are upgraded by replacing 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/release.yml (1)
77-82:PATCHextraction viacutis fragile if the version ever carries a pre-release suffix.
cut -d. -f3on a version like"0.0.0-alpha"yields"0-alpha", causing$((PATCH + 1))to either silently produce the wrong value or fail underset -e. A safer extraction usescutonly after stripping any pre-release component, or delegates tocargo metadata's semver fields.♻️ Proposed robustness fix
- PATCH=$(echo "$CURRENT" | cut -d. -f3) + PATCH=$(echo "$CURRENT" | cut -d. -f3 | cut -d- -f1)This strips any trailing pre-release label (e.g.,
0-alpha→0) before the arithmetic, making the step robust against non-pure patch versions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release.yml around lines 77 - 82, The PATCH extraction is fragile when CURRENT contains a pre-release suffix; update the workflow to strip any pre-release label from CURRENT before computing PATCH (or parse semver fields via cargo metadata) so that PATCH becomes a pure integer; specifically, modify the logic around CURRENT / PATCH (which currently uses cut -d. -f3) to remove anything after a hyphen (or otherwise extract the third numeric segment) before doing $((PATCH + 1)), then continue to use MAJOR, MINOR, GIT_SHA and cargo set-version as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/release.yml:
- Around line 77-82: The PATCH extraction is fragile when CURRENT contains a
pre-release suffix; update the workflow to strip any pre-release label from
CURRENT before computing PATCH (or parse semver fields via cargo metadata) so
that PATCH becomes a pure integer; specifically, modify the logic around CURRENT
/ PATCH (which currently uses cut -d. -f3) to remove anything after a hyphen (or
otherwise extract the third numeric segment) before doing $((PATCH + 1)), then
continue to use MAJOR, MINOR, GIT_SHA and cargo set-version as before.
Overview
This PR switches from
tokio-tartoastral-tokio-tar@0.5.6to address CVE-2025-62518.tokio-taris vulnerable to the same PAX/ustar header desynchronization issue described in the CVE: when PAX extended headers contain asizeoverride, the parser uses the ustar header size (often zero) instead, allowing an attacker to smuggle entries into a tar archive. Sincetokio-tarappears unmaintained, we switch to the actively maintained fork which has the fix in v0.5.6.Both crates export as
tokio_tar, so no import changes were needed — only anEntry::unpack_in()return type change (bool→Option<PathBuf>).Acceptance criteria
Circe is no longer vulnerable to PAX header desynchronization attacks when processing tar archives.
Testing plan
cargo buildsucceeds.cargo nextest run --all-targets— all 77 tests pass.cargo test --doc— all 10 doc tests pass.Metrics
N/A
Risks
astral-tokio-taris a fork oftokio-tarwith a slightly different API forEntry::unpack_in()(returnsOption<PathBuf>instead ofbool). This has been adapted inlib/src/cio.rs. The rest of the API is compatible.References
Checklist
Existing tests cover the affected code paths. The vulnerability fix itself is in the upstream dependency.