How to fix: IBM Cloud IAM API key in source
IBM IAM API keys (32+ char strings) grant access to the entire IBM Cloud account - Kubernetes, databases, Object Storage.
Why it matters
An exposed IBM Cloud IAM API key grants programmatic access to your IBM Cloud account at the IAM policy level of the key owner, potentially including Kubernetes clusters, databases, object storage, and Watson AI services.
IBM IAM API keys (32+ char strings) grant access to the entire IBM Cloud account - Kubernetes, databases, Object Storage.
How to fix it
- 1Delete the key immediately: ibmcloud iam api-key-delete KEY_NAME
- 2Create a service ID with minimum required policies and a new API key scoped to it
- 3Store the new key in IBM Secrets Manager, not in environment variables
Code examples
Rotate IBM Cloud IAM key
# Log in and delete the compromised key
ibmcloud login --apikey $COMPROMISED_KEY
ibmcloud iam api-key-delete COMPROMISED_KEY_NAME --force
# Create a new key with a service ID instead of a user key
ibmcloud iam service-id-create my-service --description 'Limited access service'
ibmcloud iam service-policy-create my-service \
--roles Reader --service-name cloud-object-storage
ibmcloud iam service-api-key-create my-key my-serviceReferences
Detected automatically by VulnRadar. The check id is secret-ibm-cloud-iam-key, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is IBM Cloud IAM API key in source?
- VulnRadar rates this critical severity in the secrets category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id secret-ibm-cloud-iam-key, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does IBM Cloud IAM API key in source map to?
- It maps to CWE-798. In the OWASP Top 10 it falls under A07:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.