Writing authorization policies
ThirdEye talks to a separate authorization service to determine if a user can access a particular resource. The authorization service matches users and resources to authorization policies in order to make that determination. In most cases, ThirdEye resources can be organized into namespaces. Access control policies are applied to all resources in a particular namespace.
https://MY_ENV.MY_ORG.startree.cloud/auth/swagger-ui/index.html.
Authorization policies have 4 important fields:
policyType- This can be either ALLOW or DENY.namespaceSrn- The namespace that this policy applies to.priority- Policies are sorted in ascending order by priority. Smaller numbers take priority over higher numbers.rule- The rule to match resources and users for this policy. This is where most of the action happens.
Example policies:
StarTree resource names
The StarTree resource names (SRNs), are used to identify who may have access to what. The SRNs contain three relevant fields: resource type, namespace, and resource id. Field values are colon-separated and must match the regex^[a-z0-9-_]+$.
Example SRN for an Alert:
Namespaces
If a resource is not assigned to a namespace, then the namespace isdefault. You can set the resource’s namespace by adding "auth": {"namespace": "my-namespace"} to the resource’s configuration.
Anomalies are automatically assigned to the namespace of the alert or enumeration item that created it. Investigations are automatically assigned to the namespace of the anomaly it’s related to.
Example Alert:
SRN’s for ThirdEye resources
Policy matching
When ThirdEye checks authorization, 3 pieces of information are sent to the authorization service:- Resource SRN
- User SRN
- Action
Policy filtering
First, the auth service searches for all policies in the resource’s namespace and the default namespace. The policies are sorted by ascending priority. Policies in thedefault namespace are ordered first, followed by policies in the resource’s namespace.
For example, if the auth service is checking authorization for resource SRN srn:zone:thirdeye-alert:regional_analysts_uk:140, the policies are ordered like this:
Attribute context
Next, the auth service creates a context map of attributes used in the policy rules. The auth service maps theUser SRN to the attributes sent by the OIDC provider when the user logged
into StarTree cloud. The auth service puts the user attributes, all the fields of the user SRN and resource SRN, and the action into the context map.
Example context map:
Rule matching
Finally, the policy rules are executed within the context. The policy rules use a SQL-like syntax where the columns are the context fields and the values are the context values. The first matching policy is applied. Example rule matching the above context:Namespaces for ThirdEye resources
Most ThirdEye resources allow you to set the namespace in the resource’s configuration, but in some cases the namespace is inherited from a parent resource. Example alert:
In all cases:
- If there is no namespace, then the namespace is
default. - You can check the namespace of a resource by GETing the resource.

