#993259 software-properties-gtk does not delete repository keys

#993259#5
Date:
2021-08-29 14:43:54 UTC
From:
To:
The software properties application does not delete
keys. I install a key. Let's say the google Linux
repositories key. I type in the command line (as root):

wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo
apt-key add -

Now I open the Software & Updates Aplication (In my case it is
software-properties-gtk). I select the authentication tab where you
have options for the keys. It shows the keys, but when I click on
the button for removing a key, it doesn't remove it.

The list of keys seems to update when you press the button that
should delete a key. When you try to delete a key from the bottom
of the list, the list is shown from the top again. So it seems
to update the list like it should after deleting a key, I think.
But it doesn't delete the selected key. You can only add keys with
software-properties-gtk.

The error is in the file "SoftwarePropertiesGtk.py".
It is in that passage:


     def remove_key_clicked(self, widget):
         """Remove a trusted software vendor key"""
         selection = self.treeview_auth.get_selection()
         (model, a_iter) = selection.get_selected()
         if a_iter == None:
             return
         key = model.get_value(a_iter, 0)
         try:
             if not self.backend.RemoveKey(key[:8]):
                 error(self.main,
                       _("Error removing the key"),
                       _("The key you selected could not be removed. "
                         "Please report this as a bug."))
         except dbus.DBusException as e:
             if e._dbus_error_name ==
'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
                 logging.error("Authentication canceled, changes have
not been saved")


The error is the "key[:8]" here. It gives the first eight characters of
the key that is
chosen here. It must use the whole sixteen characters. The application
shows a key like
that: "8C42FC58D8752769". The "key[:8]" lets the application choose the
first eight characters.
That won't work when you try to delete a key with "apt-key rm" in the
command line.
You can delete the key in the command line with "apt-key rm" with the
whole sixteen
characters. (The application uses "apt-key rm". You can look this up in
"AptAuth.py"
in the package "python3-software-properties".) If you just change the
"key[:8]" to
"key[:16]", the application (software-properties-gtk) can delete keys.

I think there should be an update when the bug is fixed, because the
user interface is an
important part of the operating system. There shouldn't be a button that
doesn't work in
a stable version for day-to-day use. Furthermore, removing apt keys
should be possible
to ensure safety. Such a small change should be possible. It just
ensures that the program
gets the right variable. Nothing else needs to be changed to fix this bug.

I also do not want this bug again if you ever make an update of the
concerned files, so
please make an updated version