An Infracost API token links the Infracost command-line tool and its service to your organization. It lets whoever holds it run cost estimates against your infrastructure definitions and read the cost data the service stores for your projects. It does not grant access to your cloud accounts, so it cannot start or stop resources. The risk is narrower than a cloud key, but cost and pricing data can still reveal your architecture, your usage patterns and your spend, and a token can be used to fill your account with requests.
Check your GitHub account for leaked secrets — free
- Provider
- Infracost
- Severity
- High
- Impact
- SaaS account access and billing
- Checked live by LeakWatch
- No
What an Infracost API Token looks like
Infracost API tokens start with ico-, followed by 32 letters and digits. The whole token is a single string with no spaces:
ico-… Infracost API token (masked)
The prefix is distinctive, so the value can be found without any surrounding context. Developers usually meet it in one of two places: a configuration file written by the command-line login, or an environment variable used by a CI job. The token is stored on the machine after login, which means a copied home directory or a shared build image can carry it to places you did not intend.
How Infracost API Tokens get leaked
- Developer configuration. The token stored after the command-line login, copied in a dotfiles repository or a backup.
- CI and build configuration. A pipeline file that sets the token as a plain value rather than a secret reference.
- Docker images. A build that copies the configuration directory into an image that is later pushed to a public registry.
- Shared scripts. A cost-estimate script sent to a colleague or posted in an issue with the token left in.
- Logs. A CI job that prints its environment variables while debugging a failed cost check.
What to do in the first hour
- Revoke the token. Open the account settings for your Infracost organization and revoke the API key that leaked. Do this before you update any code.
- Create a new key for the CI job or developer who needs it. Store the value in your CI secret store, and log in again on developer machines that used the old one.
- Check the usage. Look at the recent runs in the Infracost dashboard for the organization. Unexpected runs at unusual hours, or from unknown projects, are the signs to watch.
- Review projects. Check that no project was added or changed without your knowledge, and remove any you do not recognize.
- Look at the rest of the environment. A CI job that held the token probably held cloud credentials too. Review those and rotate any that sat beside it. See I accidentally pushed an API key to GitHub for the order of steps.
- Clean the repository. Remove the token from the configuration files, and make sure local configuration directories are excluded from version control and image builds.
Not sure what else leaked? Run a free scan.
Revoke it at Infracost
API keys are shown in the account settings of your Infracost organization. Open account settings, find the key that leaked, and revoke it. Then create the replacement and log in again wherever the old key was stored. We have not confirmed the exact menu wording or where the key is listed for each organization type, so follow the labels on the page you are shown, and check that you are in the correct organization.
How LeakWatch detects it
The rule is called Infracost API Token. It looks for the ico- prefix followed by exactly 32 letters and digits, with a word boundary or a line break after it. Shorter or longer values, and values without that prefix, are not reported. The severity is high, with the impact class for SaaS tools. This type is not checked live: LeakWatch does not send a request to Infracost with the value it found.
LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.
FAQ
Can the token be used to change my cloud resources?
Not directly. Infracost estimates costs from configuration files and reads its own stored data. The risk is that an attacker can see your architecture and usage, and can run requests against your account.
Is it enough to log out on my laptop?
No. Logging out on one machine does not revoke the key. Revoke the key in the account settings, which stops it working everywhere.
Should I use one key for the whole team?
Better to use one key per CI job or per person. Then a leak affects one place, and the audit trail shows who did what.