Driver table: a referer per row, sent as curl -e (drivers.amd.com answers 403 without an amd.com one; the AMD row carries it); a plain user agent on the download

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit edac467dbd)
This commit is contained in:
igneum-labs 2026-10-07 12:17:14 +00:00
parent 015e6d5a6a
commit 53cd1ee767
3 changed files with 20 additions and 3 deletions

View file

@ -59,7 +59,15 @@ pub fn download(e: &VendorEntry, dir: &Path) -> Result<PathBuf, String> {
let _ = std::fs::remove_file(&part);
}
if have != e.size {
curl(&["-fsSL", "--retry", "3", "--retry-delay", "5", "-C", "-", "--max-time", "7200", "-o", &part.display().to_string(), &e.url], Duration::from_secs(7260))?;
// drivers.amd.com answers 403 without an amd.com Referer (igneum-build-2, 7 October 2026): the row names one
let mut args = vec!["-fsSL", "--retry", "3", "--retry-delay", "5", "-C", "-", "--max-time", "7200", "-A", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) IgneumMiner"];
if !e.referer.is_empty() {
args.push("-e");
args.push(&e.referer);
}
let part_s = part.display().to_string();
args.extend(["-o", &part_s, &e.url]);
curl(&args, Duration::from_secs(7260))?;
}
let got = std::fs::metadata(&part).map(|m| m.len()).unwrap_or(0);
if got != e.size {

View file

@ -18,6 +18,8 @@ pub struct VendorEntry {
pub sha256: String,
/// where the sha256 was read (the vendor's page), for the record on the row
pub hash_source: String,
/// a Referer the vendor's server requires (drivers.amd.com answers 403 without an amd.com one); empty = none
pub referer: String,
/// the installer's silent arguments
pub args: Vec<String>,
/// exit codes that mean "installed, restart required"
@ -59,6 +61,7 @@ impl Table {
size: e.get("size").and_then(|x| x.as_u64()).unwrap_or(0),
sha256: s(e, "sha256").to_ascii_lowercase(),
hash_source: s(e, "hash_source"),
referer: s(e, "referer"),
args: e.get("args").and_then(|a| a.as_array()).map(|a| a.iter().filter_map(|x| x.as_str()).map(|x| x.to_string()).collect()).unwrap_or_default(),
reboot_codes: e.get("reboot_codes").and_then(|a| a.as_array()).map(|a| a.iter().filter_map(|x| x.as_i64()).collect()).unwrap_or_default(),
signer: s(e, "signer"),
@ -80,6 +83,9 @@ impl Table {
if entry.args.is_empty() || entry.args.iter().any(|a| a.contains(['"', '\'', '&', '|', ';', '`'])) {
return Err(format!("drivers.{name}: args must be plain switches"));
}
if !entry.referer.is_empty() && !entry.referer.starts_with("https://") {
return Err(format!("drivers.{name}: referer must be https"));
}
if entry.signer.is_empty() {
return Err(format!("drivers.{name}: signer is missing (the Authenticode subject word)"));
}
@ -244,7 +250,7 @@ mod tests {
const TABLE: &str = r#"{"updated":"2026-10-07","vendors":{
"nvidia":{"min_version":"570.00","version":"617.42","url":"https://us.download.nvidia.com/Windows/617.42/617.42-desktop-win10-win11-64bit-international-dch-whql.exe","size":990853168,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","hash_source":"https://www.nvidia.com/en-us/drivers/details/","args":["-s","-noreboot"],"reboot_codes":[1],"signer":"NVIDIA","linux_package":"nvidia-driver-570","hive_package":"nvidia-driver-update 570"},
"amd":{"min_version":"32.0.32000.0","version":"26.9.2","url":"https://drivers.amd.com/drivers/whql-amd-software-adrenalin-edition-26.9.2-win10-win11-sep2026.exe","size":912345678,"sha256":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","hash_source":"https://www.amd.com/en/support/download/drivers.html","args":["-install","-silent"],"reboot_codes":[3010],"signer":"Advanced Micro Devices","linux_package":"amdgpu-install --usecase=opencl"},
"amd":{"referer":"https://www.amd.com/","min_version":"32.0.32000.0","version":"26.9.2","url":"https://drivers.amd.com/drivers/whql-amd-software-adrenalin-edition-26.9.2-win10-win11-sep2026.exe","size":912345678,"sha256":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","hash_source":"https://www.amd.com/en/support/download/drivers.html","args":["-install","-silent"],"reboot_codes":[3010],"signer":"Advanced Micro Devices","linux_package":"amdgpu-install --usecase=opencl"},
"intel":{"min_version":"32.0.101.9034","version":"32.0.101.9034","url":"https://downloadmirror.intel.com/929959/gfx_win_101.9034.exe","size":932631144,"sha256":"72ba7eea08a0cc18650603976ff9433dfdf84d23d4cbbee662a4df9f2856ae98","hash_source":"https://www.intel.com/content/www/us/en/download/785597/","args":["-s"],"reboot_codes":[14,1014],"signer":"Intel","linux_package":"intel-opencl-icd"}}}"#;
fn table() -> Table {
@ -279,6 +285,8 @@ mod tests {
assert!(bad("\"size\":932631144", "\"size\":0").contains("size"));
assert!(bad("\"args\":[\"-s\"]", "\"args\":[\"-s; calc\"]").contains("args"));
assert!(bad("\"signer\":\"Intel\"", "\"signer\":\"\"").contains("signer"));
assert!(bad("\"args\":[\"-install\",\"-silent\"]", "\"referer\":\"http://x\",\"args\":[\"-install\",\"-silent\"]").contains("referer"));
assert_eq!(t.entry("amd").unwrap().referer, "https://www.amd.com/");
assert!(bad("\"min_version\":\"570.00\"", "\"min_version\":\"latest\"").contains("dotted"));
assert!(Table::parse(&serde_json::json!({"vendors": {"apple": {}}})).unwrap_err().contains("vendor"));
assert!(Table::parse(&serde_json::json!({"vendors": {}})).unwrap_err().contains("empty"));

View file

@ -36,7 +36,8 @@
],
"signer": "Advanced Micro Devices",
"linux_package": "amdgpu-install --usecase=opencl",
"hive_package": "amd-ocl-install 26.9"
"hive_package": "amd-ocl-install 26.9",
"referer": "https://www.amd.com/"
},
"intel": {
"min_version": "32.0.101.9034",