From 97354050b201c17873a86de35e332753bd6a6082 Mon Sep 17 00:00:00 2001 From: oracola91 <118899664+oracola91@users.noreply.github.com> Date: Thu, 22 Oct 2026 11:43:30 +0300 Subject: [PATCH 1/3] clippy: keep rsa verification-only deny.toml ignores RUSTSEC-2023-0071 because pdfcraft-sign uses rsa only to verify signatures (ADR-0009). clippy.toml now disallows the rsa types that hold a private key and the two rsa::hazmat decrypt functions, so a private-key operation through rsa fails clippy instead of quietly breaking that assumption. --- clippy.toml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/clippy.toml b/clippy.toml index 7f2fd53057..5bf7f4d3f8 100644 --- a/clippy.toml +++ b/clippy.toml @@ -12,4 +12,20 @@ disallowed-methods = [ { path = "egui::Ui::radio", reason = "use radio from crates/ui-egui/src/widgets.rs, which is outlined and filled" }, { path = "egui::Ui::radio_value", reason = "use radio_value from crates/ui-egui/src/widgets.rs, which is outlined and filled" }, { path = "egui::RadioButton::new", reason = "use radio from crates/ui-egui/src/widgets.rs, which is outlined and filled" }, + # The raw RSA private-key operations: see disallowed-types below. + { path = "rsa::hazmat::rsa_decrypt", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::hazmat::rsa_decrypt_and_check", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, +] + +# deny.toml ignores the Marvin advisory (RUSTSEC-2023-0071) because `rsa` is only used to verify +# signatures; RSA private-key operations use aws-lc-rs (ADR-0009). These are the `rsa` types +# that hold a private key, and above are the `rsa::hazmat` functions that take one, so a +# private-key operation through `rsa` fails clippy instead. +disallowed-types = [ + { path = "rsa::RsaPrivateKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::pkcs1v15::SigningKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::pkcs1v15::DecryptingKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::pss::SigningKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::pss::BlindedSigningKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::oaep::DecryptingKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, ] From f8e60b4cc337f5455fe79c0bf00a86065442ba3c Mon Sep 17 00:00:00 2001 From: oracola91 <118899664+oracola91@users.noreply.github.com> Date: Thu, 22 Oct 2026 13:46:08 +0300 Subject: [PATCH 2/3] clippy: also ban the rsa private-key methods disallowed-types only fires where a type is named. A private key that reaches pdfcraft without its type being named, returned by another crate or behind a generic over rsa's traits, could still decrypt or sign. The RsaPrivateKey constructors and private-key methods, and the private-key methods of rsa's Decryptor, RandomizedDecryptor, PaddingScheme and SignatureScheme traits, are now disallowed methods. The generic signature and pkcs8 traits stay allowed: the ECDSA keys use them too. --- clippy.toml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/clippy.toml b/clippy.toml index 5bf7f4d3f8..49a9f9fb3c 100644 --- a/clippy.toml +++ b/clippy.toml @@ -15,11 +15,30 @@ disallowed-methods = [ # The raw RSA private-key operations: see disallowed-types below. { path = "rsa::hazmat::rsa_decrypt", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, { path = "rsa::hazmat::rsa_decrypt_and_check", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + # The ways to make or use an `rsa` private key, so a key whose type is never named (one + # returned by another crate, or a generic over these traits) is caught too. The generic + # `signature` and `pkcs8` traits are left out: the ECDSA keys use them as well. + { path = "rsa::RsaPrivateKey::new", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::new_unchecked", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::new_with_exp", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::new_with_exp_unchecked", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::from_components", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::from_components_with_large_exponent", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::from_p_q", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::from_primes", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::decrypt", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::decrypt_blinded", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::sign", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::RsaPrivateKey::sign_with_rng", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::traits::Decryptor::decrypt", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::traits::RandomizedDecryptor::decrypt_with_rng", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::traits::PaddingScheme::decrypt", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, + { path = "rsa::traits::SignatureScheme::sign", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, ] # deny.toml ignores the Marvin advisory (RUSTSEC-2023-0071) because `rsa` is only used to verify # signatures; RSA private-key operations use aws-lc-rs (ADR-0009). These are the `rsa` types -# that hold a private key, and above are the `rsa::hazmat` functions that take one, so a +# that hold a private key, and above are the functions and methods that make or use one, so a # private-key operation through `rsa` fails clippy instead. disallowed-types = [ { path = "rsa::RsaPrivateKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, From cd888d0c1e39f7c78677ded63cc81da052458e79 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Thu, 26 Nov 2026 21:16:17 +0700 Subject: [PATCH 3/3] clippy: one disallowed-types table after merging main Main's egui::ComboBox ban and this PR's rsa private-key types each opened a disallowed-types array; TOML forbids the duplicate key, so clippy couldn't load the file. Both lists are now one array. --- clippy.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clippy.toml b/clippy.toml index 589de4f5b5..16518d262e 100644 --- a/clippy.toml +++ b/clippy.toml @@ -47,9 +47,6 @@ disallowed-types = [ { path = "rsa::pss::SigningKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, { path = "rsa::pss::BlindedSigningKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, { path = "rsa::oaep::DecryptingKey", reason = "rsa is for verification only (RUSTSEC-2023-0071, ADR-0009); use aws-lc-rs" }, -] -cognitive-complexity-threshold = 30 - -disallowed-types = [ { path = "egui::ComboBox", reason = "use craft_ui::ComboBox: egui's combo box menu can't grow back while open (egui#5225)" }, ] +cognitive-complexity-threshold = 30