registry update #2528
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2528
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2528/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #2085
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2085
Original created: 2025-12-08T07:02:35Z
Original updated: 2025-12-08T16:09:52Z
Original head: carverauto/serviceradar:bug/device_count_regression
Original base: main
Original merged: 2025-12-08T16:09:43Z by @mfreeman451
User description
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
PR Type
Bug fix
Description
Fix device count regression by ensuring canonical_device_id metadata consistency
Set canonical_device_id in metadata after IdentityEngine resolves device IDs
Prevents stats aggregator from filtering devices as non-canonical
Resolves fluctuating device count issue in registry
Diagram Walkthrough
File Walkthrough
registry.go
Add canonical_device_id metadata synchronizationpkg/registry/registry.go
canonical_device_idfield to match resolvedDeviceIDproposal.md
Document canonical_device_id metadata bug fixopenspec/changes/fix-dire-engine/proposal.md
consistency
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2085#issuecomment-3625312315
Original created: 2025-12-08T07:03:08Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
No security concerns identified
No security vulnerabilities detected by AI analysis. Human verification advised for critical code.🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status: Passed
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status:
Missing audit logs: The newly added metadata synchronization for canonical_device_id performs a critical state
change without explicit audit logging of the action, actor, or outcome.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
No failure path: The loop that sets canonical_device_id does not handle or log potential issues (e.g.,
conflicting existing metadata values) or verify post-conditions, reducing robustness.
Referred Code
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Metadata trust: The code writes canonical_device_id into user/device metadata without validating existing
values or source trust, which may have security implications depending on metadata
provenance.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2085#issuecomment-3625314576
Original created: 2025-12-08T07:03:57Z
PR Code Suggestions ✨
Explore these optional code suggestions:
✅
Prevent setting incorrect canonical IDsSuggestion Impact:
The commit refactored the metadata update into a helper function and invoked it right after the ResolveDeviceIDs call. While not placed strictly in an else block, this change centralizes the logic; however, based on the shown diff, it does not conditionally execute only on success. Still, the change directly relates to the suggested area by modifying how canonical_device_id is set.code diff:
To prevent data integrity issues, execute the metadata synchronization logic for
canonical_device_idonly if theResolveDeviceIDsfunction call succeeds, byplacing it in an
elseblock.pkg/registry/registry.go [247-262]
[Suggestion processed]Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a potential data integrity issue where
canonical_device_idcould be set incorrectly ifResolveDeviceIDsfails, and proposes a valid fix.Encapsulate metadata update within IdentityEngine
Move the
canonical_device_idmetadata update logic fromProcessBatchDeviceUpdatesinto theIdentityEngine.ResolveDeviceIDsmethod. Thischange would encapsulate the logic, improve the API design, and reduce the
chance of similar bugs in the future.
Examples:
pkg/registry/registry.go [251-262]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 7
__
Why: This is a strong design suggestion that correctly identifies a leaky abstraction; encapsulating the logic within
IdentityEnginewould make the API more robust and prevent future bugs.