Unrotated deploy keys
Rule Details
Cortex AppSec Rule ID
APPSEC_CICD_6
Category
IAM
Severity
LOW
Impact
Deploy keys associated with code repositories have not been rotated in over 180 days. The longer a deploy key remains active, the greater the potential for it to be compromised or leaked. An attacker who obtains a deploy key gains direct access to the repository's code. If the key is assigned 'write' permissions, the attacker can also edit the code.
Recommended Solution - Buildtime
To minimize the risk of a stolen deploy key being used by an attacker, it is recommended to rotate deploy keys within a maximum period of 180 days after creating the key.
Create a private key on the server that will consume the key.
Create a deploy key using the matching public key in the same repository the current key was created on.
Direct the server to use the new key.
Delete the old deploy key from the GitHub repository.
There are two options for creating and deploying keys:
Through the console: browse to the Deploy Keys tab under the repository Settings and select Add Deploy Key.
Through the API: refer to the GitHub API documentation: https://docs.github.com/en/rest/reference/repos#deploy-keys
Last updated
Was this helpful?
