Public bug reported:

[ Impact ]

For deb822 sources, aptsources/sourceslist.py tries to merge similar
entries that are compatible. But the logic does not verify the Signed-By
field. Because of this, different repositories using different keys get
merged into the same entry. This results in one of the repositories
having the wrong signed key, which breaks the repository validation.

[ Reproducer ]

To reproduce it, create a sources file
(/etc/apt/sources.list.d/test.sources) containing the following text:

---
Types: deb
URIs: https://repo1
Suites: resolute
Components: main
Signed-By: /usr/share/keyrings/keyring1.gpg

Types: deb
URIs: https://repo2
Suites: resolute
Components: main
Signed-By: /usr/share/keyrings/keyring2.gpg
---

Then run the following script to trigger the merge:

---
#!/usr/bin/env python3

import apt_pkg
from aptsources.sourceslist import SourcesList
import sys

apt_pkg.init_config()

sources = SourcesList(deb822=True)
sources.save()
---

Check the file /etc/apt/sources.list.d/test.sources.
Without the fix, the file will be merged like this, with the wrong key for 
repo2:

---
Types: deb
URIs: https://repo1 https://repo2
Suites: resolute
Components: main
Signed-By: /usr/share/keyrings/keyring1.gpg
---

As an alternative, after creating the file, you can just add a PPA:

sudo add-apt-repository -ny ppa:maas/3.7

This will also trigger the merge and save.

[ Other Info ]

Noble and Resolute are affected. Other older releases are affected as
well, but only Noble and forward use deb822 as the default for sources,
so the fix should go to both of them.

** Affects: python-apt (Ubuntu)
     Importance: Undecided
     Assignee: Joao Andre Simioni (jasimioni)
         Status: New

** Changed in: python-apt (Ubuntu)
     Assignee: (unassigned) => Joao Andre Simioni (jasimioni)

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

Title:
  aptsources/sourceslist.py merges deb822 entries with different Signed-
  By keys

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/2173647/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to