From dd8a59f274eea61414b7c00f58977d67d2c0ff5b Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: May 22 2019 11:27:50 +0000 Subject: [PATCH 1/2] always check existence of tag in setInheritanceData Fixes: https://pagure.io/koji/issue/1252 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 4118ad2..5d72c51 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -10156,9 +10156,8 @@ class RootExports(object): apply the ones you submit here. If unspecified, this defaults to False. """ - if not isinstance(tag, six.integer_types): - #lookup tag id - tag = get_tag_id(tag, strict=True) + # verify existence of tag and/or convert name to id + tag = get_tag_id(tag, strict=True) context.session.assertPerm('admin') return writeInheritanceData(tag, data, clear=clear) From 2f174413c8334daaa525b948052c98fd280c57cb Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: May 22 2019 11:30:05 +0000 Subject: [PATCH 2/2] check parents in _writeInheritanceData --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 5d72c51..9904bf2 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -697,6 +697,8 @@ def _writeInheritanceData(tag_id, changes, clear=False): " parent_id(%i)" % parent_id) else: parent_ids.add(parent_id) + # check existence of parent + get_tag(parent_id, strict=True) # read current data and index data = dict([[link['parent_id'], link] for link in readInheritanceData(tag_id)]) for link in changes: