mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-25 05:33:43 +00:00
Require HTTPS for CDN requests (#15660)
## Summary This should arguably enforce same-realm (as the API), but this is a good guardrail for now.
This commit is contained in:
parent
ad35d120d6
commit
8473ecba11
1 changed files with 8 additions and 1 deletions
|
|
@ -539,7 +539,7 @@ fn is_known_url(url: &Url, api: &DisplaySafeUrl, cdn: &str) -> bool {
|
|||
//
|
||||
// For example, if URL is on `files.astralhosted.com` and the CDN domain is
|
||||
// `astralhosted.com`, consider it known.
|
||||
if matches_domain(url, cdn) {
|
||||
if matches!(url.scheme(), "https") && matches_domain(url, cdn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -603,6 +603,13 @@ mod tests {
|
|||
cdn_domain
|
||||
));
|
||||
|
||||
// CDN on HTTP.
|
||||
assert!(!is_known_url(
|
||||
&Url::parse("http://astralhosted.com/packages/").unwrap(),
|
||||
&api_url,
|
||||
cdn_domain
|
||||
));
|
||||
|
||||
// Unknown domain.
|
||||
assert!(!is_known_url(
|
||||
&Url::parse("https://pypi.org/simple/").unwrap(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue