NuGet API Key

ID

nuget_key

Severity

high

Vendor

NuGet

Family

API Token

Description

NuGet is a package manager designed to enable developers to share reusable code. It is a software as a service solution whose client app is free and open-source.

Security

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

Accidentally checking-in the key to source control repositories could compromise the NuGet account and data.

Examples

jobs:
  build:
    uses: company/actions/.github/workflows/dotnet-publish.yml@main

  release-nuget:
    needs: build
    uses: company/actions/.github/workflows/nuget.yml@main
    secrets:
      noncompliant.NUGET_TOKEN: oy2gBm8AZx1VzQrstF8tHe2OYxQJprk36w5YxQJprk36w5

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 Api Keys, find the specific key 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.