Description
Every newly discovered device is inserted with devParentRelType set to the literal 4-character string "[]" instead of the configured NEWDEV_devParentRelType default ("default"). This isn't an empty/null value — it's the Python string representation of an empty list, stored verbatim in a text column that's meant to hold one of: default, child, logical, nic, virtual.
Root cause (found by reading the source)
server/plugins/newdev_template/config.json, the devParentRelType setting definition:
{
"function": "devParentRelType",
"type": {
"dataType": "array",
"elements": [
{ "elementType": "select", "elementOptions": [{ "orderable": "true"}], "transformers": ["deviceRelType"] }
]
},
"default_value": "default",
"options": ["default", "child", "logical", "nic", "virtual"],
...
}
dataType is "array" (and the single select element has no "multiple": true), even though:
devParentRelType is a single-valued column (one relationship type per device), and
default_value is a plain scalar string "default", not a list.
On this instance, SELECT setValue FROM Settings WHERE setKey='NEWDEV_devParentRelType' currently returns the string '[]', not 'default' — the array-typed setting resolved to an empty-list representation instead of falling back to the scalar default_value.
server/scan/device_handling.py then inserts this raw setting value verbatim for every new device:
'{sanitize_SQL_input(get_setting_value("NEWDEV_devParentRelType"))}',
so every new device's devParentRelType becomes the literal string "[]".
Impact
devParentRelType no longer matches any of the 5 documented values for brand-new devices.
- Cosmetically this happens to fall into the same "unstyled/default" bucket in the network tree color/line-style logic (
getRelationshipConf() in front/js/ui_components.js only special-cases child/nic/virtual/logical), so it isn't visually obvious — but any code doing an exact comparison against "default" (or against "") will not match, and the field shows the confusing raw value [] when inspected directly (e.g. via API/DB).
- Confirmed reproducible right now: creating a brand-new device (e.g. via ARPSCAN discovering a MAC for the first time) immediately gets
devParentRelType = '[]'.
Suggested fix
Either:
- Change
dataType to "string" for this setting (matching other genuinely single-valued select settings, e.g. ARPSCAN_RUN), since devParentRelType is not multi-valued, or
- If
dataType: array must stay for UI reasons, fix the settings resolution so an array-typed setting with no explicit value falls back to the scalar default_value instead of producing str([]).
Environment
- Image:
ghcr.io/netalertx/netalertx (recent digest as of 2026-09-18)
- Reproducible via: let ARPSCAN discover a brand new MAC, then check
devParentRelType for that device.
Description
Every newly discovered device is inserted with
devParentRelTypeset to the literal 4-character string"[]"instead of the configuredNEWDEV_devParentRelTypedefault ("default"). This isn't an empty/null value — it's the Python string representation of an empty list, stored verbatim in a text column that's meant to hold one of:default,child,logical,nic,virtual.Root cause (found by reading the source)
server/plugins/newdev_template/config.json, thedevParentRelTypesetting definition:{ "function": "devParentRelType", "type": { "dataType": "array", "elements": [ { "elementType": "select", "elementOptions": [{ "orderable": "true"}], "transformers": ["deviceRelType"] } ] }, "default_value": "default", "options": ["default", "child", "logical", "nic", "virtual"], ... }dataTypeis"array"(and the singleselectelement has no"multiple": true), even though:devParentRelTypeis a single-valued column (one relationship type per device), anddefault_valueis a plain scalar string"default", not a list.On this instance,
SELECT setValue FROM Settings WHERE setKey='NEWDEV_devParentRelType'currently returns the string'[]', not'default'— the array-typed setting resolved to an empty-list representation instead of falling back to the scalardefault_value.server/scan/device_handling.pythen inserts this raw setting value verbatim for every new device:'{sanitize_SQL_input(get_setting_value("NEWDEV_devParentRelType"))}',so every new device's
devParentRelTypebecomes the literal string"[]".Impact
devParentRelTypeno longer matches any of the 5 documented values for brand-new devices.getRelationshipConf()infront/js/ui_components.jsonly special-caseschild/nic/virtual/logical), so it isn't visually obvious — but any code doing an exact comparison against"default"(or against"") will not match, and the field shows the confusing raw value[]when inspected directly (e.g. via API/DB).devParentRelType = '[]'.Suggested fix
Either:
dataTypeto"string"for this setting (matching other genuinely single-valued select settings, e.g.ARPSCAN_RUN), sincedevParentRelTypeis not multi-valued, ordataType: arraymust stay for UI reasons, fix the settings resolution so an array-typed setting with no explicit value falls back to the scalardefault_valueinstead of producingstr([]).Environment
ghcr.io/netalertx/netalertx(recent digest as of 2026-09-18)devParentRelTypefor that device.