Updates/multi tenant cleanup #2678
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!2678
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2678/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: #2317
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2317
Original created: 2026-01-15T07:35:43Z
Original updated: 2026-01-15T18:20:06Z
Original head: carverauto/serviceradar:updates/multi-tenant-cleanup
Original base: staging
Original merged: 2026-01-15T18:20:02Z 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
Enhancement, Documentation
Description
Replace
authorize?: falsewith explicitSystemActorusage across web-ng codebaseConsolidate hardcoded system_actor definitions to use
ServiceRadar.Actors.SystemActorAdd comprehensive OpenSpec proposal for breaking out SaaS Control Plane from tenant runtime
Implement tenant-aware and platform-level actor patterns for authorization
Diagram Walkthrough
File Walkthrough
24 files
Replace authorize?: false with SystemActor patternConvert to tenant-aware SystemActor usageAdd SystemActor for tenant and platform operationsImplement tenant and platform actor patternsReplace authorize?: false with explicit actorsAdd platform SystemActor for NATS operationsUse tenant-scoped SystemActor for integration queriesConvert to tenant-aware SystemActor patternReplace authorize?: false with platform SystemActorAdd platform SystemActor for device operationsImplement platform and tenant actor patternsUse platform SystemActor for cross-tenant package expiryAdd platform SystemActor for edge operationsUse platform SystemActor for enrollment operationsReplace authorize?: false with platform SystemActorRemove authorize?: false from NATS operationsUse platform SystemActor for JWT validationAdd tenant-scoped SystemActor for agent queriesUse platform SystemActor for tenant operationsAdd platform SystemActor for tenant lookupUse platform SystemActor for tenant creationReplace authorize?: false with platform SystemActorReplace hardcoded system_actor with SystemActor.platformRemove authorize?: false from update operation5 files
Comprehensive task breakdown for Control Plane separationDetailed design for tenant isolation and Control Plane architectureOpenSpec proposal for breaking out SaaS Control PlaneSpecification requirements for tenant isolationSpecification for SystemActor authorization pattern2 files
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2317#issuecomment-3753259671
Original created: 2026-01-15T07:36:30Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
Overprivileged system actor
Description: Multiple actions now execute with
SystemActor.platform(:nats_controller)(e.g., generatingNatsPlatformToken, listing tenants, reading/creatingNatsOperator), which is highlyprivileged and could enable platform-wide token/operator/tenant data access if these
endpoints are reachable without strict platform-admin authentication/authorization
enforcement.
nats_controller.ex [34-257]
Referred Code
Missing tenant context
Description:
update_site/2andregenerate_config/1now performAsh.updateusingSystemActor.platform(:edge_sites_live)but without passing a tenant context, which canpotentially cause cross-tenant or wrong-tenant updates for tenant-scoped resources
depending on Ash multitenancy configuration defaults.
show.ex [493-508]
Referred 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: 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: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Over-privileged actor: Tenant-scoped updates are executed using
SystemActor.platform/1, which risks bypassingtenant isolation/authorization expectations for tenant resources.
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/2317#issuecomment-3753263567
Original created: 2026-01-15T07:37:41Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Use tenant-scoped actor for updates
In
update_site/2, replace the platform-levelSystemActorwith a tenant-scopedone. Pass the
socketto the function to retrieve the tenant ID and create a morerestrictive actor.
web-ng/lib/serviceradar_web_ng_web/live/admin/edge_sites_live/show.ex [493-500]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies that a platform-level actor is used for a tenant-specific operation, which violates the principle of least privilege and the PR's main goal. Using a tenant-scoped actor as proposed is a significant security improvement.
Remove authorization bypass in update
Remove the
authorize?: falseoption from theAsh.update/2call. The operationshould rely on the
actoralready present in the changeset for authorization.web-ng/lib/serviceradar_web_ng_web/live/settings/rules_live/index.ex [75-81]
[To ensure code accuracy, apply this suggestion manually]Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies and fixes a remaining
authorize?: falsecall, which is a security risk and directly contradicts the main goal of the PR. This is a critical fix for security and consistency.Use actual actor context
In
expire_package/2, pass theactorvariable toRecordEventWorker.enqueue/3instead of the hardcoded string
"system". This ensures the authorization contextis correctly passed to the background job.
web-ng/lib/serviceradar_web_ng/edge/workers/expire_packages_worker.ex [69-72]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly points out that a hardcoded
"system"string is used for an actor, which is inconsistent with the PR's pattern of passing explicit actor structs. Using theactorvariable improves consistency and ensures proper authorization context is propagated to the background worker.Imported GitHub PR review comment.
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2317#discussion_r2693291909
Original created: 2026-01-15T07:37:43Z
Original path: web-ng/lib/serviceradar_web_ng_web/controllers/api/collector_controller.ex
Original line: 13
I don't really understand why we have to do this at all anymore, we need to be using tenant specific CNPG credentials that only has access to their schema