REST API endpoint for user objects does not allow setting a password #4308

Closed
opened 2025-12-29 18:34:33 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Nov 25, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.9.10

Steps to Reproduce

  1. Attempt to create a new user via the REST API endpoint, specifying a username and password.

Expected Behavior

The new user should be created, and authentication should be possible using the provided username and password.

Observed Behavior

The user instance is created, however the password is not set. This is because the password field has been omitted from UserSerializer. (This was not caught by the tests due to a bug identified under #5176.)

The fix for this bug is to add password to the serializer as a write-only field (since we don't want to expose password hashes externally).

Originally created by @jeremystretch on GitHub (Nov 25, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.9 * NetBox version: 2.9.10 ### Steps to Reproduce 1. Attempt to create a new user via the REST API endpoint, specifying a username and password. ### Expected Behavior The new user should be created, and authentication should be possible using the provided username and password. ### Observed Behavior The user instance is created, however the password is not set. This is because the `password` field has been omitted from UserSerializer. (This was not caught by the tests due to a bug identified under #5176.) The fix for this bug is to add `password` to the serializer as a write-only field (since we don't want to expose password hashes externally).
adam added the type: bugstatus: accepted labels 2025-12-29 18:34:33 +01:00
adam closed this issue 2025-12-29 18:34:33 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4308