Failed to create an input for a user without admin_all_objects role
SDK version: 1.5.0 (but I think 1.6.x should be affected according to code) Platform version: Linux Framework version: 2.7.9 Splunk version: 6.4, 6.5
If a user does not have the role admin_all_objects, he cannot create an input using the API: service.inputs.create("my_input_name", "my_input_type" , **my_input_properties)
In that case, a HTTP error will be raised (404) because in https://github.com/splunk/splunk-sdk-python/blob/master/splunklib/client.py#L2388
If a create link cannot be found, it is assumed it is a sub-resource which is incorrect because it also depends on user's capabilities.
How to reproduce
- create a role having only the capability to create a modular input
- create a user having this new role
- use the SDK service object to create a new input using service.inputs.create("my_input_name", "my_input_type" , **my_input_properties)
Expected behavior
- user having the capability to create a modular input should be able to create a new one even though he hasn't the admin_all_objects role
@vergnes This is intended for security concerns.
I don't believe that is intended and preventing a user with the role to create a modular input to do so does not look like a "feature". It means that the user needs to have the admin_all_objects role to be able to create an input using the API whereas he can do it using the UI.
@vergnes can you share the role from authorize.conf that you're referring to for "create a modular input"? If that role has the admin_all_objects capability there should be no issue. Otherwise, this is by design for the API and the UI reflects this security restriction.
According to docs https://docs.splunk.com/Documentation/Splunk/7.0.2/AdvancedDev/ModInputsSpec#Specify_permissions_for_modular_input_scripts
You can create a specific capability to edit a customized modular input type. Therefore, in that case admin_all_objects is not required. Instead of UI I should have said the splunkd API:
POST /servicesNS/nobody/
For example, if the input type is mi_input the authorize.conf looks like: [my_admin_role] edit_modinput_mi_input=enabled
[capability::edit_modinput_mi_input]