Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@ def validate_nodeinfo(nodeinfo):
if 'latitude' not in nodeinfo['location'] or 'longitude' not in nodeinfo['location']:
return False

if 'node_id' in nodeinfo:
# If node_id contains characters where not a digit or simple letters then reject it
# This should allow node_id from MAC without ":" and node_id like "gw1"
if re.search(r'[^a-zA-Z0-9]', nodeinfo['node_id']):
return False
else:
# Reject if node_id is missing
return False

return True