Hide Forgot
Description of problem: No validation at all applies to default_download_policy setting, so user can input whatever value. ``` # hammer -u admin -p changeme settings set --name default_download_policy --value they-told-me-i-could-be-anything-i-wanted-so-i-became-a-download-policy-value Setting [default_download_policy] updated to [they-told-me-i-could-be-anything-i-wanted-so-i-became-a-download-policy-value] # hammer -u admin -p changeme settings list | grep policy default_download_policy | they-told-me-i-could-be-anything-i-wanted-so-i-became-a-download-policy-value | Default download policy for repositories (either 'immediate', 'on_demand', or... ``` - applies to UI and API as well. Version-Release number of selected component (if applicable): Satellite 6.2.0 Snap 5.1 How reproducible: Actual results: any value (including Null) accepted Expected results: should accept only: 'immediate', 'on_demand', or 'background' Additional info:
Created redmine issue http://projects.theforeman.org/issues/14364 from this bug
Moving to POST since upstream bug http://projects.theforeman.org/issues/14364 has been closed ------------- David Davis Applied in changeset commit:katello|17a42c0e4de23013ccdb4db79a4f5c32938e6239.
VERIFIED on sat6.2.0 Beta (GA10.1) UI provides a dropdown menu now CLI: # hammer -u admin -p changeme settings set --name default_download_policy --value foo Could not update the setting: Value is not included in the list # hammer -u admin -p changeme settings set --name default_download_policy --value "" Could not update the setting: Value is not included in the list # hammer -u admin -p changeme settings set --name default_download_policy --value "immediate1" Could not update the setting: Value is not included in the list # hammer -u admin -p changeme settings set --name default_download_policy --value "immediate" Setting [default_download_policy] updated to [immediate] API: [root ~]# curl -k -u admin:changeme -H 'Content-Type: application/json' -X PUT -d '{"value": "on_demand"}' https://sat6.server.com/api/v2/settings/29 {"value":"on_demand","description":"Default download policy for repositories (either 'immediate', 'on_demand', or 'background')","category":"Setting::Katello","settings_type":"string","default":"immediate","created_at":"2016-05-02 09:20:52 UTC","updated_at":"2016-05-09 09:09:14 UTC","id":29,"name":"default_download_policy"} # curl -k -u admin:changeme -H 'Content-Type: application/json' -X PUT -d '{"value": "foo"}' https://sat6.server.com/api/v2/settings/29{ "error": {"id":29,"errors":{"value":["is not included in the list"]},"full_messages":["Value is not included in the list"]} } [root ~]# curl -k -u admin:changeme -H 'Content-Type: application/json' -X PUT -d '{"value": ""}' https://sat6.server.com/api/v2/settings/29 { "error": {"id":29,"errors":{"value":["is not included in the list"]},"full_messages":["Value is not included in the list"]} } [root ~]# curl -k -u admin:changeme -H 'Content-Type: application/json' -X PUT -d '{"value": "immediate_lol"}' https://sat6.server.com/api/v2/settings/29 { "error": {"id":29,"errors":{"value":["is not included in the list"]},"full_messages":["Value is not included in the list"]} } [root ~]# curl -k -u admin:changeme -H 'Content-Type: application/json' -X PUT -d '{"value": "immediat"}' https://sat6.server.com/api/v2/settings/29{ "error": {"id":29,"errors":{"value":["is not included in the list"]},"full_messages":["Value is not included in the list"]} } [root ~]# curl -k -u admin:changeme -H 'Content-Type: application/json' -X PUT -d '{"value": "immediate", "foo":"bar"}' https://sat6.server.com/api/v2/settings/29 {"value":"immediate","description":"Default download policy for repositories (either 'immediate', 'on_demand', or 'background')","category":"Setting::Katello","settings_type":"string","default":"immediate","created_at":"2016-05-02 09:20:52 UTC","updated_at":"2016-05-09 09:09:54 UTC","id":29,"name":"default_download_policy"}
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/RHBA-2016:1501