Skip to content

[uv] Rebase upstream - #2

Closed
naveenOnarayanan wants to merge 7 commits into
mainfrom
nn/rebase-main
Closed

[uv] Rebase upstream#2
naveenOnarayanan wants to merge 7 commits into
mainfrom
nn/rebase-main

Conversation

@naveenOnarayanan

Copy link
Copy Markdown

Summary

Test Plan

naveenOnarayanan and others added 7 commits April 9, 2026 06:51
When exclude-newer is computed from a relative span (e.g., "P7D"),
the resulting timestamp now gets truncated to the start of the day
(midnight UTC) instead of preserving second/millisecond precision.

This eliminates lockfile churn caused by different developers running
`uv lock` at slightly different times on the same day — they will all
get the same `T00:00:00Z` timestamp. The timestamp only changes when
the calendar day boundary crosses.

Applied to both code paths:
- `ExcludeNewerValue::recompute()` — called when tools re-evaluate spans
- `ExcludeNewerValue::from_str()` — called when initially parsing spans

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Check that only files inside the installation scheme can be removed when
uv uninstalls a package. This fixes a bug where uv would try to remove
arbitrary files due to a malformed or malicious RECORD file in a wheel.
For venvs, the installation prefix is the entire venv, as `.data/data`
allows wheels to write to the entire venv, so all files in the venv can
also be removed.

This is both a correctness fix (uv should never remove files outside its
domain) and a low severity security fix, where a malicious wheel could
remove a user's files during uninstallation, such as a `uv sync` that
upgrades the package version. Note that this requires an attacker having
control over the wheel, which also allows them to modify arbitrary
Python code. There are no known cases of wheels actually referencing
files outside the installation scheme in their RECORD.
…-sh#18856)

## Summary

Closes astral-sh#16586

Adds a public function to `uv-fs` crate called `verbatim_path` which is
now leveraged by `rm_rf` in `uv-cache` crate for cleaning paths that
require verbatim composition to avoid failures seen in astral-sh#16586.

## Test Plan

Tested locally on Windows 10 and 11 by setting `UV_CACHE_DIR` to a local
directory and then running `uv init`, `uv add uwsgi`, and `uv cache
clean` to ensure there is no failures.

Additionally unit and integration tests were added to avoid future
regressions.
Check the RECORD of a wheel file and heal it if necessary, to ensure the
RECORD and the wheel contents always match, and uninstallation can't
remove files that don't belong to the wheel. This check and repair
happen between unpacking a wheel and persisting it in the cache,
ensuring that every wheel that ends up in the cache has a valid RECORD.

We collect the paths from the archive in the unpacking step, I added it
in all unpacking steps for consistency. I also improved the consistency
around RECORD handling code.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
## Summary

This is towards astral-sh#18781 -- we now have a small `Filter` type, and we can
filter an OSV query to limit it to just malware results by passing
`Filter::Malware`. This has no performance cost versus normal queries
since with OSV's "batch query" API we can cheaply pre-filter IDs before
actually fetching the full OSV payloads.

## Test Plan

Added a unit test that exhibits the filtering.

---------

Signed-off-by: William Woodruff <william@astral.sh>
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.

5 participants