Onemind-Services-LLC / netbox-secrets

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

[Bug]: Session Key is needed for API POSTS and no field is declared for this and Session Key is null when retrieved from API #80

Closed jguilford closed 1 year ago

jguilford commented 1 year ago

NetBox Secrets plugin version

v1.8.3

NetBox version

v3.5.4

Steps to Reproduce

Use API to retrieve a session-key it comes back null Use API to create secret requires session-key

Expected Behavior

Need this to either be documented on correct procedure or remove session-key requirement when loading secret through API

Observed Behavior

COMMAND: curl -X 'GET' 'https://######/api/plugins/secrets/session-keys/' -H 'accept: application/json' -H 'Authorization: Token #####' -k RESULT: {"count":1,"next":null,"previous":null,"results":[{"pk":1,"id":1,"url":"https://######/api/plugins/secrets/session-keys/1/","display":"admin (RSA)","userkey":{"id":1,"url":"https://#######/api/plugins/secrets/user-keys/1/","display":"admin"},"session_key":null,"created":"2023-07-04T13:49:23.587430Z"}]} COMMAND: curl -X 'POST' 'https://#######/api/plugins/secrets/secrets/' -H 'accept: application/json' -H 'Authorization: Token ###########' -H 'Content-Type: multipart/form-data' -H 'X-CSRFTOKEN: gpwRlQdyqo2HEhbrWL5SyvB0poHIAp1WeZpkFVqnNfLW06oKZKTj8ZfbB5ARSxbC' -F 'custom_fields=' -F 'assigned_object_type=dcim.device' -F 'assigned_object_id=45' -F 'name=admin' -F 'comments=' -F 'role=1' -F 'plaintext=testpassword' -F 'tags=' -F 'description=' -k RESULT: ["A session key must be provided when creating or updating secrets."]

abhi1693 commented 1 year ago

This is already documentated at https://github.com/Onemind-Services-LLC/netbox-secrets/blob/master/docs/rest-api/working-with-secrets.md.

Please provide why this is interpreted as a bug when session key is crucial in updating secrets.