Anthropic API key
ID |
anthropic |
Severity |
high |
Vendor |
Anthropic |
Family |
API Key |
Description
Anthropic is an artificial intelligence research company and is known for developing the Claude AI assistant family, including Claude 3 models.
Anthropic REST API uses an API key for authentication.
Security
A leaked API key could have serious security and financial implications:
-
All conversations / queries made through the leaked key will be available for threat actors.
-
Potential sensitive data could be exposed if your API key was used for processing confidential or private information.
-
Unauthorized usage would be billed to your account, with significant charges due to high-volume calls.
Examples
The following is a leak of an Anthropic API key:
ANTHROPIC_API_KEY=sk-ant-api03-xyz...zxyAA
Mitigation / Fix
-
Follow your policy for handling leaked secrets, which typically require revoking the key. Go to [Anthropic Console > API Keys], click the … (meatball) icon at the right of the leaked key, and click "Delete API key". Create a new on by clicking on the "Create key" button, and take note of its value.
Do not disable an API key. Leaked keys should be immediately revoked. -
Remove the leaked Anthropic key from the source code or committed configuration file, and replace the usages of the leaked key with the new value. Environment variables, local files or secret vaults could be used for passing the key, instead of hardcoding the value, as documented in How to Prevent Hard-Coded Secrets.
-
Check access logs to ensure that the secret was not used by unintended actors during the compromised period.
-
Follow best practices recommended by Anthropic for securely handling API keys:
-
Never commit API keys to public repositories.
-
Use environment variables or secret managers to pass API keys in your code.
-
Monitor API usage for unusual patterns, like a spike in call rates.
-
Use separate keys for development and production.
-
Implement proper access controls and key rotation schemes.
-
You should consider any sensitive data in commits with secrets as compromised. Remember that secrets may be removed from history in your projects, but not in other users' cloned or forked repositories. |