Bug 1133799
| Summary: | nil allowed as user parameter at user creation | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Tomas Lestach <tlestach> |
| Component: | API | Assignee: | Shlomi Zadok <szadok> |
| Status: | CLOSED ERRATA | QA Contact: | Tazim Kolhar <tkolhar> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.0.4 | CC: | cwelton, dcleal, sthirugn, tkolhar |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://projects.theforeman.org/issues/7261 | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-08-12 05:13:08 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Actually, it's not just the "POST /api/users" API, but there're another 26 APIs affected. 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. Created redmine issue http://projects.theforeman.org/issues/7261 from this bug (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"]} } Upstream bug assigned to jmagen Moving to POST since upstream bug http://projects.theforeman.org/issues/7261 has been closed ------------- Joseph Magen Applied in changeset commit:fb5ac6168beaad3e205a113a92361066e14355f3. Upstream bug assigned to szadok 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 This bug is slated to be released with Satellite 6.1. 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 |
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.