Security checklist
Keep tokens safe: scopes, expiry, allowed addresses, and what to do after a leak.
3 min read Updated
A token can do what its scopes allow, from wherever it's used, until it expires. These habits keep a token that leaks from doing much, and help you notice when one does.
One token for each app
Give each app, script and CI job its own token, named after it. Then you can see what each one does, limit each to what it needs, and revoke one without stopping the others.
Only the access it needs
- The smallest set of scopes its calls need (see Scopes). Scopes that spend money or delete for good only where they're needed.
- Only its servers, when it works on some: everything on other servers stays out of its reach.
- Only its addresses, when it runs from fixed ones (a server, a CI runner with a fixed address): up to 20 addresses or ranges, and a request from anywhere else is refused.
- An expiry: the shorter, the less a forgotten token is worth to anyone who finds it.
Keep it out of code
- Keep tokens in environment variables, or your platform's secret store (CI secrets, a vault), and read them from there.
- Never in a repository, not even a private one, and never in code that runs in a browser or an app people download.
-
In WordPress, never in an option or a setting that other plugins can read: use a constant in
wp-config.phpor the server's environment. - Never in logs, error reports or support tickets: the request id is enough for us to find a request.
Rotate on a schedule
Regenerate long-lived tokens now and then. Choose a grace time (1 hour or 24 hours) and both values work while you roll the new one out; then the old one stops (see Regenerate a token).
If a token leaks
- Revoke it at once: in the panel, open API, then the token's menu, and choose Revoke. It stops working straight away.
- Turn off the webhook endpoints it added: Revoke lists those still on, with Also turn off these endpoints ticked, so leave it ticked. Then check each one's URL and events before you turn it on again, or delete it.
- Read what it did in the request log (below), from when it may have leaked.
- Change what it could reach: WordPress passwords if it had access to logins, and anything its requests changed. Then make a new token, kept better.
Read the request log
In the panel, API Activity shows the number of requests a day and lists the requests of the last 30 days that changed something, failed or returned a secret, filtered by token, method or failures. Tries with a token after it was revoked or expired are listed too, as failures: a leaked token still being tried shows there. Successful reads are counted but not listed, and a token's failures are listed up to 20 a minute. Look for requests you don't recognise, from tokens that should be quiet, or failures in a row. We email you whenever a token is made or regenerated, and when support revokes one.
Verify webhooks
Anyone can send a request to your webhook's URL. Check each delivery's signature with your endpoint's signing secret before acting on it, and keep the secret as safe as a token (see Verify signatures).
Operations that can't be undone
Marked Can't be undone in the reference: what they remove can't be brought back. Ask your user to confirm before your code calls them.
| Operation | Request |
|---|---|
| Revoke the token in use | DELETE / |
| Destroy a server | DELETE / |
| Delete a snapshot | DELETE / |
| Restore a server from a snapshot | POST / |
| Clear a server's logs | POST / |
| Delete a site | DELETE / |
| Remove a domain from a site | DELETE / |
| Turn off a server's security | POST / |
| Turn off Imunify360's WordPress plugin | POST / |
| Delete a cron job | DELETE / |
| Delete files and folders of a site | POST / |
| Turn a site's backups off | POST / |
| Restore a site from a backup | POST / |
| Delete a backup | DELETE / |
| Remove backup storage | DELETE / |
| Refresh the staging copy from the live site | POST / |
| Push the staging copy to the live site | POST / |
| Undo a push to the live site | POST / |
| Delete a restore point | DELETE / |
| Delete the staging copy | DELETE / |
| Delete a webhook endpoint | DELETE / |
Answers that hold secrets or personal data
Marked Holds secrets or personal data in the reference: the answer holds a password, a key or a sign-in link, or personal data such as a billing address. Show it to the person who asked, and don't log or store it. Each of these requests is in the request log, so you can see when one was made.
| Operation | Request |
|---|---|
| Get the connect command of your own server | GET / |
| Make a new connect command | POST / |
| Get the site's WordPress login | GET / |
| Reset the WordPress administrator's password | POST / |
| List a site's cron jobs | GET / |
| List a cron job's runs | GET / |
| Read a text file of a site | GET / |
| Download a file or folder of a site | GET / |
| Download a backup's files or database | GET / |
| Connect backup storage | POST / |
| Get the staging copy's password | GET / |
| Get Rabbitflare SMTP on a site | GET / |
| Turn on Rabbitflare SMTP for a site | POST / |
| Turn off Rabbitflare SMTP for a site | POST / |
| Turn Rabbitflare SMTP on again after a pause | POST / |
| Add a notice or reply address to a site's SMTP | POST / |
| Send an address's confirmation email again | POST / |
| Remove an address from a site's SMTP | DELETE / |
| Get an address of a site's SMTP | GET / |
| Add a webhook endpoint | POST / |
| Rotate an endpoint's signing secret | POST / |
Still have a question?
Our team answers support tickets about the API, and other developers answer in the community.