Skip to content
Back to skills

1011 Control Center Access Logic Fix 4b515ec0

ASecurity

**Version**: 0.235.011 **Fixed in**: 0.235.011 **Category**: Access Control / Authorization

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
testingpythongotestingfrontend

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 1011-control_center_access_logic_fix_4b515ec0 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1011 Control Center Access Logic Fix 4b515ec0?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1011 Control Center Access Logic Fix 4b515ec0
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1011-control-center-access-logic-fix-4b515ec0/badge)](https://www.skillsdirectory.com/skills/tools-only-1011-control-center-access-logic-fix-4b515ec0)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# Control Center Access Control Logic Fix

**Version**: 0.235.011  
**Fixed in**: 0.235.011  
**Category**: Access Control / Authorization

## Issue Description

The Control Center access control logic had a discrepancy where:

1. When `require_member_of_control_center_admin` was **disabled** (the default), users with the `ControlCenterAdmin` role (but NOT the regular `Admin` role) were incorrectly granted access.

2. The intended behavior is that the `ControlCenterAdmin` role should ONLY be checked when that role feature is enabled. When disabled, only the regular `Admin` role should grant access.

## Root Cause

The `control_center_required` decorator in `functions_authentication.py` was checking for `ControlCenterAdmin` role unconditionally, allowing access regardless of whether the role feature was enabled or not.

## Expected Behavior

### When `require_member_of_control_center_admin` is DISABLED (default):
| User Role | Access Level |
|-----------|-------------|
| `Admin` | Full access (Dashboard + Management + Activity Logs) |
| `ControlCenterAdmin` only | **No access** (role feature not enabled) |
| `Admin` + `ControlCenterAdmin` | Full access (via Admin role) |
| `ControlCenterDashboardReader` | Dashboard only (if that setting is enabled) |
| Normal user | No access |

### When `require_member_of_control_center_admin` is ENABLED:
| User Role | Access Level |
|-----------|-------------|
| `Admin` only | **No access** (must have ControlCenterAdmin) |
| `ControlCenterAdmin` | Full access |
| `Admin` + `ControlCenterAdmin` | Full access (via ControlCenterAdmin role) |
| `ControlCenterDashboardReader` | Dashboard only (if that setting is enabled) |
| Normal user | No access |

## Key Insight

The setting `require_member_of_control_center_admin` acts as a **switch** between two access control modes:
- **OFF (default)**: Use `Admin` role for access control
- **ON**: Use `ControlCenterAdmin` role for access control

The `ControlCenterAdmin` role is **only relevant when the setting is enabled**. Otherwise, it's ignored.

## Files Modified

### 1. `functions_authentication.py`
- Updated `control_center_required` decorator to:
  - Check for both `ControlCenterAdmin` and regular `Admin` roles
  - Properly fall back to Admin role when ControlCenterAdmin requirement is disabled
  - Deny access to non-admin users with appropriate error messages
  - Comprehensive docstring explaining both access modes

### 2. `route_frontend_control_center.py`
- Updated the `control_center()` route to:
  - Compute `has_full_admin_access` based on user roles AND settings
  - Pass the correct value to the template for conditional tab rendering

### 3. `config.py`
- Version updated to `0.235.011`

## Code Changes Summary

### Decorator Logic (functions_authentication.py)
```python
# New logic flow:
# 1. Check if ControlCenterAdmin requirement is ENABLED
#    - If ENABLED: Only ControlCenterAdmin role grants access
#    - Regular Admin role is NOT sufficient
# 2. If ControlCenterAdmin requirement is DISABLED:
#    - Only regular Admin role grants access
#    - ControlCenterAdmin role is IGNORED (feature not enabled)
#    - DashboardReader gets dashboard-only (if that setting enabled)
# 3. Non-admin users are denied with appropriate message
```

### Frontend Route Logic (route_frontend_control_center.py)
```python
# Compute has_full_admin_access based on which mode is active:
if require_member_of_control_center_admin:
    # ControlCenterAdmin role is required
    has_full_admin_access = has_control_center_admin_role
else:
    # Only regular Admin role grants access
    has_full_admin_access = has_regular_admin_role
```

## Testing

Functional test created: `functional_tests/test_control_center_access_logic.py`

The test validates:
1. Decorator checks for regular Admin role
2. Decorator checks for ControlCenterAdmin role
3. ControlCenterAdmin gets access when setting is enabled
4. ControlCenterAdmin is ignored when setting is disabled
5. Regular Admin gets access when requirement is disabled
6. Non-admin users are denied access
7. Comprehensive docstring exists

## Validation Steps

1. **Test as Admin (CC admin requirement DISABLED)**:
   - User with `Admin` role should see all Control Center tabs
   
2. **Test as ControlCenterAdmin ONLY (CC admin requirement DISABLED)**:
   - User with only `ControlCenterAdmin` role should be DENIED access
   
3. **Test as Admin (CC admin requirement ENABLED)**:
   - User with only `Admin` role should be DENIED access
   
4. **Test as ControlCenterAdmin (CC admin requirement ENABLED)**:
   - User with `ControlCenterAdmin` role should have full access
   
5. **Test as DashboardReader**:
   - Should see only Dashboard tab when that requirement is enabled

## Related Settings

| Setting | Description |
|---------|-------------|
| `require_member_of_control_center_admin` | When enabled, requires ControlCenterAdmin role for full access. When disabled, uses Admin role instead. |
| `require_member_of_control_center_dashboard_reader` | When enabled, allows DashboardReader role for dashboard-only access |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.