diff --git a/.cargo/audit.toml b/.cargo/audit.toml index e617c12b1..63ced22ef 100644 --- a/.cargo/audit.toml +++ b/.cargo/audit.toml @@ -8,9 +8,6 @@ ignore = [ "RUSTSEC-2023-0018", # rustwide -> remove_dir_all,TOCTOU / Race Condition # https://github.com/rust-lang/docs.rs/issues/2074 - - "RUSTSEC-2023-0019", # kuchiki is unmaintained - # https://github.com/rust-lang/docs.rs/issues/2076 ] informational_warnings = ["unmaintained"] # warn for categories of informational advisories severity_threshold = "low" # CVSS severity ("none", "low", "medium", "high", "critical") diff --git a/Cargo.lock b/Cargo.lock index b5f15aa9c..86227d8cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1389,7 +1389,7 @@ dependencies = [ "hyper", "indoc", "itertools 0.11.0", - "kuchiki", + "kuchikiki", "log", "lol_html", "memmap2 0.5.10", @@ -3222,9 +3222,9 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.25.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" +checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" dependencies = [ "log", "mac", @@ -3539,13 +3539,14 @@ dependencies = [ ] [[package]] -name = "kuchiki" -version = "0.8.1" +name = "kuchikiki" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" +checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" dependencies = [ "cssparser", "html5ever", + "indexmap 1.9.3", "matches", "selectors", ] @@ -3700,13 +3701,13 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "markup5ever" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" +checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" dependencies = [ "log", - "phf 0.8.0", - "phf_codegen 0.8.0", + "phf 0.10.1", + "phf_codegen 0.10.0", "string_cache", "string_cache_codegen", "tendril", @@ -4228,6 +4229,16 @@ dependencies = [ "phf_shared 0.8.0", ] +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + [[package]] name = "phf_codegen" version = "0.11.2" diff --git a/Cargo.toml b/Cargo.toml index 21edd8ec1..8c91cc180 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,7 +124,7 @@ procfs = "0.15.1" [dev-dependencies] criterion = "0.5.1" -kuchiki = "0.8" +kuchikiki = "0.8" rand = "0.8" mockito = "1.0.2" test-case = "3.0.0" diff --git a/src/web/build_details.rs b/src/web/build_details.rs index 46baa1bb5..79c59bea7 100644 --- a/src/web/build_details.rs +++ b/src/web/build_details.rs @@ -98,7 +98,7 @@ pub(crate) async fn build_details_handler( #[cfg(test)] mod tests { use crate::test::{wrapper, FakeBuild}; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; use test_case::test_case; #[test] @@ -112,7 +112,7 @@ mod tests { .db_build_log("A build log")]) .create()?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/foo/0.1.0/builds") .send()? @@ -123,7 +123,7 @@ mod tests { let attrs = node.attributes.borrow(); let url = attrs.get("href").unwrap(); - let page = kuchiki::parse_html().one(env.frontend().get(url).send()?.text()?); + let page = kuchikiki::parse_html().one(env.frontend().get(url).send()?.text()?); let log = page.select("pre").unwrap().next().unwrap().text_contents(); @@ -142,7 +142,7 @@ mod tests { .builds(vec![FakeBuild::default().s3_build_log("A build log")]) .create()?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/foo/0.1.0/builds") .send()? @@ -153,7 +153,7 @@ mod tests { let attrs = node.attributes.borrow(); let url = attrs.get("href").unwrap(); - let page = kuchiki::parse_html().one(env.frontend().get(url).send()?.text()?); + let page = kuchikiki::parse_html().one(env.frontend().get(url).send()?.text()?); let log = page.select("pre").unwrap().next().unwrap().text_contents(); @@ -174,7 +174,7 @@ mod tests { .db_build_log("Another build log")]) .create()?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/foo/0.1.0/builds") .send()? @@ -185,7 +185,7 @@ mod tests { let attrs = node.attributes.borrow(); let url = attrs.get("href").unwrap(); - let page = kuchiki::parse_html().one(env.frontend().get(url).send()?.text()?); + let page = kuchikiki::parse_html().one(env.frontend().get(url).send()?.text()?); let log = page.select("pre").unwrap().next().unwrap().text_contents(); diff --git a/src/web/builds.rs b/src/web/builds.rs index 9b24707a3..e12eb2821 100644 --- a/src/web/builds.rs +++ b/src/web/builds.rs @@ -151,7 +151,7 @@ mod tests { web::cache::CachePolicy, }; use chrono::{DateTime, Duration, Utc}; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; use reqwest::StatusCode; #[test] @@ -176,7 +176,7 @@ mod tests { let response = env.frontend().get("/crate/foo/0.1.0/builds").send()?; assert_cache_control(&response, CachePolicy::NoCaching, &env.config()); - let page = kuchiki::parse_html().one(response.text()?); + let page = kuchikiki::parse_html().one(response.text()?); let rows: Vec<_> = page .select("ul > li a.release") @@ -294,7 +294,7 @@ mod tests { ], )?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/foo/0.1.0/builds") .send()? diff --git a/src/web/crate_details.rs b/src/web/crate_details.rs index 022444794..13ef493b2 100644 --- a/src/web/crate_details.rs +++ b/src/web/crate_details.rs @@ -474,7 +474,7 @@ mod tests { assert_cache_control, assert_redirect, assert_redirect_cached, wrapper, TestDatabase, }; use anyhow::{Context, Error}; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; use std::collections::HashMap; fn assert_last_successful_build_equals( @@ -838,7 +838,7 @@ mod tests { .binary(true) .create()?; - let page = kuchiki::parse_html() + let page = kuchikiki::parse_html() .one(env.frontend().get("/crate/binary/0.1.0").send()?.text()?); let warning = page.select_first("a.pure-menu-link.warn").unwrap(); @@ -956,7 +956,7 @@ mod tests { .features(HashMap::new()) .create()?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/library/0.1.0/features") .send()? @@ -980,7 +980,7 @@ mod tests { .features(features) .create()?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/library/0.1.0/features") .send()? @@ -1004,7 +1004,7 @@ mod tests { .features(features) .create()?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/library/0.1.0/features") .send()? @@ -1036,7 +1036,7 @@ mod tests { .features(features) .create()?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/library/0.1.0/features") .send()? @@ -1064,7 +1064,7 @@ mod tests { .conn() .query("UPDATE releases SET features = NULL WHERE id = $1", &[&id])?; - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/library/0.1.0/features") .send()? @@ -1090,7 +1090,7 @@ mod tests { let response = env.frontend().get("/crate/dummy/0.4.0").send()?; assert!(response.status().is_success()); - let platform_links: Vec<(String, String)> = kuchiki::parse_html() + let platform_links: Vec<(String, String)> = kuchikiki::parse_html() .one(response.text()?) .select(r#"a[aria-label="Platform"] + ul li a"#) .expect("invalid selector") diff --git a/src/web/error.rs b/src/web/error.rs index a1a0abeeb..47f08ee23 100644 --- a/src/web/error.rs +++ b/src/web/error.rs @@ -136,12 +136,12 @@ pub(crate) type AxumResult = Result; #[cfg(test)] mod tests { use crate::test::wrapper; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; #[test] fn check_404_page_content_crate() { wrapper(|env| { - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate-which-doesnt-exist") .send()? @@ -164,7 +164,7 @@ mod tests { #[test] fn check_404_page_content_resource() { wrapper(|env| { - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/resource-which-doesnt-exist.js") .send()? @@ -188,8 +188,8 @@ mod tests { fn check_404_page_content_not_semver_version() { wrapper(|env| { env.fake_release().name("dummy").create()?; - let page = - kuchiki::parse_html().one(env.frontend().get("/dummy/not-semver").send()?.text()?); + let page = kuchikiki::parse_html() + .one(env.frontend().get("/dummy/not-semver").send()?.text()?); assert_eq!(page.select("#crate-title").unwrap().count(), 1); assert_eq!( page.select("#crate-title") @@ -208,7 +208,8 @@ mod tests { fn check_404_page_content_nonexistent_version() { wrapper(|env| { env.fake_release().name("dummy").version("1.0.0").create()?; - let page = kuchiki::parse_html().one(env.frontend().get("/dummy/2.0").send()?.text()?); + let page = + kuchikiki::parse_html().one(env.frontend().get("/dummy/2.0").send()?.text()?); assert_eq!(page.select("#crate-title").unwrap().count(), 1); assert_eq!( page.select("#crate-title") @@ -231,7 +232,7 @@ mod tests { .version("1.0.0") .yanked(true) .create()?; - let page = kuchiki::parse_html().one(env.frontend().get("/dummy/*").send()?.text()?); + let page = kuchikiki::parse_html().one(env.frontend().get("/dummy/*").send()?.text()?); assert_eq!(page.select("#crate-title").unwrap().count(), 1); assert_eq!( page.select("#crate-title") diff --git a/src/web/mod.rs b/src/web/mod.rs index 19674648c..1714a81df 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -584,7 +584,7 @@ mod test { use super::*; use crate::{docbuilder::DocCoverage, test::*, web::match_version}; use axum::http::StatusCode; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; use serde_json::json; use test_case::test_case; @@ -618,7 +618,7 @@ mod test { fn clipboard_is_present_for_path(path: &str, web: &TestFrontend) -> bool { let data = web.get(path).send().unwrap().text().unwrap(); - let node = kuchiki::parse_html().one(data); + let node = kuchikiki::parse_html().one(data); node.select("#clipboard").unwrap().count() == 1 } @@ -647,7 +647,8 @@ mod test { .create()?; let web = env.frontend(); - let foo_crate = kuchiki::parse_html().one(web.get("/crate/foo/0.0.1").send()?.text()?); + let foo_crate = + kuchikiki::parse_html().one(web.get("/crate/foo/0.0.1").send()?.text()?); for value in &["60%", "6", "10", "2", "1"] { assert!(foo_crate .select(".pure-menu-item b") @@ -655,7 +656,7 @@ mod test { .any(|e| dbg!(e.text_contents()).contains(value))); } - let foo_doc = kuchiki::parse_html().one(web.get("/foo/0.0.1/foo").send()?.text()?); + let foo_doc = kuchikiki::parse_html().one(web.get("/foo/0.0.1/foo").send()?.text()?); assert!(foo_doc .select(".pure-menu-link b") .unwrap() @@ -834,7 +835,7 @@ mod test { release("0.1.0", env); let web = env.frontend(); let text = web.get("/foo/0.1.0/foo").send()?.text()?; - let platform = kuchiki::parse_html() + let platform = kuchikiki::parse_html() .one(text) .select(r#"ul > li > a[aria-label="Platform"]"#) .unwrap() @@ -848,7 +849,7 @@ mod test { .add_platform("x86_64-unknown-linux-musl") .create()?; let text = web.get("/foo/0.2.0/foo").send()?.text()?; - let platform = kuchiki::parse_html() + let platform = kuchikiki::parse_html() .one(text) .select(r#"ul > li > a[aria-label="Platform"]"#) .unwrap() @@ -1028,7 +1029,7 @@ mod test { release("0.1.0", env); let web = env.frontend(); let text = web.get("/foo/0.1.0/foo").send()?.text()?; - let tabindex = kuchiki::parse_html() + let tabindex = kuchikiki::parse_html() .one(text) .select(r#"#nav-search[tabindex="-1"]"#) .unwrap() diff --git a/src/web/releases.rs b/src/web/releases.rs index 846916ffb..503c35148 100644 --- a/src/web/releases.rs +++ b/src/web/releases.rs @@ -753,7 +753,7 @@ mod tests { }; use anyhow::Error; use chrono::{Duration, TimeZone}; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; use mockito::Matcher; use reqwest::StatusCode; use serde_json::json; @@ -930,7 +930,7 @@ mod tests { let response = web.get("/releases/search?query=some_random_crate").send()?; assert!(response.status().is_success()); - let page = kuchiki::parse_html().one(response.text()?); + let page = kuchikiki::parse_html().one(response.text()?); let other_search_links: Vec<_> = page .select("a") @@ -1167,7 +1167,7 @@ mod tests { let response = web.get(path).send()?; assert!(response.status().is_success()); - let page = kuchiki::parse_html().one(response.text()?); + let page = kuchikiki::parse_html().one(response.text()?); Ok(page .select("a.release") @@ -1422,13 +1422,13 @@ mod tests { cdn::queue_crate_invalidation(&mut *env.db().conn(), &env.config(), "krate_2")?; - let empty = kuchiki::parse_html().one(web.get("/releases/queue").send()?.text()?); + let empty = kuchikiki::parse_html().one(web.get("/releases/queue").send()?.text()?); assert!(empty .select(".release > strong") .expect("missing heading") .any(|el| el.text_contents().contains("active CDN deployments"))); - let full = kuchiki::parse_html().one(web.get("/releases/queue").send()?.text()?); + let full = kuchikiki::parse_html().one(web.get("/releases/queue").send()?.text()?); let items = full .select(".queue-list > li") .expect("missing list items") @@ -1449,7 +1449,7 @@ mod tests { let queue = env.build_queue(); let web = env.frontend(); - let empty = kuchiki::parse_html().one(web.get("/releases/queue").send()?.text()?); + let empty = kuchikiki::parse_html().one(web.get("/releases/queue").send()?.text()?); assert!(empty .select(".queue-list > strong") .expect("missing heading") @@ -1464,7 +1464,7 @@ mod tests { queue.add_crate("bar", "0.1.0", -10, None)?; queue.add_crate("baz", "0.0.1", 10, None)?; - let full = kuchiki::parse_html().one(web.get("/releases/queue").send()?.text()?); + let full = kuchikiki::parse_html().one(web.get("/releases/queue").send()?.text()?); let items = full .select(".queue-list > li") .expect("missing list items") @@ -1511,7 +1511,7 @@ mod tests { let resp = web.get("").send()?; assert!(resp.status().is_success()); - let html = kuchiki::parse_html().one(resp.text()?); + let html = kuchikiki::parse_html().one(resp.text()?); for link in html.select("a").unwrap() { let link = link.as_node().as_element().unwrap(); @@ -1545,7 +1545,7 @@ mod tests { let sel = ".pure-menu-horizontal>.pure-menu-list>.pure-menu-item>.pure-menu-link>.title"; wrapper(|env| { let tester = |url| { - let page = kuchiki::parse_html() + let page = kuchikiki::parse_html() .one(env.frontend().get(url).send().unwrap().text().unwrap()); assert_eq!(page.select("#crate-title").unwrap().count(), 1); let not_matching = page diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index 0976ce59b..d3e1d4438 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -935,7 +935,7 @@ pub(crate) async fn static_asset_handler( mod test { use crate::{test::*, web::cache::CachePolicy, Config}; use anyhow::Context; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; use reqwest::{blocking::ClientBuilder, redirect, StatusCode}; use std::collections::BTreeMap; use test_case::test_case; @@ -955,7 +955,7 @@ mod test { ); let data = response.text()?; info!("fetched path {} and got content {}\nhelp: if this is missing the header, remember to add ", path, data); - let dom = kuchiki::parse_html().one(data); + let dom = kuchikiki::parse_html().one(data); if let Some(elem) = dom .select("form > ul > li > a.warn") @@ -1359,7 +1359,7 @@ mod test { fn has_yanked_warning(path: &str, web: &TestFrontend) -> Result { assert_success(path, web)?; let data = web.get(path).send()?.text()?; - Ok(kuchiki::parse_html() + Ok(kuchikiki::parse_html() .one(data) .select("form > ul > li > .warn") .expect("invalid selector") @@ -1604,7 +1604,7 @@ mod test { ) -> Result, anyhow::Error> { assert_success(path, web)?; let data = web.get(path).send()?.text()?; - let dom = kuchiki::parse_html().one(data); + let dom = kuchikiki::parse_html().one(data); Ok(dom .select(r#"a[aria-label="Platform"] + ul li a"#) .expect("invalid selector") @@ -2098,7 +2098,7 @@ mod test { .version("0.18.0") .readme(readme) .create()?; - let page = kuchiki::parse_html() + let page = kuchikiki::parse_html() .one(env.frontend().get("/crate/strum/0.18.0").send()?.text()?); let rendered = page.select_first("#main").expect("missing readme"); println!("{}", rendered.text_contents()); @@ -2127,7 +2127,7 @@ mod test { let status = |version| -> Result<_, anyhow::Error> { let page = - kuchiki::parse_html().one(web.get("/crate/hexponent/0.3.0").send()?.text()?); + kuchikiki::parse_html().one(web.get("/crate/hexponent/0.3.0").send()?.text()?); let selector = format!(r#"ul > li a[href="/crate/hexponent/{version}"]"#); let anchor = page .select(&selector) @@ -2258,7 +2258,7 @@ mod test { .create()?; // test rustdoc pages stay on the documentation - let page = kuchiki::parse_html() + let page = kuchikiki::parse_html() .one(env.frontend().get("/hexponent/releases").send()?.text()?); let selector = r#"ul > li a[href="/crate/hexponent/0.3.1/target-redirect/hexponent/index.html"]"# @@ -2270,7 +2270,7 @@ mod test { ); // test /crate pages stay on /crate - let page = kuchiki::parse_html().one( + let page = kuchikiki::parse_html().one( env.frontend() .get("/crate/hexponent/0.3.0/") .send()? @@ -2297,7 +2297,7 @@ mod test { .rustdoc_file("testing/index.html") .create()?; - let dom = kuchiki::parse_html().one( + let dom = kuchikiki::parse_html().one( env.frontend() .get("/testing/0.1.0/testing/") .send()? @@ -2325,7 +2325,7 @@ mod test { .github_stats("https://git.example.com", 123, 321, 333) .create()?; - let dom = kuchiki::parse_html().one( + let dom = kuchikiki::parse_html().one( env.frontend() .get("/testing/0.1.0/testing/") .send()? diff --git a/src/web/source.rs b/src/web/source.rs index 26eff321d..243235aaf 100644 --- a/src/web/source.rs +++ b/src/web/source.rs @@ -320,12 +320,12 @@ pub(crate) async fn source_browser_handler( mod tests { use crate::test::*; use crate::web::cache::CachePolicy; - use kuchiki::traits::TendrilSink; + use kuchikiki::traits::TendrilSink; use reqwest::StatusCode; use test_case::test_case; fn get_file_list_links(body: &str) -> Vec { - let dom = kuchiki::parse_html().one(body); + let dom = kuchikiki::parse_html().one(body); dom.select(".package-menu > ul > li > a") .expect("invalid selector")