SHA256 from `PACKAGES` is not checked against the downloaded file
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
Hướng nghiên cứu
Look at package-cache.R lines 275-282 where sha256 is replaced, and packages-gz.R lines 466-470 where the race happens. The fix involves adding a hash check after download_one_of() returns, before accepting the file. Also ensure the SHA256sum: field is parsed correctly, stripping whitespace and newlines. Test by simulating a mismatch with a mock download source.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The sha256 that pkgdepends passes to async_copy_or_add() is never compared with the download. After download_one_of() returns, it is replaced by the hash of whatever arrived:
For CRAN macOS binaries, download_one_of() races the CRAN mirror against mac.cran.dev and keeps the first to finish, so a stale file on mac.cran.dev gets installed even if it does not match PACKAGES:
This is currently the case for adbcdrivermanager 0.24.0-3 on macOS with R 4.6. Since the zstd mix-up (r-lib/pkgdepends#485, r-lib/pak#915), the file on cran.rstudio.com is gzip again and matches PACKAGES (3b73522a…), while mac.cran.dev still serves the zstd file (2bd7d854…). Our CI got the mac.cran.dev copy and failed with "unknown archive type".
A check would also need the hash parsed correctly. The SHA256sum: field in CRAN's macOS PACKAGES is folded onto a continuation line. Base R's read.dcf() returns the bare hash, but the parsed value here keeps the line break and indentation:
pak::pkg_download(
"adbcdrivermanager",
dest_dir = tempfile(),
platforms = "aarch64-apple-darwin23",
r_versions = "4.6",
dependencies = FALSE
)$sha256
#> [1] "\n 3b73522a5d65d7dad8ddcbfed2045da6d61ae25458d3c973f55928d937166ed5"
Could a download that does not match the expected hash be rejected, so the other source is used instead? If that sounds reasonable, I'm happy to propose a PR.
- Ngôn ngữ chính
- R
- Star
- 30
- Fork
- 19
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của r-lib/pkgcache
-
`pkgcache:::is_ppm_linux_repo_url()` does not recognize manylinux_2_28 as a valid binary distroĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
PPM and ARM images for LinuxĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
-
Improve extra CRAN metadataĐang mởupkeep
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của r-lib/pkgcache
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
hubverse-org/hubDevs#83 ·
-
data_bio2rarify - doc - dimensions wrongCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
leppott/BioMonTools#162 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
publications
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
epiforecasts/epiforecasts.github.io#161 ·
Maintainer thường phản hồi trong vòng 1 ngày