Authorization
Authorization is used to limit access to Alerta API resources. The authorization model is based on Role-Based Access Control (RBAC) which assigns permissions to functional roles and then users are assigned to one or more of those roles.
This “role-based access” allows for fine-grained control over exactly what resources are accessible to which users and exactly what type of access is allowed – in a way that is scalable.
For example, to create a new alert the sender will need to be assigned to
at least one role with write:alerts
permissions. If the sender is not
a member of a role with those permisssions then the request will be rejected
with a 403 Forbidden
response code.
Flat RBAC
Alerta implements the “flat” RBAC model as defined by NIST (aka. “Core RBAC”) and as such does not support any form of role hierarchy where roles can inherit other roles.
Flat RBAC has the following features:
users acquire permissions through roles
must support many-to-many user-role assignment
must support many-to-many permission-role assignment
must support user-role assignment review
users can use permissions of multiple roles simultaneously
Note
All access is through roles. Permissions can not be assigned directly
to users. The only exception to this is the ADMIN_USERS
setting
which overrides all other roles a user might belong to.
Configuration
There are two ways to configure role-based access; default and custom configuration.
Default Authorization
If authentication is enabled then the default authorization is used which defines two roles:
user
role - everyone is a “user” unless listed in theADMIN_USERS
setting. (default scopes areread
andwrite
)admin
role - only admins can delete alerts and heartbeats, create users etc. (default scope is simplyadmin
, however that implicitly includesread
andwrite
)
Note
The user
and admin
roles are protected preventing them from being
deleted and preventing new roles from being created with the same names.
The scopes associated with the default user
role are managed using the
USER_DEFAULT_SCOPES
setting in the API server settings.
All other roles are managed via the web console or alerta
CLI.
Custom Authorization
To use custom authorization simply define one or more permission-scope lookups.
As an “admin” user go to Configuration -> Permissions and add a new role with the required scopes (see below for list of valid scopes). Those roles should match the roles, groups or organisations associated with users for the configured Authentication provider.
Tip
It is encouraged to employ the principle of least privilege when creating roles. That is, do not give to a user any more privilege than is necessary to perform their job function.
Scopes and Permissions
Use these scopes to request access to API resources.
Scope |
Permissions |
---|---|
|
Grants read-only access to all scopes. |
|
Grants read/write access to all scopes. |
|
Grants admin, read, write and delete access to all scopes. |
|
Read-only access to alerts. |
|
Grants read/write access to alerts. |
|
Required to delete alerts, unless have admin access. |
|
Grants read/write to alerts for any customer. |
|
Grants read-only access to blackouts. |
|
Grants read/write access to blackouts. |
|
Grants read/write access to blackouts for any customer. |
|
Read-only access to heartbeats. |
|
Grants read/write access to heartbeats. |
|
Grants read/write access to heartbeats for any customer. |
|
Grant write access to users. |
|
Fully manage users. |
|
Grants read-only access to permissions and scopes. |
|
Grants read, write and delete access to permissions. |
|
Grants read-only access to customers. |
|
Fully manage customers. |
|
List and view API keys. |
|
Create, list and view API keys. |
|
Fully manage API keys for any customer. |
|
Grants write access to webhooks. |
|
Grants read-only to oembed endpoints. |
|
Grants read-only access to management endpoints. |
|
Fully manage management endpoints. |
|
Grants read-only access to userinfo. |
Note
write
implicitly includes read
, and admin
implicitly
includes read
and write
.
delete:alerts
only required to delete alerts if the DELETE_SCOPES setting is enabled.