Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump cryptography from 41.0.6 to 42.0.4 #233

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 21, 2024

Bumps cryptography from 41.0.6 to 42.0.4.

Changelog

Sourced from cryptography's changelog.

42.0.4 - 2024-02-20


* Fixed a null-pointer-dereference and segfault that could occur when creating
  a PKCS#12 bundle. Credit to **Alexander-Programming** for reporting the
  issue. **CVE-2024-26130**
* Fixed ASN.1 encoding for PKCS7/SMIME signed messages. The fields ``SMIMECapabilities``
  and ``SignatureAlgorithmIdentifier`` should now be correctly encoded according to the
  definitions in :rfc:`2633` :rfc:`3370`.

.. _v42-0-3:

42.0.3 - 2024-02-15

  • Fixed an initialization issue that caused key loading failures for some users.

.. _v42-0-2:

42.0.2 - 2024-01-30


* Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 3.2.1.
* Fixed an issue that prevented the use of Python buffer protocol objects in
  ``sign`` and ``verify`` methods on asymmetric keys.
* Fixed an issue with incorrect keyword-argument naming with ``EllipticCurvePrivateKey``
  :meth:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey.exchange`,
  ``X25519PrivateKey``
  :meth:`~cryptography.hazmat.primitives.asymmetric.x25519.X25519PrivateKey.exchange`,
  ``X448PrivateKey``
  :meth:`~cryptography.hazmat.primitives.asymmetric.x448.X448PrivateKey.exchange`,
  and ``DHPrivateKey``
  :meth:`~cryptography.hazmat.primitives.asymmetric.dh.DHPrivateKey.exchange`.

.. _v42-0-1:

42.0.1 - 2024-01-24

  • Fixed an issue with incorrect keyword-argument naming with EllipticCurvePrivateKey :meth:~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey.sign.
  • Resolved compatibility issue with loading certain RSA public keys in :func:~cryptography.hazmat.primitives.serialization.load_pem_public_key.

.. _v42-0-0:

42.0.0 - 2024-01-22


</tr></table> 

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    You can disable automated security fix PRs for this repo from the Security Alerts page.

Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.6 to 42.0.4.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@41.0.6...42.0.4)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Feb 21, 2024
@cpu
Copy link
Member

cpu commented Feb 21, 2024

I started to look into the nightly clippy failures. I found this issue upstream, and the suggested workaround is quite similar to what the main rustls repo is already doing and so probably makes sense to adopt.

Here's a branch to try it out and fix up some of the easy findings. I must be missing something obvious because the one last finding I see is this gated import in signed_data.rs. I don't think it should be unconditionally imported, but removing the import entirely does break the --all-features build 🤔 Leaving it gated causes the clippy warning. 😵

@ctz ctz merged commit 70818be into main Feb 22, 2024
38 of 56 checks passed
@ctz ctz deleted the dependabot/pip/cryptography-42.0.4 branch February 22, 2024 13:22
@ctz
Copy link
Member

ctz commented Feb 22, 2024

Have admin-merged this one.

I must be missing something obvious because the one last finding I see is this gated import in signed_data.rs.

This worked for me:

diff --git a/src/signed_data.rs b/src/signed_data.rs
index b277650..3d098fb 100644
--- a/src/signed_data.rs
+++ b/src/signed_data.rs
@@ -18,7 +18,7 @@ use crate::verify_cert::Budget;
 
 use pki_types::{AlgorithmIdentifier, SignatureVerificationAlgorithm};
 
-#[cfg(feature = "alloc")]
+#[cfg(all(feature = "alloc", not(test)))]
 use alloc::vec::Vec;
 
 /// X.509 certificates and related items that are signed are almost always

(and that matches the conditional against no_std, meaning that the crate gets the std prelude if built for testing. That seems odd to me.)

@ctz
Copy link
Member

ctz commented Feb 22, 2024

Actually, what about always setting #![no_std], and then sticking use std::prelude::v1::*; at the top of each mod tests { block? That works for me and seems cleaner:

diff --git a/src/alg_tests.rs b/src/alg_tests.rs
index f0fe5ae..4d2ade9 100644
--- a/src/alg_tests.rs
+++ b/src/alg_tests.rs
@@ -14,6 +14,8 @@
 
 #![allow(clippy::duplicate_mod)]
 
+use std::prelude::v1::*;
+
 use base64::{engine::general_purpose, Engine as _};
 
 use crate::error::{DerTypeId, Error};
diff --git a/src/cert.rs b/src/cert.rs
index fdf1c94..4e280b1 100644
--- a/src/cert.rs
+++ b/src/cert.rs
@@ -343,6 +343,7 @@ mod tests {
     use super::*;
     #[cfg(feature = "alloc")]
     use crate::crl::RevocationReason;
+    use std::prelude::v1::*;
 
     #[test]
     // Note: cert::parse_cert is crate-local visibility, and EndEntityCert doesn't expose the
diff --git a/src/crl/mod.rs b/src/crl/mod.rs
index 2ac9241..3355c40 100644
--- a/src/crl/mod.rs
+++ b/src/crl/mod.rs
@@ -237,6 +237,7 @@ pub struct CrlsRequired(pub(crate) ());
 #[cfg(test)]
 mod tests {
     use super::*;
+    use std::println;
 
     #[test]
     // redundant clone, clone_on_copy allowed to verify derived traits.
diff --git a/src/crl/types.rs b/src/crl/types.rs
index 148dcf4..2576966 100644
--- a/src/crl/types.rs
+++ b/src/crl/types.rs
@@ -900,6 +900,8 @@ impl TryFrom<u8> for RevocationReason {
 #[cfg(test)]
 mod tests {
     use pki_types::CertificateDer;
+    use std::prelude::v1::*;
+    use std::println;
 
     use super::*;
     use crate::cert::Cert;
diff --git a/src/der.rs b/src/der.rs
index 38a0001..aebc513 100644
--- a/src/der.rs
+++ b/src/der.rs
@@ -423,6 +423,7 @@ macro_rules! oid {
 #[cfg(test)]
 mod tests {
     use super::DerTypeId;
+    use std::prelude::v1::*;
 
     #[test]
     fn test_optional_boolean() {
diff --git a/src/end_entity.rs b/src/end_entity.rs
index 41a9efa..605f022 100644
--- a/src/end_entity.rs
+++ b/src/end_entity.rs
@@ -186,6 +186,7 @@ impl<'a> Deref for EndEntityCert<'a> {
 mod tests {
     use super::*;
     use crate::test_utils;
+    use std::prelude::v1::*;
 
     // This test reproduces https://github.com/rustls/webpki/issues/167 --- an
     // end-entity cert where the common name is a `PrintableString` rather than
diff --git a/src/lib.rs b/src/lib.rs
index 5b05632..5d2fc9d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,7 +26,7 @@
 //! | `ring` | Enable use of the *ring* crate for cryptography. |
 //! | `aws_lc_rs` | Enable use of the aws-lc-rs crate for cryptography. |
 
-#![cfg_attr(not(test), no_std)]
+#![no_std]
 #![warn(unreachable_pub)]
 #![deny(missing_docs, clippy::as_conversions)]
 #![allow(
@@ -40,7 +40,7 @@
 // Enable documentation for all features on docs.rs
 #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
 
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", test))]
 extern crate std;
 
 #[cfg(any(test, feature = "alloc"))]
diff --git a/src/test_utils.rs b/src/test_utils.rs
index 9685bcf..0b5dd7e 100644
--- a/src/test_utils.rs
+++ b/src/test_utils.rs
@@ -1,4 +1,5 @@
 #![cfg(feature = "alloc")]
+use std::prelude::v1::*;
 
 use crate::types::CertificateDer;
 
diff --git a/src/verify_cert.rs b/src/verify_cert.rs
index 733d498..6cc6d77 100644
--- a/src/verify_cert.rs
+++ b/src/verify_cert.rs
@@ -704,6 +704,8 @@ mod tests {
     use super::*;
     use crate::test_utils::{issuer_params, make_end_entity, make_issuer};
     use crate::trust_anchor::anchor_from_trusted_cert;
+    use std::dbg;
+    use std::prelude::v1::*;
 
     #[test]
     fn eku_key_purpose_id() {

@cpu
Copy link
Member

cpu commented Feb 22, 2024

meaning that the crate gets the std prelude if built for testing. That seems odd to me

Yeah, agreed

Actually, what about always setting #![no_std], and then sticking use std::prelude::v1::*; at the top of each mod tests { block? That works for me and seems cleaner

I like that approach 👍

Thanks for picking up where I left off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants