# Security in Domains & certificates

Who may add, verify, use and delete a domain (IAM), what is recorded in the audit log, and who may hold a name.

## IAM actions

A domain's resource name has no region and carries the domain's name:
`rn:ews::<organization id>:domains:domain/<name>`, so a policy can say
`domain/*.example.com`. Listing domains is checked against `rn:ews::<organization id>:domains:*`.

(The table of IAM actions is generated on the web page.)
- Serving a name of a domain on an endpoint needs `domains:UseDomain` on the domain **and** the
  endpoint's own permission. A person who may change a function but not use the domain cannot put
  the domain on it.
- **Verify now** needs `domains:VerifyDomain`; it also retries a failed certificate.

## Audit

Every add, verify, use and delete, allowed or refused, is recorded in the audit log with the
domain's resource name.

## Who may hold a name

Only a verified domain holds a name, and only for one organization: no other organization can
verify the same name, a name under it or a name above it. An organization may add a name another
one has verified, but it stays **Waiting for proof**. A domain that is added and never proven holds
nothing.

## Cookies under a shared domain

Every name under a domain belongs to the same site in a browser: a page served at one name can set
a cookie for the whole domain, and the browser sends cookies set for the domain to every name under
it. Serve code you do not trust under a registrable domain of its own, or have that domain listed
on the Public Suffix List, so each name under it is its own site.
