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 1333084 - API - PUT method for applying errata to hosts does not validate values
Summary: API - PUT method for applying errata to hosts does not validate values
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Kavita
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-04 15:38 UTC by Roman Plevka
Modified: 2018-09-04 17:46 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-04 17:46:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 18744 0 Normal Resolved API - PUT method for applying errata to hosts does not validate values 2020-08-30 19:05:59 UTC

Description Roman Plevka 2016-05-04 15:38:56 UTC
Description of problem:
there seems to be no input validation for parameters provided to /api/hosts/<host>/errata/apply (specifically errata_ids parameter):

<pre>
$ curl -k -u admin:changeme -X PUT -H 'Content-Type: application/json' -d '{"errata_ids": []}' https://sat6.server.com/api/v2/hosts/12977/errata/apply
{"displayMessage":"undefined method `-' for nil:NilClass","errors":["undefined method `-' for nil:NilClass"]}

$ curl -k -u admin:changeme -X PUT -H 'Content-Type: application/json' -d '{"errata_ids": 1}' https://sat6.server.com/api/v2/hosts/12977/errata/apply
{"displayMessage":"ERROR:  operator does not exist: character varying = integer\nLINE 1: ...ROM \"katello_errata\"  WHERE \"katello_errata\".\"errata_id\" = 1\n                                                                    ^\nHINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.\n","errors":["ERROR:  operator does not exist: character varying = integer\nLINE 1: ...ROM \"katello_errata\"  WHERE \"katello_errata\".\"errata_id\" = 1\n                                                                    ^\nHINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.\n"]}
</pre>



Version-Release number of selected component (if applicable):
6.2.0 Beta

How reproducible:
always

Steps to Reproduce:
1. get some hosts registered to your satellite
2. send out one of the PUT HTTP requests (as stated above)

Actual results:
no input validation happens on the parameters, so the code uses any input and crashes with it (wrong or null type, etc.)

Expected results:
validation takes place and raise proper exception if the input is invalid, user receives properly formatted error message in the JSON response.

Additional info:

Comment 2 Brad Buckingham 2016-06-06 19:51:25 UTC
Note: this bug is similar to bug 1222127 which requests a similar validation for host-collections.

Comment 4 Ondřej Pražák 2017-03-01 10:44:25 UTC
Created redmine issue http://projects.theforeman.org/issues/18744 from this bug

Comment 5 Satellite Program 2017-03-05 17:08:27 UTC
Upstream bug assigned to kgaikwad

Comment 6 Bryan Kearney 2018-09-04 17:46:00 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.


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