Onemind-Services-LLC / netbox-secrets

Enhance your secret management with encrypted storage and flexible, user-friendly features.
Apache License 2.0
93 stars 8 forks source link

[Bug]: Unable to filter based on "assigned_object_id" - no alternative (Device ID?) field available #127

Closed kirk444 closed 6 months ago

kirk444 commented 6 months ago

NetBox Secrets plugin version

v1.10.1

NetBox version

v3.7.1

Steps to Reproduce

After updating from 3.6 / 1.9 I found that my scripts that rely on using the REST API to query and filter on "assigned_object_id" no longer function. It seems that "assigned_object_id" while part of the returned object, is not filterable anymore. In previous versions this worked, it's only after updating to 3.7.1 / 1.10.1 that it has stopped working.

In looking at the behavior of e.g. dcim.interfaces I see that they now use a "device_id" instead of "assigned_object_id" to define the device.

In looking at the docs, it seems that there is still a (filterable) "assigned_object_type_id" but I have no idea what this value is, as it's not part of the returned json objects.

Expected Behavior

I expect "https://netbox/api/plugins/secrets/secrets/?assigned_object_id=416" to return secret objects with "assigned_object_id=416".

Observed Behavior

An unfiltered list of all secret objects is returned.

abhi1693 commented 6 months ago

This is not a bug. Secrets can be attached to any object and filtering just using the object id has no meaning because any object can have that I'd in django. You do need to specify the assigned object type as well as the plugin doesn't make assumptions that it has to be device model.