missing RBAC #2286
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!2286
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2286/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: #1714
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1714
Original created: 2025-10-06T00:22:04Z
Original updated: 2025-10-06T00:23:25Z
Original head: carverauto/serviceradar:core/auth_issue
Original base: main
Original merged: 2025-10-06T00:22:12Z by @mfreeman451
PR Type
Enhancement
Description
Add comprehensive RBAC (Role-Based Access Control) system
Upgrade JWT library to v5 for enhanced security
Configure role-based route protection for API endpoints
Define user roles and granular permissions structure
Diagram Walkthrough
File Walkthrough
go.mod
Upgrade JWT library dependencygo.mod
go.sum
Update dependency checksumsgo.sum
configmap.yaml
Implement RBAC configuration systemk8s/demo/base/configmap.yaml
access
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1714#issuecomment-3369555421
Original created: 2025-10-06T00:22:27Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
Insecure secret management
Description: Hardcoded placeholder secrets (
jwt_secretand a bcrypt hash placeholder) in config may beaccidentally deployed if not replaced, leading to weak or predictable authentication.
configmap.yaml [125-129]
Referred Code
Overly permissive authorization
Description: Broad wildcard route patterns and permissive role permissions (e.g.,
admin: [""],device:,alert:*) risk unintended access if the enforcement layer matches routes oractions too loosely.
configmap.yaml [141-160]
Referred Code
Inconsistent JWT validation
Description: Adding
github.com/golang-jwt/jwt/v5alongside existing v4 checksums suggests mixed usage;if tokens are validated with differing libs or algorithms, it may enable bypass due to
inconsistent verification.
go.mod [74-74]
Referred Code
🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
No custom compliance provided
Follow the guide to enable custom compliance check.
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/1714#issuecomment-3369556635
Original created: 2025-10-06T00:23:25Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Decouple API routes from roles
Modify the RBAC configuration to map API routes to permissions instead of
directly to roles. This change decouples the route structure from the role
definitions, making the system more flexible and easier to maintain.
Examples:
k8s/demo/base/configmap.yaml [141-161]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: This is a critical architectural suggestion that addresses a fundamental design flaw in the new RBAC system, significantly improving its scalability and maintainability by decoupling routes from roles.
Refine operator permissions for consistency
To align with route protections and the principle of least privilege, replace
wildcard permissions for the
operatorrole with explicitreadandwritepermissions for
deviceandalert.k8s/demo/base/configmap.yaml [138]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies an inconsistency between the
operatorrole's wildcard permissions and the specificroute_protectionrules, which deny delete access. Applying this change enhances security and configuration clarity.Remove redundant role assignments
Remove the redundant
operatorandviewerroles from theadminuser's role list,as the
adminrole already grants all permissions via a wildcard.k8s/demo/base/configmap.yaml [132]
Suggestion importance[1-10]: 5
__
Why: The suggestion correctly identifies that assigning
operatorandviewerroles to theadminuser is redundant because theadminrole already has wildcard permissions. This change improves configuration clarity and maintainability.