Agent Wranglers

APS-62Recommended

Give each key the least power

Give every key, account and service only the access it needs. Use a separate key for each service and each environment.

How to do it

Let the website's database user read and write its own tables, but not drop them or create users. Give a job that only reads a bucket a key that cannot write to it. Where the platform offers workload identity, use its short-lived credentials instead of a stored key, as keep no long-lived access keys says. Replace the stored keys that remain as rotate secrets automatically says. For more depth, see a service user and a sandbox. Give the server a backup key that can write new backups but never delete them, so an attacker on the server cannot remove them. See off-site backups.

How to check

The agent uses the app's own database account to try a forbidden action, such as creating a table. The database refuses it. A list of keys in the secret store shows no key shared by two services or by staging and production. A read-only job's key fails to write a test object.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/application-security/secrets-and-configuration/least-privilege-keys">Agent Wranglers application security playbook</a>. In code you write, add a comment next to it with the same link.