Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
rust1.63
0003-CVE-2022-36113-avoid-unpacking-.cargo-ok-f...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-CVE-2022-36113-avoid-unpacking-.cargo-ok-from-the-cr.patch of Package rust1.63
From 3060724fafd35ef225946e98dc43aa6cf4e5eea2 Mon Sep 17 00:00:00 2001 From: Josh Triplett <josh@joshtriplett.org> Date: Thu, 18 Aug 2022 17:17:19 +0200 Subject: [PATCH 2/2] CVE-2022-36113: avoid unpacking .cargo-ok from the crate --- src/cargo/sources/registry/mod.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cargo/sources/registry/mod.rs b/src/tools/cargo/src/cargo/sources/registry/mod.rs index 23e8c71af..b1e246968 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/tools/cargo/src/cargo/sources/registry/mod.rs @@ -643,6 +643,13 @@ impl<'cfg> RegistrySource<'cfg> { prefix ) } + // Prevent unpacking the lockfile from the crate itself. + if entry_path + .file_name() + .map_or(false, |p| p == PACKAGE_SOURCE_LOCK) + { + continue; + } // Unpacking failed let mut result = entry.unpack_in(parent).map_err(anyhow::Error::from); if cfg!(windows) && restricted_names::is_windows_reserved_path(&entry_path) { @@ -658,16 +665,14 @@ impl<'cfg> RegistrySource<'cfg> { .with_context(|| format!("failed to unpack entry at `{}`", entry_path.display()))?; } - // The lock file is created after unpacking so we overwrite a lock file - // which may have been extracted from the package. + // Now that we've finished unpacking, create and write to the lock file to indicate that + // unpacking was successful. let mut ok = OpenOptions::new() - .create(true) + .create_new(true) .read(true) .write(true) .open(&path) .with_context(|| format!("failed to open `{}`", path.display()))?; - - // Write to the lock file to indicate that unpacking was successful. write!(ok, "ok")?; Ok(unpack_dir.to_path_buf()) -- 2.37.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor