The component security system controls access to routes through two mandatory policies defined in each component’s manifest.json:
routes_auth: Controls whether authentication is requiredroutes_role: Controls which roles can access specific routes{
"uuid": "example_0yt2sa",
"name": "Example Component",
"route": "/example",
"security": {
"routes_auth": {
"/": false,
"/admin": true
},
"routes_role": {
"/": ["*"],
"/admin": ["admin", "moderator"]
}
}
}
Controls whether a session-authenticated user is required for each route.
| Value | Meaning |
|---|---|
true |
Authentication required (user must have a valid session) |
false |
Public route (no authentication required) |
{
"routes_auth": {
"/": false, // Public homepage
"/profile": true, // Requires login
"/admin": true // Requires login
}
}
Controls which roles can access each route.
| Value | Meaning |
|---|---|
["*"] |
Wildcard - any role is allowed (including no role if auth not required) |
["admin", "moderator"] |
Only users with “admin” OR “moderator” role |
["moderator"] |
Only users with “moderator” role |
"*" cannot be mixed with explicit roles in the same entry{
"routes_role": {
"/": ["*"], // Anyone can access
"/user": ["admin", "moderator"], // Admin or moderator
"/profile": ["admin"], // Only admin
"/admin": ["admin"] // Only admin
}
}
Policies use prefix matching (most specific wins):
| Route | Policy Key / |
Policy Key /admin |
Result |
|---|---|---|---|
/ |
✅ Matches | ❌ | Uses / policy |
/admin |
✅ | ✅ Matches | Uses /admin policy (more specific) |
/admin/users |
✅ | ✅ Matches | Uses /admin policy |
When all routes in a component share the same security requirements, you only need to define the root route "/":
{
"security": {
"routes_auth": {
"/": true
},
"routes_role": {
"/": ["*"]
}
}
}
This single configuration applies to all routes in the component:
/component/component/profile/component/profile/ajax/component/admin{
"security": {
"routes_auth": {
"/": true
},
"routes_role": {
"/": ["*"],
"/admin": ["admin"],
}
}
}
In this last case, the /component/admin route will be accessible only to users with the “admin”.
When a request is received, security is evaluated in this order:
routes_auth)
routes_role)
Both routes_auth and routes_role are mandatory in the security block:
{
"security": {
"routes_auth": {}, // REQUIRED - cannot be omitted
"routes_role": {} // REQUIRED - cannot be omitted
}
}
At minimum, the root route "/" must be defined in both policies:
{
"security": {
"routes_auth": {
"/": false // REQUIRED
},
"routes_role": {
"/": ["*"] // REQUIRED
}
}
}
Fail-Closed Behavior: If a route is not mapped in either policy, access is denied by default.
{
"uuid": "public_0yt2sa",
"name": "Public Component",
"route": "/public",
"security": {
"routes_auth": {
"/": false
},
"routes_role": {
"/": ["*"]
}
}
}
{
"uuid": "private_0yt2sa",
"name": "Private Component",
"route": "/private",
"security": {
"routes_auth": {
"/": true
},
"routes_role": {
"/": ["*"]
}
}
}
{
"uuid": "admin_0yt2sa",
"name": "Admin Panel",
"route": "/admin",
"security": {
"routes_auth": {
"/": true
},
"routes_role": {
"/": ["admin"]
}
}
}
{
"uuid": "mixed_0yt2sa",
"name": "Mixed Component",
"route": "/mixed",
"security": {
"routes_auth": {
"/": false, // Public homepage
"/dashboard": true, // Requires login
"/admin": true // Requires login
},
"routes_role": {
"/": ["*"], // Public
"/dashboard": ["*"], // Any authenticated user
"/admin": ["admin"] // Only admin
}
}
}
At application startup, the framework validates:
security.routes_role exists and is a dictionarysecurity.routes_auth exists and is a dictionary/)"*" is not mixed with explicit roles in the same entryAny validation error will prevent the application from starting (fail-closed design).
"/" in both policies as a fallback/admin, /api/private)localdev RoleThe localdev role is special and behaves differently from other roles:
localdev role should never be added to the database role tablesSessionDevlocaldev via create_user.py or admin panelscmp_8100_localdev// Valid use in manifest - allows access only through SessionDev
{
"routes_role": {
"/": ["localdev"]
}
}
Production deployments should not grant localdev access to general administration components.
These roles are stored in the database and can be assigned to users:
| Role | Typical Use |
|---|---|
admin |
Full system administration |
moderator |
Content moderation, user management (limited) |
editor |
Content creation and editing |
Check the logs for the deny reason:
route_not_mapped_in_auth_policy - Add route to routes_authroute_not_mapped_in_roles_policy - Add route to routes_roleauth_required - User needs to log inrole_not_allowed - User doesn’t have required roleIf you see errors at startup:
missing_routes_auth_policy
missing_routes_role_policy
Add the security block with both required policies to your manifest.json.