Crates.io Key

ID

crates_key

Severity

critical

Vendor

Crates.io

Family

API Token

Description

This detector catches the used by the crate command. At the time of writing there is no documented API that uses the key. An API key allows to create new crates, push updates or delete them through the crate command.

Security

Any hardcoded Crates.io Key is a potential secret reported by this detector.

Accidentally checking-in the key to source control repositories could compromise your packages at Crates.io.

Examples

[registry]
token = "cio5lw93Ke0u5qilNYU5DI1ot5MPjV5keUk"

Mitigation / Fix

  1. Remove the Key from the source code or committed configuration file.

  2. Follow your policy for handling leaked secrets, which typically require revoking the secret in the target system(s). Go to Tokens, find the specific token and revoke it.

  3. If under a git repository, you may remove unwanted files from the repository history using tools like git filter-repo or BFG Repo-Cleaner. You may follow the procedure listed here for GitHub.

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.