whiteweb.security / guides / CI/CD credentials exposed
.travis.yml / Jenkinsfile / config.yml High severity ~7 min read

My CI/CD configuration file got exposed. What should I do?

CI/CD pipeline configuration files sometimes contain credentials that should have been stored as encrypted environment variables — AWS keys pasted inline, deploy tokens hardcoded in script steps, or Docker registry passwords in plaintext. If one of these files was publicly accessible, every hardcoded credential needs to be revoked immediately.

Check whether the credentials ever made it into git history — that's often worse than the file exposure.

If a CI/CD config file with hardcoded credentials was committed to a repository, the credentials exist in git history even after the file is corrected. Removing the value from the current file doesn't remove it from git log. Rotate first, then clean history.

// the 60-second version

  • Revoke every token, key, and deploy credential visible in the config file.
  • Remove hardcoded credentials from the config file and replace with encrypted environment variables.
  • Review pipeline run logs for signs of credential misuse within your own pipeline.
  • Audit deployed environments for any backdoors or unexpected changes.

01Identify what was exposed

CI/CD config files vary by platform, but the types of credentials found in them are consistent. Work through the exposed file and catalogue everything sensitive:

  • Deploy keys and SSH private keys — used to push deployments to servers. If present as inline values (e.g., echo "$DEPLOY_KEY" > ~/.ssh/id_rsa where DEPLOY_KEY was set to the literal key value), they're exposed.
  • Cloud provider credentials — AWS AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY, GCP service account keys, Azure service principal credentials set inline rather than as platform secrets.
  • API tokens — package registry tokens (npm, PyPI, Maven), Docker Hub credentials, Slack or PagerDuty notification tokens.
  • Docker registry passwords — credentials for logging in to push built images: docker login -u user -p password registry.example.com.
  • Encrypted Travis CI values — if you see secure: … entries in .travis.yml, those are Travis-encrypted and safe. Plain values are not.

If the file is in a public git repository, the credentials have been exposed since the commit was pushed — not just since you noticed the problem. GitHub's secret scanning may have already flagged it. Check your GitHub Security tab and your cloud provider's usage logs for that entire time window.

02Revoke all exposed tokens in the CI/CD platform and providers

Go to each relevant service and revoke the exposed credential. Here are the paths for common providers:

  • Travis CI — Settings > Environment Variables > delete the exposed variable and recreate it with a new value. Also check Settings > SSH Key if a deploy key was configured there.
  • CircleCI — Project Settings > Environment Variables > delete and recreate. For SSH keys: Project Settings > SSH Keys > remove the old key.
  • GitHub Actions — Repository Settings > Secrets and variables > Actions > delete and recreate the affected secrets.
  • Jenkins — Manage Jenkins > Credentials > find and delete the exposed credential, then create a replacement.

Also revoke directly at the service that issued the credential: deactivate the AWS IAM key, regenerate the Docker Hub access token, revoke the npm publish token, and so on.

03Remove credentials from config files and use encrypted env vars

Every CI/CD platform provides a way to store secrets that are available to pipeline jobs but never visible in the config file. Replace any hardcoded value with a reference to the platform-stored secret:

GitHub Actions — correct use of secrets.github/workflows/deploy.yml
jobs:
  deploy:
    steps:
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: eu-west-1
Travis CI — correct use of encrypted secrets.travis.yml
# Store secrets using: travis encrypt MY_VAR=secret --add env: global: - secure: <travis-encrypted-value> # Never: MY_VAR=plaintext_secret

For maximum security, prefer OIDC federation over static credentials: GitHub Actions can authenticate to AWS and GCP using a temporary token tied to the specific workflow run, with no static secret ever stored.

04Review pipeline logs for credential misuse

Your own CI/CD pipeline may have been the first place the credentials were used inappropriately — if a pull request from a fork triggered a build, the credentials could have been exfiltrated via a malicious build step. Check recent pipeline runs:

  • Travis CI — by default, encrypted environment variables are not available to pull request builds from forks. Verify your settings.
  • GitHub Actionssecrets are not passed to pull request workflows from forks by default, but pull_request_target events are an exception — check your workflow triggers.
  • Look for pipeline runs that included unexpected network calls, file exfiltration (curl or wget to external IPs), or credential printing (accidental echo $SECRET in logs).

05Audit deployed environments for backdoors

If deploy keys or cloud credentials were exposed, an attacker may have used them to push to your production environment. Review what was deployed during the exposure window:

check recent git pushes to production branchbash
# review commits pushed in the last N days git log --oneline --since="7 days ago" origin/main # check for unexpected commits or authors git log --format="%H %an %ae %s" origin/main | head -20

Also check your cloud environment for new resources created during the exposure window (new EC2 instances, IAM users, S3 buckets). Review your container registry for any images pushed that you didn't build, and check your deployed servers for new cron jobs, user accounts, or modified files.

CI/CD credentials often have write access to production — making them especially high-value targets. If there's any evidence of unauthorised pipeline runs or deployments, treat the affected environment as potentially compromised and conduct a full incident review.

Was this guide useful?

These playbooks are free to read and share. If a heads-up ever saved you a bad week, you can say thanks — or jump into the other guides.