fixing add device bug #2851
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!2851
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2851/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: #2701
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2701
Original created: 2026-02-05T00:42:52Z
Original updated: 2026-02-05T03:18:35Z
Original head: carverauto/serviceradar:2700-bugweb-ng-cant-add-device-through-ui
Original base: staging
Original merged: 2026-02-05T03:18:33Z 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
Replace
actorparameter withscopein Device API callsRemove
build_device_actor()helper function from two modulesUpdate
Device.get_by_uid()calls to use positional boolean parameterStandardize scope-based authorization across device operations
Diagram Walkthrough
File Walkthrough
device_controller.ex
Update device controller API call signatureweb-ng/lib/serviceradar_web_ng/api/device_controller.ex
Device.get_by_uid()call to include boolean parameterfalseanduse
scope:keyword argumentindex.ex
Replace actor with scope in device import operationsweb-ng/lib/serviceradar_web_ng_web/live/device_live/index.ex
build_device_actor()function entirelyactorparameters withscopein device import and creationfunctions
Device.get_by_uid()calls to use positional boolean parameterand
scope:keywordcreate_device()andcreate_single_device()to pass scopedirectly
show.ex
Standardize scope-based authorization in show operationsweb-ng/lib/serviceradar_web_ng_web/live/device_live/show.ex
build_device_actor()functionactor:parameter withscope:inInterfaceSettings.get_by_interface()callDevice.get_by_uid()calls to use positional boolean parameterinstead of
include_deleted:keywordAsh.update()call to usescope:instead ofactor:parameterImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2701#issuecomment-3850453533
Original created: 2026-02-05T00:43:21Z
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.🎫 #2700
scoperatherthan an
actormap) so requests execute successfully.Ash query error about missing
:actorfield onServiceRadar.Inventory.Device.created/visible as expected).
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: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
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:
Actor context removed: The PR removes
build_device_actor/1and replacesactor:usage withscope:which may reduceuser-identifying context available to audit logs depending on how
scopeis loggeddownstream.
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:
Authorization context shift: The PR changes authorization context passing from
actor:toscope:for read/updateoperations, which requires verification that
scopeenforces equivalentauthentication/authorization guarantees in the underlying Ash actions.
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/2701#issuecomment-3850455969
Original created: 2026-02-05T00:44:17Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Prevent race conditions during creation
To prevent a race condition when creating a device, refactor the
create_single_devicefunction to use
Ash.create/2with theon_conflictoption,making the operation
atomic.
web-ng/lib/serviceradar_web_ng_web/live/device_live/index.ex [2625-2661]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a potential race condition in the
create_single_devicefunction and proposes an idiomatic, atomic solution using
on_conflict, whichimproves the application's robustness.