[Bug 2022372] Re: Backport for deprecated int_from_bytes to int.from_bytes

Heather Lemon 2022372 at bugs.launchpad.net
Fri Aug 11 13:56:58 UTC 2023


I did some extra testing around focal-yoga Openstack instance. I didn't
observe any warnings thrown in the logs like was mentioned earlier, but
I did see them when trying to execute a command from python-
secretstorage where the problem is.

# create openstack focal-yoga deployment, by default python3-cryptography and python3-secretstorage 
have the correct installed packages. The warnings happen when we use the focal deb version of python3-secretstorage and the UCA cloud version of python3-cryptography. 

sudo apt-cache policy python3-cryptography
python3-cryptography:
  Installed: 2.8-3ubuntu0.1
  Candidate: 3.4.8-1ubuntu2~cloud0
  Version table:
     3.4.8-1ubuntu2~cloud0 500
        500 http://ubuntu-cloud.archive.canonical.com/ubuntu focal-updates/yoga/main amd64 Packages
 *** 2.8-3ubuntu0.1 500
        500 http://nova.clouds.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.8-3 500
        500 http://nova.clouds.archive.ubuntu.com/ubuntu focal/main amd64 Packages

sudo apt-cache policy python3-secretstorage
python3-secretstorage:
  Installed: 2.3.1-2ubuntu1
  Candidate: 2.3.1-2ubuntu1
  Version table:
 *** 2.3.1-2ubuntu1 500
        500 http://nova.clouds.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status


# check syslog for any errors before proceeding

# Either from the host or inside a juju-vm

python3
from secretstorage.dhcrypto import Session

# upgrade to cloud version of python3-cryptography
sudo apt install -y python3-cryptography

sudo apt-cache policy python3-cryptography

# shows the cloud version
python3-cryptography:
  Installed: 3.4.8-1ubuntu2~cloud0
  Candidate: 3.4.8-1ubuntu2~cloud0

python3
Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from secretstorage.dhcrypto import Session
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
>>> 
Ctrl+D

# upgrade to test ppa version

sudo add-apt-repository ppa:hypothetical-lemon/python-cryptography-lp2022372
sudo apt-get update
sudo apt-get install python3-cryptography


sudo apt-cache policy python3-cryptography 
"" "" python3-secretstorage

# shows test package version installed

python3
from secretstorage.dhcrypto import Session

- observe no warning messages present.

Thanks, 
Heather L.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-secretstorage in Ubuntu.
https://bugs.launchpad.net/bugs/2022372

Title:
  Backport for deprecated int_from_bytes to int.from_bytes

Status in Ubuntu Cloud Archive:
  Invalid
Status in Ubuntu Cloud Archive yoga series:
  Confirmed
Status in python-secretstorage package in Ubuntu:
  Invalid
Status in python-secretstorage source package in Bionic:
  Invalid
Status in python-secretstorage source package in Focal:
  Invalid
Status in python-secretstorage source package in Jammy:
  Invalid
Status in python-secretstorage source package in Kinetic:
  Invalid

Bug description:
  [ Impact ]

  A method from cryptographic_utils was deprecated and replaced.
  This affects both python-secretstorage and python3-secretstorage
  with the python3-cryptography dependency from the Ubuntu Cloud Archive.

  It also deprecates the usage of utils.int_from_bytes: pyca/cryptography#5609
  int_from_bytes is deprecated in favor of int.from_bytes which ships with Python 3

  We are cherry-picking 2 commits from upstream,
  ad7c45e493fff48f897487d6aff63f4fff021d31 and
  08c7010322ecec0de1e51cc51d5ed9db34a38aa3 to address the unnecessary
  logging when using any Openstack command, or automating the
  install/upgrade of services on OpenStack.

  [ Test Plan ]

  # This is the expected output
  python3
  >>> from secretstorage.dhcrypto import Session
  >>> session = Session()
  >>> exit()

  Installing and running the dhcrypto module from python-secretstorage
  shows after installing the package from the cloud-archive we see
  logger warnings messages from the deprecated method. Yoga has the
  updated python3-cryptography module with the upstream Debian fixes.

  sudo apt-add-repository -y cloud-archive:yoga
  sudo apt install -y python3-cryptography

  python3
  >>> from secretstorage.dhcrypto import Session
  /usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
    from cryptography.utils import int_from_bytes
  /usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
    from cryptography.utils import int_from_bytes
  >>> exit()

  [ Where problems could occur ]

  This does not include the cryptography module update which python3-secretstorage depends on. [1] We are also still supporting Python2 with this cherry-picked patch.
  Build-Depends: debhelper-compat (= 13),
                 dh-python,
                 python3-all
                 python3-cryptography,
                 python3-jeepney
                 python3-setuptools,
                 python3-sphinx

  The impact is low as this fixes a deprecated method from a 3rd party
  library.

  It allows one to create, edit and delete secret items, manipulate
  secret collections, and search for items matching given attributes.
  It also supports locking and unlocking collections.

  [ Other Info ]

  [0] upstream debian link - https://salsa.debian.org/python-team/packages/python-secretstorage/-/commit/e24df79cf7d62f11c2906d5aa0f4885cefeafbbf
  [1] Github conversation link - https://github.com/mitya57/secretstorage/pull/27
  [2] upstream cherrypick author other - https://github.com/mitya57/secretstorage/pull/27

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/2022372/+subscriptions




More information about the foundations-bugs mailing list