[Bug]: Unable to search secrets by name or assigned device (UI and API)
uedvt359 opened this issue · 3 comments
NetBox Secrets plugin version
v1.7.6
NetBox version
v3.4.8
Steps to Reproduce
- add some secrets
- try to search for a secret by attribute name with
/plugins/netbox_secrets/secrets/?name=My+Secret
(or/api/
...) - try to search for a secret by attribute device with
/plugins/netbox_secrets/secrets/?device=my-server.com
(or/api/
...)
Expected Behavior
only secrets matching name
or device
, respecively, exactly should be returned. this worked in DanSheps' netbox_secretstore plugin
Observed Behavior
for name:
- UI: the parameter is ignored and all secrets are returned
- API:
HTTP/1.1 400 Bad Request
=>{"name":["“My Secret” is not a valid value."]}
for device:
- UI: the parameter is ignored and all secrets are returned
- API: the parameter is ignored and all secrets are returned
This makes it impossible to retrieve secrets precisely, for example in automation. interestingly, querying by ?role=
works correctly in both old and new plugins.
name
can be fixed by simply removing these lines: https://github.com/Onemind-Services-LLC/netbox-secrets/blob/master/netbox_secrets/filtersets.py#L91-L95
for device
(and device_id, virtual_machine, virtual_machine_id) i tried adding the following lines, but that resulted in 500 internal server error failures when calling get-session-key: https://github.com/DanSheps/netbox-secretstore/blob/4ad3bdd24d40b3f7f822e72b4fea76819df0ae9a/netbox_secretstore/filtersets.py#L53-L58
ImportError: Module "netbox_secrets.urls" does not define a "urlpatterns" attribute/class