Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1623133 - Show filter rule info API displays information for another CV filter
Summary: Show filter rule info API displays information for another CV filter
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.4
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: 6.6.0
Assignee: Michael Johnson
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks: 1122832 1619394
TreeView+ depends on / blocked
 
Reported: 2018-08-28 14:31 UTC by Mihir Lele
Modified: 2023-09-07 19:20 UTC (History)
2 users (show)

Fixed In Version: tfm-rubygem-katello-3.10.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-22 19:49:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 25348 0 Normal Closed Show filter rule info API displays information for another CV filter 2020-02-04 18:40:49 UTC

Description Mihir Lele 2018-08-28 14:31:31 UTC
Description of problem:

API request to fetch the CV filter rules for a particular content-view can display filter rule information of another CV filter. 

Affected api:

GET /katello/api/content_view_filters/:content_view_filter_id/rules/:id 	Show filter rule info

Version-Release number of selected component (if applicable): 6.4HTB


How reproducible: Always


Steps to Reproduce:
1. Create 2 CVs testcv1 and testcv2 to keep it simple.
2. Add some repo on them and create one filter a piece on the CVs with "erratum by ID"
3. Include some errata in the filters, publish a cv version


Additional info:

Lets assume that the testcv1 has a filter with content_view_filter_id=1, testcv2 has a filter with  content_view_filter_id=1

Output of filter1:

=================
[root@satellite ~]# curl -s -u admin:redhat -k "-H Content-Type: application/json" "-d{\"per_page\":9999999}" -X GET https://satellite.example.com/katello/api/v2/content_view_filters/1/rules/  | python -m json.tool 
{
    "error": null,
    "page": 1,
    "per_page": 20,
    "results": [
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:14 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2017:2804",
            "id": 1,
            "updated_at": "2018-08-28 13:43:14 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:14 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2017:2467",
            "id": 2,
            "updated_at": "2018-08-28 13:43:14 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2018:1673",
            "id": 3,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2018:0372",
            "id": 4,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2018:0272",
            "id": 5,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2017:3491",
            "id": 6,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2017:1554",
            "id": 7,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2017:1192",
            "id": 8,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2017:0446",
            "id": 9,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2017:0198",
            "id": 10,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2016:2939",
            "id": 11,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2016:2700",
            "id": 12,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2016:2109",
            "id": 13,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2016:1992",
            "id": 14,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2016:1886",
            "id": 15,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2016:1616",
            "id": 16,
            "updated_at": "2018-08-28 13:43:28 UTC"
        },
        {
            "content_view_filter_id": 1,
            "created_at": "2018-08-28 13:43:28 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2016:1503",
            "id": 17,
            "updated_at": "2018-08-28 13:43:28 UTC"
        }
    ],
    "search": null,
    "sort": {
        "by": "id",
        "order": "asc"
    },
    "subtotal": 17,
    "total": 17
}

===================

Output of filter 2:

-------------------


root@satellite ~]# curl -s -u admin:redhat -k "-H Content-Type: application/json" "-d{\"per_page\":9999999}" -X GET https://satellite.example.com/katello/api/v2/content_view_filters/2/rules/  | python -m json.tool
{
    "error": null,
    "page": 1,
    "per_page": 20,
    "results": [
        {
            "content_view_filter_id": 2,
            "created_at": "2018-08-28 13:45:11 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2018:1127",
            "id": 18,
            "updated_at": "2018-08-28 13:45:11 UTC"
        },
        {
            "content_view_filter_id": 2,
            "created_at": "2018-08-28 13:45:11 UTC",
            "date_type": "updated",
            "errata_id": "RHBA-2018:0338",
            "id": 19,
            "updated_at": "2018-08-28 13:45:11 UTC"
        }
    ],
    "search": null,
    "sort": {
        "by": "id",
        "order": "asc"
    },
    "subtotal": 2,
    "total": 2
}


---------------------

If you see the above output then the filter 2 does not have any rules with id "1". So ideally filter 2 should not display any information for GET request for rules with that id. But that's not the case, because same GET request results into the information of rule with id 1 from the filter 1 which is not ideal.


Actual Result:

[root@satellite ~]# curl -s -u admin:redhat -k "-H Content-Type: application/json" "-d{\"per_page\":9999999}" -X GET https://satellite.example.com/katello/api/v2/content_view_filters/2/rules/1  | python -m json.tool
{
    "content_view_filter_id": 1,
    "created_at": "2018-08-28 13:43:14 UTC",
    "date_type": "updated",
    "errata_id": "RHBA-2017:2804",
    "id": 1,
    "updated_at": "2018-08-28 13:43:14 UTC"
}


Expected result:

[root@satellite ~]# curl -s -u admin:redhat -k "-H Content-Type: application/json" "-d{\"per_page\":9999999}" -X GET https://satellite.example.com/katello/api/v2/content_view_filters/2/rules/1  | python -m json.tool
{
    "displayMessage": "Couldn't find Katello::ContentViewErratumFilterRule with 'id'=1",
    "errors": [
        "Couldn't find Katello::ContentViewErratumFilterRule with 'id'=1"
    ]
}

Comment 1 Brad Buckingham 2018-09-19 18:25:23 UTC
Confirmed that this behavior also exists on Satellite 6.3.

The behavior being observed is that when the API call is being made to retrieve the rule by id, it appears that the filter id that is passed in is ignored.

Comment 3 Michael Johnson 2018-10-30 17:58:10 UTC
Created redmine issue https://projects.theforeman.org/issues/25348 from this bug

Comment 4 Satellite Program 2018-11-01 18:08:39 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25348 has been resolved.

Comment 6 Lai 2019-05-30 20:13:34 UTC
Forgot to add but tested on sat6.6, snap 4

Comment 8 Bryan Kearney 2019-10-22 19:49:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3172


Note You need to log in before you can comment on or make changes to this bug.