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 1133799 - nil allowed as user parameter at user creation
Summary: nil allowed as user parameter at user creation
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.0.4
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: Unspecified
Assignee: Shlomi Zadok
QA Contact: Tazim Kolhar
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-26 07:39 UTC by Tomas Lestach
Modified: 2017-02-23 21:01 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 05:13:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 7261 0 Normal Closed Top level object hash marked as optional, not required in POST/create APIs 2020-02-10 22:00:45 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description Tomas Lestach 2014-08-26 07:39:41 UTC
Description of problem:
API documentation of POST /api/users says:
user / optional , nil allowed

Version-Release number of selected component (if applicable):
Satellite-6.0.4-RHEL-6-20140823.0-Satellite-x86_64

How reproducible:
always

Steps to Reproduce:
1. Check the API documentation of POST /api/users
https://<sat6-hostname>/apidoc/v2/users/create.html

Actual results:
The 1st parameter user
is
optional , nil allowed

Expected results:
It does not make sense to allow nil for (or not to include) the user parameter at user creation. What user should be created?

Additional info:
curl "$(hostname)/api/users" -u admin:changeme -H "Accept: application/json" -H "Content-Type: application/json" -d '{"user":nil}'
{"status":400,"error":"There was a problem in the JSON you submitted: 784: unexpected token at '{\"user\":nil}'"}
The API documentation does not match with the behavior.

Comment 2 Tomas Lestach 2014-08-26 08:26:50 UTC
Actually, it's not just the "POST /api/users" API, but there're another 26 APIs affected.

Comment 3 Dominic Cleal 2014-08-26 09:53:11 UTC
nil is not valid JSON, hence the JSON validity error: "null" is the correct term.

I'll accept that the top level hash may be marked as required rather than optional.

Comment 5 Dominic Cleal 2014-08-26 09:54:23 UTC
Created redmine issue http://projects.theforeman.org/issues/7261 from this bug

Comment 6 Tomas Lestach 2014-08-26 10:09:08 UTC
(In reply to Dominic Cleal from comment #3)
> nil is not valid JSON, hence the JSON validity error: "null" is the correct
> term.
> 
> I'll accept that the top level hash may be marked as required rather than
> optional.

Right, I copy&pasted wrong line into the reproducer, the correct one shall be:

$ curl -s -H "Content-Type:application/json" -H "Accept:application/json,version=2" -k -u admin:changeme -X POST -d '{"user":null}' http://localhost/api/users
{
  "error": {"id":null,"errors":{"login":["can't be blank"],"auth_source_id":["can't be blank"]},"full_messages":["Username can't be blank","Auth source can't be blank"]}
}

Comment 7 Bryan Kearney 2014-09-02 10:04:28 UTC
Upstream bug assigned to jmagen

Comment 8 Bryan Kearney 2014-09-03 10:04:33 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/7261 has been closed
-------------
Joseph Magen
Applied in changeset commit:fb5ac6168beaad3e205a113a92361066e14355f3.

Comment 9 Bryan Kearney 2015-01-09 14:49:36 UTC
Upstream bug assigned to szadok

Comment 12 Tazim Kolhar 2015-03-04 08:04:30 UTC
VERIFIED :

# rpm -qa | grep foreman
foreman-1.7.2.8-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.2-1.el6_6sat.noarch
foreman-compute-1.7.2.8-1.el6_6sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.2-1.el6_6sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.1-1.el6_6sat.noarch
foreman-proxy-1.7.2.3-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.5-1.el6_6sat.noarch
foreman-vmware-1.7.2.8-1.el6_6sat.noarch
foreman-libvirt-1.7.2.8-1.el6_6sat.noarch
ruby193-rubygem-foreman_abrt-0.0.5-2.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-1.0-2.noarch
rubygem-hammer_cli_foreman-0.1.4.6-1.el6_6sat.noarch
foreman-selinux-1.7.2.8-1.el6_6sat.noarch
foreman-debug-1.7.2.8-1.el6_6sat.noarch
foreman-gce-1.7.2.8-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.0.8-2.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.5-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
foreman-postgresql-1.7.2.8-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.3-1.el6_6sat.noarch
foreman-ovirt-1.7.2.8-1.el6_6sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.8-1.el6_6sat.noarch

Username can't be blank

Comment 13 Bryan Kearney 2015-08-11 13:32:25 UTC
This bug is slated to be released with Satellite 6.1.

Comment 14 errata-xmlrpc 2015-08-12 05:13:08 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-2015:1592


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