-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v3.2.2
Python version
3.10
Steps to Reproduce
- Setup netbox with remote auth based on netbox.authentication.RemoteUserBackend / Header
- Auto Create User must be enabled, see configuration example below
- Now open netbox and set the define AUTH_HEADER to a username that contains invalid characters like
:which is used for example by Google IAP - This creates a new user in netbox, now open the admin interface of netbox and try to change anything in the user (/admin/auth/user/)
- The user edit dialog validates the username if you change something, the frontend does not allow saving any changes there because of an invalid character in the username.
REMOTE_AUTH_ENABLED: true
REMOTE_AUTH_BACKEND: "netbox.authentication.RemoteUserBackend"
REMOTE_AUTH_HEADER: "HTTP_X_GOOG_AUTHENTICATED_USER_EMAIL"
REMOTE_AUTH_AUTO_CREATE_USER: true
Expected Behavior
Netbox should sanitize the usernames that are provided via REMOTE_AUTH_HEADER to create valid usernames.
Observed Behavior
Google IAPs headers have a value of: accounts.google.com:[email protected] and it creates a new user based on this in netbox.
But the admin dialogs to change or update those user accounts validates the username and rejects any changes because of invalid characters in the username:
Enter a valid username. This value may contain only letters, numbers, and @/./+/-/_ characters.
towolf
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application