# Security in Monitoring

Who may read metrics and logs and manage alarms, checks and status pages (IAM), what is audited, and what leaves the platform.

## IAM actions

Every request, through the API, the CLI, Terraform or the console, is checked against your IAM
policies. Monitoring's resource names have no region:

| Resource      | Resource name                                                | Actions checked on it                                                                                   |
| ------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| An alarm      | `rn:ews::<organization id>:monitoring:alarm/<alarm id>`      | Reading, changing and deleting one alarm, and its history                                               |
| A check       | `rn:ews::<organization id>:monitoring:check/<check id>`      | Reading, changing, pausing, resuming and deleting one check, and its results and outages                |
| A status page | `rn:ews::<organization id>:monitoring:status-page/<page id>` | Reading, changing and deleting one page, its components, its incidents and its subscribers              |
| The service   | `rn:ews::<organization id>:monitoring:*`                     | Every metric and log read, publishing custom metrics, every list, and creating alarms, checks and pages |

(The table of IAM actions is generated on the web page.)
- Metric and log reads cover every resource of the organization; a policy cannot grant the metrics
  or logs of one machine or one app.
- A policy that grants `monitoring:DescribeAlarms` on one alarm lets its holder read that alarm,
  but not list alarms: the list needs the action on `rn:ews::<organization id>:monitoring:*`. The
  same holds for checks and status pages.
- Incidents and subscribers are checked on their page, so someone on call can post incidents on one
  page and change nothing else.
- Reading one alarm, check or status page you may not read answers `404`, the same as one that does
  not exist. A refused write answers `403`.
- StatsD from an app's machine is published with the app's own credentials, not with
  `monitoring:PutMetricData`.

A policy for someone who may post and update incidents on one status page (replace _org-id_ and
_page-id_):

```json
{
  "Version": "2024-01-01",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "monitoring:DescribeStatusPages",
        "monitoring:CreateIncident",
        "monitoring:UpdateIncident"
      ],
      "Resource": "rn:ews::org-id:monitoring:status-page/page-id"
    }
  ]
}
```

With it alone, the console's **Status pages** list shows an access-denied notice; the page itself
opens at its own console address. To use the list, also grant `monitoring:DescribeStatusPages` on
`rn:ews::org-id:monitoring:*`, which lets them see every page of the organization.

## Audit

Creating, changing and deleting alarms, checks, status pages, components, incidents and subscribers,
and pausing and resuming checks, are recorded in the audit log, allowed or denied, once the request
has passed its validation: a request with a malformed body or an id that is not a UUID is refused
before the permission check and not recorded. Publishing custom metrics is recorded only when it is
denied. A refused list, metric read or log search (`403`) is recorded at most once a minute per user
and action; a refused read of one alarm, check or status page answers `404` and is not recorded.
Allowed reads are not recorded. See [Audit log](/docs/audit-log).

## What leaves the platform

- Alarm and check notifications are mailed to the addresses you enter, and posted to your webhooks
  over https, to public addresses only. Nothing confirms an alarm's or a check's addresses before
  they are mailed.
- Uptime checks request your URLs from the control plane and the probe locations, and only public
  addresses.
- A status page, its incidents and its `summary.json` are public, without sign-in. Subscriber
  addresses are not shown on it; the subscribe form answers the same whether or not an address was
  already subscribed.

## Related

- [Notification webhooks](notification-webhooks.md)
- [Monitoring alarms and checks](monitoring.md)
