Local Context Data can be set to non-none falsy values #10859

Closed
opened 2025-12-29 21:36:50 +01:00 by adam · 1 comment
Owner

Originally created by @fabi125 on GitHub (Mar 7, 2025).

Originally assigned to: @fabi125 on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.5

Python Version

3.10

Steps to Reproduce

  1. Edit a device in the UI (e.g. https://demo.netbox.dev/dcim/devices/37/)
  2. Put in 0 as the local config context and save.

Expected Behavior

Change gets rejected for not being correct JSON (like it does for any other flat values).
Config Context also correctly rejects 0 or "" values.

Observed Behavior

Change is accepted.

Image

Relevant code: https://github.com/netbox-community/netbox/blame/v4.2.5/netbox/extras/models/configs.py#L202-L206

Happy to put up a PR for this.

Originally created by @fabi125 on GitHub (Mar 7, 2025). Originally assigned to: @fabi125 on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.5 ### Python Version 3.10 ### Steps to Reproduce 1. Edit a device in the UI (e.g. https://demo.netbox.dev/dcim/devices/37/) 2. Put in 0 as the local config context and save. ### Expected Behavior Change gets rejected for not being correct JSON (like it does for any other flat values). Config Context also correctly rejects 0 or "" values. ### Observed Behavior Change is accepted. ![Image](https://github.com/user-attachments/assets/07dfe041-dbc8-40cb-9b3a-f25fadc789d9) Relevant code: https://github.com/netbox-community/netbox/blame/v4.2.5/netbox/extras/models/configs.py#L202-L206 Happy to put up a PR for this.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:36:50 +01:00
adam closed this issue 2025-12-29 21:36:51 +01:00
Author
Owner

@jnovinger commented on GitHub (Mar 8, 2025):

Thanks for volunteering @fabi125 , assigned it to you.

@jnovinger commented on GitHub (Mar 8, 2025): Thanks for volunteering @fabi125 , assigned it to you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10859