splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

ValueError : StoragePasswords cannot have wildcards in namespace.

Open lmnogues opened this issue 4 years ago • 2 comments

Hi,

I know it's more likely a feature and not a bug. But I was wondering why is StoragePasswords is protected from access with wildcard apps or namespace, when the same action using rest is not protected ?

The first snippet will generate an error because app & owner are set to be wildcards

s = client.connect(username="<user>", password="<redacted>",host="<ip>",port="<port>",app="-",owner="-")

try:
    for pw in s.storage_passwords:
        print(pw.username)
except ValueError as ve:
    print(ve)

The following snippet will not generate an error with the wildcards :

req = requests.get(f"https://<host>:<port>/servicesNS/-/-/storage/passwords/", verify=False, headers={'Authorization': s.token},data={'output_mode':"json"})
req.raise_for_status()
for pw in req.json().get("entry"):
    print(pw.get("content").get("username"))

In our workflow with Splunk, we might not know where is stored the password so we need to be able to use wildcard on the app level of the namespace.

Is there any solution with splunklib or should we stick with our basic requests ?

lmnogues avatar May 25 '22 15:05 lmnogues

Hi @Jalkar , thanks from bringing this to our knowledge. We are analysing on this and will be sharing an update soon.

ashah-splunk avatar Jun 01 '22 08:06 ashah-splunk

@Jalkar we would request you to use the latest SDK release with the changes and let us know if it resolves the issue.

ashah-splunk avatar Jul 12 '22 12:07 ashah-splunk