Skip to content

Comments

Switch from tokio-tar to astral-tokio-tar (CVE-2025-62518)#32

Merged
spatten merged 2 commits intomainfrom
fix/switch-to-astral-tokio-tar
Feb 20, 2026
Merged

Switch from tokio-tar to astral-tokio-tar (CVE-2025-62518)#32
spatten merged 2 commits intomainfrom
fix/switch-to-astral-tokio-tar

Conversation

@spatten
Copy link
Contributor

@spatten spatten commented Feb 20, 2026

Overview

This PR switches from tokio-tar to astral-tokio-tar@0.5.6 to address CVE-2025-62518.

tokio-tar is vulnerable to the same PAX/ustar header desynchronization issue described in the CVE: when PAX extended headers contain a size override, the parser uses the ustar header size (often zero) instead, allowing an attacker to smuggle entries into a tar archive. Since tokio-tar appears 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 an Entry::unpack_in() return type change (boolOption<PathBuf>).

Acceptance criteria

Circe is no longer vulnerable to PAX header desynchronization attacks when processing tar archives.

Testing plan

  1. cargo build succeeds.
  2. cargo nextest run --all-targets — all 77 tests pass.
  3. cargo test --doc — all 10 doc tests pass.

Metrics

N/A

Risks

astral-tokio-tar is a fork of tokio-tar with a slightly different API for Entry::unpack_in() (returns Option<PathBuf> instead of bool). This has been adapted in lib/src/cio.rs. The rest of the API is compatible.

References

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).

Existing tests cover the affected code paths. The vulnerability fix itself is in the upstream dependency.

spatten and others added 2 commits February 20, 2026 15:01
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.
Copy link
Contributor Author

@spatten spatten Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@spatten spatten marked this pull request as ready for review February 20, 2026 23:10
@spatten spatten requested a review from a team as a code owner February 20, 2026 23:10
@spatten spatten requested a review from tjugdev February 20, 2026 23:10
@spatten spatten mentioned this pull request Feb 20, 2026
1 task
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Walkthrough

The 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 tokio-tar 0.3.1 with astral-tokio-tar 0.5.6 in both the bin and lib manifests. Additionally, error handling in the cio.rs file is refined by replacing a negated unwrap_warn call with an explicit .is_none() check in the apply_tarball function's unpack result handling.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: switching to astral-tokio-tar and the specific CVE being addressed.
Description check ✅ Passed The PR description comprehensively covers all template sections with relevant details: clear overview explaining the CVE issue, acceptance criteria, detailed testing plan with specific commands, risks with API changes documented, and proper references to CVE and advisories.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

77-82: PATCH extraction via cut is fragile if the version ever carries a pre-release suffix.

cut -d. -f3 on a version like "0.0.0-alpha" yields "0-alpha", causing $((PATCH + 1)) to either silently produce the wrong value or fail under set -e. A safer extraction uses cut only after stripping any pre-release component, or delegates to cargo 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-alpha0) 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.

@spatten spatten merged commit 2824141 into main Feb 20, 2026
19 checks passed
@spatten spatten deleted the fix/switch-to-astral-tokio-tar branch February 20, 2026 23:50
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.

2 participants