Skip to content

Commit

Permalink
Don't allow installing packages without ARCH or OS
Browse files Browse the repository at this point in the history
We had an exception for public key packages in rpmte. With those now
being handled in the keystore without going through the transaction
machinery this is no longer needed. This also prevents people from just
contrsucting their own pubkey packages and install them.

We still allow removing gpg-pubkey packages but give a warning pointing
people to rpmkeys.

Resolves: rpm-software-management#3344
  • Loading branch information
ffesti committed Nov 29, 2024
1 parent 51f4831 commit 8d47c69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/rpmte.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,13 @@ static int addTE(rpmte p, Header h, fnpyKey key, rpmRelocation * relocs)
p->arch = headerGetAsString(h, RPMTAG_ARCH);
p->os = headerGetAsString(h, RPMTAG_OS);

/* gpg-pubkey's dont have os or arch (sigh), for others they are required */
if (!rstreq(p->name, "gpg-pubkey") && (p->arch == NULL || p->os == NULL))
goto exit;
if (p->arch == NULL || p->os == NULL) {
if (p->type == TR_REMOVED && rstreq(p->name, "gpg-pubkey")) {
rpmlog(RPMLOG_WARNING, "Erasing gpg-pubkey packages is deprecated! Use rpmkeys.\n");
} else {
goto exit;
}
}

p->isSource = headerIsSource(h);

Expand Down
3 changes: 2 additions & 1 deletion tests/rpmsigdig.at
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ runroot rpm -qa gpg-pubkey
],
[0],
[],
[])
[warning: Erasing gpg-pubkey packages is deprecated! Use rpmkeys.
])
RPMTEST_CLEANUP

AT_SETUP([rpmkeys migrate from keyid to fingerprint (rpmdb)])
Expand Down

0 comments on commit 8d47c69

Please sign in to comment.