<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: maxxthemate-png</title>
    <description>The latest articles on DEV Community by maxxthemate-png (@maxxthematepng).</description>
    <link>https://dev.to/maxxthematepng</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4119613%2F9694e61d-3436-4acc-b538-2a24b8961980.png</url>
      <title>DEV Community: maxxthemate-png</title>
      <link>https://dev.to/maxxthematepng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maxxthematepng"/>
    <language>en</language>
    <item>
      <title>Docker Images Are Leaking Your Secrets: How to Find and Fix Embedded Credentials</title>
      <dc:creator>maxxthemate-png</dc:creator>
      <pubDate>Tue, 27 Oct 2026 14:12:58 +0000</pubDate>
      <link>https://dev.to/maxxthematepng/docker-images-are-leaking-your-secrets-how-to-find-and-fix-embedded-credentials-3nn9</link>
      <guid>https://dev.to/maxxthematepng/docker-images-are-leaking-your-secrets-how-to-find-and-fix-embedded-credentials-3nn9</guid>
      <description>&lt;h2&gt;
  
  
  The Docker Layer Problem Nobody Talks About in Stand-Up
&lt;/h2&gt;

&lt;p&gt;Your Git history gets a lot of attention when teams think about leaked secrets. Your &lt;code&gt;.env&lt;/code&gt; files get a mention in onboarding docs. But Docker images? They quietly accumulate secrets across build layers, get pushed to registries, and sit there, sometimes publicly, while everyone assumes the container runtime is an abstraction layer that protects them.&lt;/p&gt;

&lt;p&gt;It doesn't. This article walks through exactly how secrets end up in Docker images, how to inspect your own images for embedded credentials right now, and the build patterns that prevent this class of leak entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Secrets Get Baked Into Image Layers
&lt;/h2&gt;

&lt;p&gt;Docker images are built from a stack of read-only layers, one per instruction in your &lt;code&gt;Dockerfile&lt;/code&gt;. Each layer is a snapshot of the filesystem at that point. The critical thing to understand: &lt;strong&gt;deleting a file in a later layer does not remove it from an earlier layer.&lt;/strong&gt; Anyone with access to the image can read every layer independently.&lt;/p&gt;

&lt;p&gt;Here are the three most common ways secrets end up embedded:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. ENV and ARG Instructions
&lt;/h3&gt;

&lt;p&gt;Passing secrets as build arguments or environment variables is tempting because it feels like "not hardcoding" them. It isn't safe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Dangerous, ARG value is visible in image metadata&lt;/span&gt;
&lt;span class="k"&gt;ARG&lt;/span&gt;&lt;span class="s"&gt; DATABASE_URL&lt;/span&gt;
&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; DATABASE_URL=${DATABASE_URL}&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;./migrate.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even if you never set &lt;code&gt;ENV&lt;/code&gt;, the value passed to &lt;code&gt;ARG&lt;/code&gt; during &lt;code&gt;docker build --build-arg&lt;/code&gt; is recorded in the image's build history, visible via &lt;code&gt;docker history --no-trunc&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. COPY or ADD of Secret-Containing Files
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Copies .env into the image, including all secrets inside it&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; .env /app/.env&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;node scripts/seed.js
&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; /app/.env   &lt;span class="c"&gt;# ← does NOT remove it from the layer above&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;rm&lt;/code&gt; on the last line creates a new layer that hides the file from the running container's filesystem, but the layer containing &lt;code&gt;.env&lt;/code&gt; still exists in the image and is readable by anyone who pulls it.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. RUN Commands That Touch Credentials
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# The token appears in build history&lt;/span&gt;
RUN curl &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer ghp_XXXXXXXXXXXX"&lt;/span&gt; https://internal.api/setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;docker history --no-trunc&lt;/code&gt; will show every &lt;code&gt;RUN&lt;/code&gt; command verbatim. Tokens passed inline to &lt;code&gt;curl&lt;/code&gt;, &lt;code&gt;pip install --extra-index-url&lt;/code&gt;, or &lt;code&gt;npm config set&lt;/code&gt; are all captured.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Inspect Your Images Right Now
&lt;/h2&gt;

&lt;p&gt;You don't need a special tool to start. Run these commands against any image you own:&lt;/p&gt;

&lt;h3&gt;
  
  
  Check Build History
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;history&lt;/span&gt; &lt;span class="nt"&gt;--no-trunc&lt;/span&gt; :
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scan the output for tokens, passwords, URLs with embedded credentials, or &lt;code&gt;ARG&lt;/code&gt;/&lt;code&gt;ENV&lt;/code&gt; assignments that contain secret-looking strings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inspect Layer Metadata
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker inspect :
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at the &lt;code&gt;Env&lt;/code&gt; array in the output. Any environment variable set with &lt;code&gt;ENV&lt;/code&gt; in the Dockerfile, including those derived from &lt;code&gt;ARG&lt;/code&gt;, will appear here in plaintext.&lt;/p&gt;

&lt;h3&gt;
  
  
  Walk the Filesystem of Each Layer
&lt;/h3&gt;

&lt;p&gt;Tools like &lt;strong&gt;Dive&lt;/strong&gt; (open source) let you step through each layer interactively and inspect what files exist, even files "deleted" in later layers. This is the clearest way to see if a secrets file was ever &lt;code&gt;COPY&lt;/code&gt;ed in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dive :
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Automated Scanning at the Registry Level
&lt;/h3&gt;

&lt;p&gt;Manual inspection doesn't scale. For any team pushing more than a handful of images, scanning the source repo and build pipeline for secrets before they ever reach a Dockerfile is the right layer of defense. To catch what's already out there, &lt;a href="https://ghostcred.io/scan?source=blog_docker-images-leaking-secrets-embedded-credentials" rel="noopener noreferrer"&gt;run a free GhostCred scan&lt;/a&gt; across your repositories and surface exposed credentials that may be feeding your container builds.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Right Patterns: Build-Time Secrets Without Embedding Them
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Use Docker BuildKit Secret Mounts
&lt;/h3&gt;

&lt;p&gt;BuildKit (enabled by default in Docker 23+) supports &lt;code&gt;--mount=type=secret&lt;/code&gt;, which makes a secret available to a single &lt;code&gt;RUN&lt;/code&gt; step as an in-memory tmpfs mount. It is never written to any layer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# syntax=docker/dockerfile:1&lt;/span&gt;

&lt;span class="c"&gt;# Build with:&lt;/span&gt;
&lt;span class="c"&gt;# DOCKER_BUILDKIT=1 docker build --secret id=npmrc,src=$HOME/.npmrc .&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nt"&gt;--mount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;secret,id&lt;span class="o"&gt;=&lt;/span&gt;npmrc,target&lt;span class="o"&gt;=&lt;/span&gt;/root/.npmrc &lt;span class="se"&gt;\
&lt;/span&gt;    npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;.npmrc&lt;/code&gt; file (containing your npm auth token) is available only during that &lt;code&gt;RUN&lt;/code&gt; step and leaves no trace in the image.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multi-Stage Builds to Isolate Secret Usage
&lt;/h3&gt;

&lt;p&gt;Keep any stage that touches credentials separate, and copy only the artifacts, not the secrets, into the final image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:20&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;builder&lt;/span&gt;
&lt;span class="c"&gt;# secrets used here for private package installs&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nt"&gt;--mount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;secret,id&lt;span class="o"&gt;=&lt;/span&gt;npmrc,target&lt;span class="o"&gt;=&lt;/span&gt;/root/.npmrc npm ci

&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:20-slim&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;runtime&lt;/span&gt;
&lt;span class="c"&gt;# only the compiled output moves forward, no credentials&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=builder /app/dist /app/dist&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Never Use ENV for Secrets That Need to Reach Production
&lt;/h3&gt;

&lt;p&gt;Runtime secrets, database passwords, API keys, service tokens, should be injected at &lt;em&gt;runtime&lt;/em&gt; by your orchestrator (Kubernetes Secrets, AWS Secrets Manager, HashiCorp Vault), not baked into the image as &lt;code&gt;ENV&lt;/code&gt; values. The image itself should be credential-free and safe to store in any registry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hardening Your Registry
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audit public vs. private visibility.&lt;/strong&gt; Check every repository in Docker Hub, ECR, GCR, or GHCR. A surprising number of teams accidentally publish images as public during initial setup and never change it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enable image scanning in your registry.&lt;/strong&gt; ECR, GCR, and Docker Hub all offer built-in vulnerability scanning; some also flag secrets. Use it as a backstop, not a primary control.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rotate any credential that ever appeared in an image.&lt;/strong&gt; If inspection reveals a secret was baked into a layer, even a layer that was later "deleted", treat it as compromised. Rotate immediately. The image may already have been pulled by a CI system, a developer's laptop, or a bad actor.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tag and track your base images.&lt;/strong&gt; Using &lt;code&gt;node:latest&lt;/code&gt; makes it hard to audit what changed between builds. Pin to a digest (&lt;code&gt;node:20-slim@sha256:...&lt;/code&gt;) for reproducible, auditable images.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Quick Pre-Push Checklist
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;docker history --no-trunc&lt;/code&gt; and grep for common secret patterns (&lt;code&gt;key&lt;/code&gt;, &lt;code&gt;token&lt;/code&gt;, &lt;code&gt;password&lt;/code&gt;, &lt;code&gt;secret&lt;/code&gt;, &lt;code&gt;Bearer&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;docker inspect&lt;/code&gt; and review the &lt;code&gt;Env&lt;/code&gt; array for plaintext secrets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Confirm no &lt;code&gt;.env&lt;/code&gt;, &lt;code&gt;*.pem&lt;/code&gt;, &lt;code&gt;credentials&lt;/code&gt;, or config files containing secrets appear in any layer via Dive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify your CI pipeline uses BuildKit secret mounts or equivalent for any build-time credential access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Confirm the registry repository visibility is set to private unless you have an explicit reason for it to be public.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Container images are artifacts that travel far, CI pipelines, developer laptops, staging environments, production clusters, and sometimes public registries. Every secret baked into a layer travels with the image, indefinitely, to every destination it reaches. The fix isn't complicated, but it requires deliberate build hygiene: use BuildKit secret mounts for build-time credentials, inject runtime secrets via your orchestrator, and audit what's already out there before assuming you're clean.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://ghostcred.io/blog/docker-images-leaking-secrets-embedded-credentials" rel="noopener noreferrer"&gt;ghostcred.io&lt;/a&gt;. GhostCred scans repos and cloud configs for exposed credentials and maps each finding to SOC 2, HIPAA, NYDFS and CMMC. First scan is free.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>dockersecretsleak</category>
      <category>dockerbuildargsecret</category>
    </item>
    <item>
      <title>Third-Party Integrations Are Your Biggest Secret Leakage Blind Spot</title>
      <dc:creator>maxxthemate-png</dc:creator>
      <pubDate>Tue, 20 Oct 2026 14:11:20 +0000</pubDate>
      <link>https://dev.to/maxxthematepng/third-party-integrations-are-your-biggest-secret-leakage-blind-spot-559a</link>
      <guid>https://dev.to/maxxthematepng/third-party-integrations-are-your-biggest-secret-leakage-blind-spot-559a</guid>
      <description>&lt;h2&gt;
  
  
  The Attack Surface You're Probably Not Auditing
&lt;/h2&gt;

&lt;p&gt;Most engineering teams now have some posture around their own repositories: &lt;code&gt;.gitignore&lt;/code&gt; rules for &lt;code&gt;.env&lt;/code&gt; files, maybe a pre-commit hook, perhaps a secret scanner wired into CI. That's progress. But there's a wider, murkier surface that rarely gets the same scrutiny: &lt;strong&gt;every third-party integration that has ever touched a live credential&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Think about the integrations active in a typical mid-size engineering org right now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A CI/CD platform (GitHub Actions, CircleCI, GitLab CI, Jenkins) with dozens of stored environment variables&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A deployment tool or PaaS (Heroku, Render, Railway, Fly.io) with production secrets injected at build time&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slack bots and workflow automations that call internal or external APIs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitoring and observability tools (Datadog, New Relic, Sentry) configured with ingest keys&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IaC pipelines (Terraform Cloud, Pulumi Cloud) with cloud-provider credentials scoped to provision infrastructure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Low-code or no-code platforms (Zapier, Make, n8n) wired to your CRM, database, or payment provider&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these is a &lt;em&gt;credential store you don't own&lt;/em&gt;. When any one of them suffers a breach, misconfiguration, or insider incident, the secrets you handed them are in scope, and your security team may be the last to know.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Secrets Actually Go When You "Configure" an Integration
&lt;/h2&gt;

&lt;p&gt;It's worth being precise about what happens technically when you paste an API key into a third-party service's settings panel.&lt;/p&gt;

&lt;h3&gt;
  
  
  Environment variables in CI/CD
&lt;/h3&gt;

&lt;p&gt;Platforms like GitHub Actions and CircleCI store secrets in an encrypted vault managed by the vendor. They're decrypted at runtime and injected into the build environment. This is generally safe, until a workflow is misconfigured to print environment variables to logs (&lt;code&gt;env&lt;/code&gt;, &lt;code&gt;printenv&lt;/code&gt;, or a verbose flag in a CLI tool), or until a malicious third-party Action or Orb is granted access to the secrets context.&lt;/p&gt;

&lt;p&gt;A subtle but common mistake in GitHub Actions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy&lt;/span&gt;
  &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;echo "Deploying with key $API_KEY"   # ❌ leaks to public logs on public repos&lt;/span&gt;
    &lt;span class="s"&gt;./deploy.sh&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace that with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy&lt;/span&gt;
  &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;API_KEY&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.API_KEY }}&lt;/span&gt;
  &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./deploy.sh&lt;/span&gt;   &lt;span class="c1"&gt;# ✅ key never echoed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  OAuth tokens granted to connected apps
&lt;/h3&gt;

&lt;p&gt;When you authorize a SaaS tool to access your GitHub org, AWS account, or Google Workspace, you're issuing a long-lived OAuth token or cross-account role. These are often granted with broader scopes than actually needed ("just use admin to be safe") and are rarely reviewed or revoked after the project they were created for ends.&lt;/p&gt;

&lt;h3&gt;
  
  
  Secrets baked into Terraform state
&lt;/h3&gt;

&lt;p&gt;Terraform state files are notorious for containing plaintext secrets. If a &lt;code&gt;random_password&lt;/code&gt; resource or a provider credential ends up in &lt;code&gt;terraform.tfstate&lt;/code&gt;, and that state is stored in an S3 bucket without strict access controls, or worse, committed to a repo, you have a silent exposure that may have existed for years.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Audit Process for Third-Party Credential Exposure
&lt;/h2&gt;

&lt;p&gt;You don't need a dedicated tool to start. A structured manual review covers most of the high-risk surface.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inventory every integration.&lt;/strong&gt; Pull the list of authorized OAuth apps from GitHub (&lt;em&gt;Settings → Integrations → Applications&lt;/em&gt;), your cloud provider's IAM console, and your identity provider. Most teams find 20 to 50% more integrations than they expected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Map credentials to integrations.&lt;/strong&gt; For each integration, identify: what credential does it hold? What scope/permission does that credential carry? When was it last rotated?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check CI/CD log history for accidental echoes.&lt;/strong&gt; Search your pipeline logs for patterns like &lt;code&gt;sk-&lt;/code&gt;, &lt;code&gt;AKIA&lt;/code&gt;, &lt;code&gt;ghp_&lt;/code&gt;, &lt;code&gt;xoxb-&lt;/code&gt; (Slack bot token prefix), or any 32 to 64 character hex/base64 strings appearing in plain text.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audit Terraform state storage.&lt;/strong&gt; Confirm state backends require authentication, are not publicly accessible, and ideally use server-side encryption. Run &lt;code&gt;grep -r "password\|secret\|token" *.tfstate&lt;/code&gt; locally if you have access to state files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Review scope and apply least privilege.&lt;/strong&gt; A Datadog integration doesn't need write access to your AWS account. A Slack webhook doesn't need access to your production database. Downscope aggressively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Revoke credentials for inactive integrations.&lt;/strong&gt; If a tool hasn't been used in 90 days, revoke its credentials. Reissue fresh, scoped ones if you need to reconnect.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Problem With "Set and Forget" Vendor Keys
&lt;/h2&gt;

&lt;p&gt;One of the most underappreciated risks is credential longevity in third-party systems. A key entered into a SaaS dashboard two years ago, by an engineer who has since left the company, for a feature that was eventually deprecated, may still be valid and sitting in that vendor's encrypted-at-rest store.&lt;/p&gt;

&lt;p&gt;This matters for two reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Vendor breach exposure:&lt;/strong&gt; If that SaaS provider is compromised, attackers may be able to decrypt or extract stored credentials. Your organization's blast radius is proportional to how many live, high-privilege keys you've distributed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Offboarding gaps:&lt;/strong&gt; When an engineer leaves, their personal API tokens, used informally to wire up integrations, aren't automatically revoked. Proper offboarding checklists need a "revoke all personal tokens and re-key integrations" step.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Good Looks Like: A Minimal Secure Integration Baseline
&lt;/h2&gt;

&lt;p&gt;You don't need a perfect secrets management platform on day one. This baseline is achievable for most teams within a sprint:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use service accounts, not personal tokens,&lt;/strong&gt; for all integrations. Service account credentials are tied to the role, not a person, and survive offboarding.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Set expiration dates on all credentials&lt;/strong&gt; you issue to third parties. Most cloud providers and API platforms support token TTLs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prefer OIDC / workload identity federation&lt;/strong&gt; over static keys for CI/CD. GitHub Actions, for example, can authenticate to AWS, GCP, and Azure without storing any long-lived credentials at all, using short-lived OIDC tokens instead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Log and alert on credential usage.&lt;/strong&gt; AWS CloudTrail, GCP Audit Logs, and GitHub's audit log all let you detect if a key is used from an unexpected IP or at an unexpected time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Run automated secret scanning&lt;/strong&gt; across your repos and pipeline configurations on a schedule, not just at commit time. Secrets committed months ago and since "deleted" from the working tree may still exist in Git history.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Start With What You Can See
&lt;/h2&gt;

&lt;p&gt;The integration audit described above is valuable, but it's manual and easy to deprioritize. Complementing it with automated scanning, across your repos, your &lt;code&gt;.env&lt;/code&gt; files, and your CI configuration files, gives you a continuous baseline rather than a point-in-time snapshot.&lt;/p&gt;

&lt;p&gt;If you haven't checked your codebase recently, &lt;a href="https://ghostcred.io/scan?source=blog_third-party-integrations-secret-leakage-blind-spot" rel="noopener noreferrer"&gt;run a free GhostCred scan&lt;/a&gt; to surface exposed keys and tokens in a repo's config files in about 60 seconds. The paid report maps findings to SOC 2 and HIPAA controls so you know exactly what needs to go into your remediation backlog.&lt;/p&gt;

&lt;p&gt;Third-party integrations will always be part of how modern engineering teams move fast. The goal isn't to avoid them, it's to know exactly what credentials live where, ensure they're scoped correctly, and have a clear process for rotating or revoking them when something changes. That starts with visibility.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://ghostcred.io/blog/third-party-integrations-secret-leakage-blind-spot" rel="noopener noreferrer"&gt;ghostcred.io&lt;/a&gt;. GhostCred scans repos and cloud configs for exposed credentials and maps each finding to SOC 2, HIPAA, NYDFS and CMMC. First scan is free.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>apikeyexposure</category>
      <category>cicdsecrets</category>
    </item>
    <item>
      <title>SOC 2 &amp; HIPAA Compliance: How Secret Scanning Closes the Gaps Auditors Actually Flag</title>
      <dc:creator>maxxthemate-png</dc:creator>
      <pubDate>Tue, 13 Oct 2026 14:17:00 +0000</pubDate>
      <link>https://dev.to/maxxthematepng/soc-2-hipaa-compliance-how-secret-scanning-closes-the-gaps-auditors-actually-flag-1f8a</link>
      <guid>https://dev.to/maxxthematepng/soc-2-hipaa-compliance-how-secret-scanning-closes-the-gaps-auditors-actually-flag-1f8a</guid>
      <description>&lt;h2&gt;
  
  
  Why Auditors Are Increasingly Focused on Secrets in Code
&lt;/h2&gt;

&lt;p&gt;SOC 2 and HIPAA audits have traditionally focused on access control policies, encryption at rest, and incident response plans. But over the last few years, auditors and penetration testers have shifted serious attention toward a more tangible and embarrassingly common finding: &lt;strong&gt;hardcoded credentials, API keys, and tokens sitting in source code, configuration files, and CI/CD pipeline variables&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This isn't a niche concern. A developer commits a &lt;code&gt;.env&lt;/code&gt; file containing a database password to a private repo "just temporarily." A contractor copies a Stripe secret key into a shared script. A staging AWS access key never gets rotated after an engineer leaves the team. Each of these is a potential audit finding, and more importantly, a live attack surface.&lt;/p&gt;

&lt;p&gt;If your organization is pursuing SOC 2 Type II or maintaining HIPAA compliance, understanding &lt;em&gt;exactly&lt;/em&gt; where secret exposure maps to specific controls, and how automated scanning closes those gaps, will save you from last-minute remediation sprints before your next audit window.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Exposed Secrets Map to SOC 2 Trust Service Criteria
&lt;/h2&gt;

&lt;p&gt;SOC 2 is organized around Trust Service Criteria (TSC). Secret exposure most directly touches the following:&lt;/p&gt;

&lt;h3&gt;
  
  
  CC6: Logical and Physical Access Controls
&lt;/h3&gt;

&lt;p&gt;CC6.1 requires that access to systems and data be restricted to authorized users. A hardcoded API key or service account token in a repository effectively grants anyone who can read that repo, or any downstream fork, archive, or CI log, the same level of access as the credential's original owner. This is a direct failure of the "least privilege" principle that auditors test for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What auditors look for:&lt;/strong&gt; Evidence that credentials are stored in a secrets manager (e.g., AWS Secrets Manager, HashiCorp Vault, or Azure Key Vault), not in plaintext in code or config files. They will ask whether you have automated controls to &lt;em&gt;detect&lt;/em&gt; when secrets are accidentally committed.&lt;/p&gt;

&lt;h3&gt;
  
  
  CC7: System Operations and Monitoring
&lt;/h3&gt;

&lt;p&gt;CC7.1 and CC7.2 require that you detect and respond to security events. A secret committed to a repository is a security event. Without automated scanning, the median time to discover an exposed credential is measured in days to weeks, plenty of time for an attacker to enumerate and exploit it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What auditors look for:&lt;/strong&gt; A demonstrable, repeatable process for detecting credential exposure, ideally with timestamps and remediation records you can show as evidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  CC8: Change Management
&lt;/h3&gt;

&lt;p&gt;CC8.1 covers change management processes, including the deployment pipeline. Secrets injected insecurely into CI/CD scripts or Dockerfiles during a deployment represent a change management control failure. Secret scanning integrated into your pipeline is direct, auditable evidence of a preventive control here.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Exposed Secrets Map to HIPAA Security Rule Controls
&lt;/h2&gt;

&lt;p&gt;HIPAA's Security Rule is less prescriptive than SOC 2 but equally serious about access control and audit controls when ePHI (electronic Protected Health Information) is involved.&lt;/p&gt;

&lt;h3&gt;
  
  
  §164.312(a)(1), Access Control
&lt;/h3&gt;

&lt;p&gt;This section requires covered entities and business associates to implement technical policies that allow only authorized persons to access ePHI. If a hardcoded database credential or cloud storage key provides access to a system that stores or processes ePHI, its exposure is a potential HIPAA breach, regardless of whether anyone actually exploited it.&lt;/p&gt;

&lt;h3&gt;
  
  
  §164.312(b), Audit Controls
&lt;/h3&gt;

&lt;p&gt;HIPAA requires hardware, software, and procedural mechanisms that record and examine activity in systems containing ePHI. A secret scanning tool that logs every scan, every finding, and every remediation creates an audit trail that directly satisfies this requirement.&lt;/p&gt;

&lt;h3&gt;
  
  
  §164.308(a)(1), Risk Analysis
&lt;/h3&gt;

&lt;p&gt;The Risk Analysis requirement mandates an accurate and thorough assessment of the potential risks to ePHI. Failing to scan for exposed credentials is, at minimum, an incomplete risk analysis. Regulators and their auditors will ask: "How do you know credentials that access ePHI systems haven't been exposed?" You need a concrete, repeatable answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Practical Gap: Policies Exist, Scanning Doesn't
&lt;/h2&gt;

&lt;p&gt;Most engineering teams preparing for SOC 2 or HIPAA have a secrets management &lt;em&gt;policy&lt;/em&gt;. Far fewer have an automated, continuous &lt;em&gt;enforcement mechanism&lt;/em&gt;. The gap between "we have a policy that says don't commit secrets" and "we have tooling that detects when secrets are committed" is exactly where audit findings, and real breaches, live.&lt;/p&gt;

&lt;p&gt;Here's a concrete way to think about your current exposure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;How many repositories does your organization have?&lt;/strong&gt; Multiply that by the number of contributors over the last three years. Every one of those contributors could have accidentally committed a credential at any point.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;When did you last audit your CI/CD environment variables?&lt;/strong&gt; Pipeline secrets are frequently set and forgotten, and often survive long after the team member who created them has left.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Do your pre-commit hooks actually block secret commits, or just warn?&lt;/strong&gt; Warnings that developers can bypass are not a control, they're a suggestion.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Can you produce a report showing no exposed credentials for an auditor today?&lt;/strong&gt; If the answer is "not quickly," that's the gap.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Practical Remediation Workflow for Compliance Teams
&lt;/h2&gt;

&lt;p&gt;Whether you're prepping for a SOC 2 audit or a HIPAA risk assessment, here's a concrete sequence to close the secrets gap:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inventory your repositories and CI/CD environments.&lt;/strong&gt; Include private repos, archived repos, forked repos, and pipeline variable stores. Secrets in archived repos are still exploitable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Run a full historical scan.&lt;/strong&gt; Scanning only the current HEAD of each repo misses secrets that were committed and later deleted. Git history is permanent unless you explicitly purge it with tools like &lt;code&gt;git filter-repo&lt;/code&gt;. Scan the full commit history.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Triage findings by blast radius.&lt;/strong&gt; A leaked key that touches a production database containing ePHI is Priority 1. A test key for a sandbox with no real data is Priority 3. Prioritize rotation by the sensitivity of the system the credential accesses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rotate before you revoke the evidence.&lt;/strong&gt; Rotate the exposed credential in the issuing service first. Then purge it from history. Revoking before rotation can cause an outage if the credential is still in active use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Implement pre-commit hooks and pipeline gates.&lt;/strong&gt; Tools like &lt;code&gt;pre-commit&lt;/code&gt; with a secret detection plugin, or CI steps that fail a build on detected secrets, create a preventive control. This is what moves you from "detective" to "preventive" on the SOC 2 control matrix, a meaningful upgrade in the eyes of auditors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document everything.&lt;/strong&gt; Every scan, every finding, every rotation. Compliance is not just about doing the right thing, it's about being able to prove you did it.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What to Show an Auditor
&lt;/h2&gt;

&lt;p&gt;When an auditor asks "how do you ensure secrets aren't exposed in your codebase," the answer needs to be more than a policy document. Ideal evidence includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A timestamped scan report showing the scope of repositories scanned and findings (or no findings)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A record of remediation actions taken for any findings, including rotation timestamps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configuration evidence of pre-commit hooks or pipeline gates enforcing secret detection&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A defined cadence for re-scanning (e.g., on every pull request, every merge to main, and a full historical scan quarterly)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can produce all four of those artifacts, you've turned secret scanning from an ad-hoc task into a documented, repeatable control, which is precisely what auditors are grading you on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started in Under an Hour
&lt;/h2&gt;

&lt;p&gt;You don't need to overhaul your entire secrets management posture before your next audit. The most important first step is simply &lt;em&gt;knowing what you're dealing with&lt;/em&gt;. A full-repository scan gives you a baseline: the current state of credential exposure across your codebase, mapped to the specific finding types that matter for compliance.&lt;/p&gt;

&lt;p&gt;From that baseline, you can prioritize, remediate, and document, turning a potential audit finding into documented evidence of a functioning control. To get that baseline quickly, &lt;a href="https://ghostcred.io/scan?source=blog_secret-scanning-soc2-hipaa-compliance" rel="noopener noreferrer"&gt;run a free GhostCred scan&lt;/a&gt;: the free scan shows your finding count and risk score in about 60 seconds, and the paid report maps every finding to SOC 2 and HIPAA controls.&lt;/p&gt;

&lt;p&gt;Compliance is built from evidence. Start collecting it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://ghostcred.io/blog/secret-scanning-soc2-hipaa-compliance" rel="noopener noreferrer"&gt;ghostcred.io&lt;/a&gt;. GhostCred scans repos and cloud configs for exposed credentials and maps each finding to SOC 2, HIPAA, NYDFS and CMMC. First scan is free.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>secretscanningsoc2</category>
      <category>hipaasecretscanning</category>
    </item>
    <item>
      <title>API Key Rotation: A Practical Checklist for When You Suspect a Secret Has Been Exposed</title>
      <dc:creator>maxxthemate-png</dc:creator>
      <pubDate>Tue, 06 Oct 2026 14:22:18 +0000</pubDate>
      <link>https://dev.to/maxxthematepng/api-key-rotation-a-practical-checklist-for-when-you-suspect-a-secret-has-been-exposed-1n7h</link>
      <guid>https://dev.to/maxxthematepng/api-key-rotation-a-practical-checklist-for-when-you-suspect-a-secret-has-been-exposed-1n7h</guid>
      <description>&lt;h2&gt;
  
  
  When "Maybe It's Fine" Is the Most Dangerous Thought in Security
&lt;/h2&gt;

&lt;p&gt;You're reviewing a pull request and notice a Stripe secret key committed three days ago. Or a teammate mentions they accidentally pushed a &lt;code&gt;.env&lt;/code&gt; file to a public fork. Or a monitoring alert fires on an unusual spike in API usage at 3 a.m.&lt;/p&gt;

&lt;p&gt;The instinct, especially under pressure, is to quietly fix the code, remove the secret, and hope nobody noticed. That instinct is wrong, and it's exactly how small leaks turn into large breaches.&lt;/p&gt;

&lt;p&gt;This checklist is designed to walk you through a fast, systematic response when a credential is suspected or confirmed exposed. Work through it in order; don't skip steps to save time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Assume Compromise Immediately
&lt;/h2&gt;

&lt;p&gt;The moment you have evidence a secret &lt;em&gt;may&lt;/em&gt; have been exposed, even briefly, even in a private repo, treat it as compromised. Attackers use automated scanners that continuously harvest GitHub, GitLab, and npm for leaked credentials. A secret visible for five minutes can be collected and tested within seconds of the push.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not wait&lt;/strong&gt; for proof of misuse before revoking. Revoke first, investigate second.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Identify the Full Blast Radius
&lt;/h2&gt;

&lt;p&gt;Before touching anything, answer these questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What service does this key access?&lt;/strong&gt; (e.g., AWS, Stripe, Twilio, a third-party data API)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What permissions does it carry?&lt;/strong&gt; Read-only? Write? Admin-level? Billing?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Where else is this key used?&lt;/strong&gt; CI/CD pipelines, other repos, staging environments, a teammate's local machine?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;How long has it been exposed?&lt;/strong&gt; Check git history with &lt;code&gt;git log --all --full-history -- path/to/file&lt;/code&gt; to find the exact commit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Was the repo public at any point?&lt;/strong&gt; Even a brief window of public visibility is enough.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mapping the blast radius before you rotate prevents you from revoking a key and discovering five dependent services are now broken with no replacement ready.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Generate the Replacement First
&lt;/h2&gt;

&lt;p&gt;Create the new credential &lt;em&gt;before&lt;/em&gt; revoking the old one. This minimizes downtime and ensures you have a working replacement ready to deploy atomically. In most platforms:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Log in to the provider's dashboard (AWS IAM, Stripe Dashboard, Twilio Console, etc.).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generate a new key or token with the &lt;strong&gt;minimum required permissions&lt;/strong&gt;, this is a good forcing function to right-size access you may have over-provisioned previously.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Store the new secret immediately in your secrets manager (&lt;a href="https://aws.amazon.com/secrets-manager/" rel="noopener noreferrer"&gt;AWS Secrets Manager&lt;/a&gt;, HashiCorp Vault, 1Password Secrets Automation, etc.), never in a file, chat message, or email.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 4: Rotate and Revoke
&lt;/h2&gt;

&lt;p&gt;With the replacement staged, revoke the exposed credential:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS:&lt;/strong&gt; Go to IAM → Users → Security credentials → Deactivate or delete the access key. Then delete it entirely, deactivated keys can be reactivated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stripe:&lt;/strong&gt; API keys → Roll key. Stripe supports a grace period where both keys work briefly, which is useful for zero-downtime rotation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GitHub Personal Access Tokens:&lt;/strong&gt; Settings → Developer settings → Personal access tokens → Revoke.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Generic pattern:&lt;/strong&gt; Most providers have a "Revoke" or "Delete" button in their API/credentials section. When in doubt, delete rather than deactivate.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After revoking, deploy the new secret to every service that depended on the old one and verify each one resumes normal operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Audit Access Logs for the Exposure Window
&lt;/h2&gt;

&lt;p&gt;Now that you've stopped the bleeding, look at what happened during the exposure window. This step is uncomfortable but non-negotiable.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS:&lt;/strong&gt; CloudTrail logs, filter by the access key ID for the exposure period. Look for &lt;code&gt;AssumeRole&lt;/code&gt;, &lt;code&gt;CreateUser&lt;/code&gt;, &lt;code&gt;PutBucketPolicy&lt;/code&gt;, or any write/admin actions you didn't initiate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stripe:&lt;/strong&gt; Dashboard → Logs, filter by API key. Look for unusual charge volumes, new webhook endpoints, or payout changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GitHub token:&lt;/strong&gt; Check for unexpected repository forks, webhooks, OAuth app authorizations, or collaborator changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Generic:&lt;/strong&gt; Any provider worth using has an audit log. Export it, filter by time window, and look for actions that don't match your application's normal behavior.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you find suspicious activity, especially any resource creation or privilege escalation, escalate to a full incident response process. You're no longer in "rotation mode," you're in "breach mode."&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Purge the Secret from Version Control History
&lt;/h2&gt;

&lt;p&gt;Removing a file or reverting a commit does &lt;strong&gt;not&lt;/strong&gt; remove the secret from git history. Anyone who cloned the repo before the revert still has it. You need to rewrite history.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Using git-filter-repo (recommended over filter-branch)&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;git-filter-repo
git filter-repo &lt;span class="nt"&gt;--path&lt;/span&gt; path/to/secret/file &lt;span class="nt"&gt;--invert-paths&lt;/span&gt;

&lt;span class="c"&gt;# Or redact a specific string across all history&lt;/span&gt;
git filter-repo &lt;span class="nt"&gt;--replace-text&lt;/span&gt; replacements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After rewriting, force-push to all remotes and notify collaborators to re-clone. Also check whether the secret appears in any GitHub/GitLab issue comments, PR descriptions, or CI/CD logs, these are separate from git history and need to be manually redacted.&lt;/p&gt;

&lt;p&gt;Practically speaking: because history rewriting is disruptive and incomplete (forks, CI caches), you should treat the secret as permanently compromised regardless. Revocation is the real protection; history cleanup is hygiene.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Prevent Recurrence with Pre-Commit Controls
&lt;/h2&gt;

&lt;p&gt;Rotation is reactive. The goal is to never need it. Add at least one of these preventive controls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pre-commit hooks:&lt;/strong&gt; Tools like &lt;a href="https://github.com/gitleaks/gitleaks" rel="noopener noreferrer"&gt;Gitleaks&lt;/a&gt; or &lt;a href="https://github.com/trufflesecurity/trufflehog" rel="noopener noreferrer"&gt;TruffleHog&lt;/a&gt; run locally before a commit lands and block secrets from ever reaching the remote.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CI/CD scanning:&lt;/strong&gt; Run a secret scanner on every PR. Fail the build if a new secret pattern is detected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Repo-wide historical scanning:&lt;/strong&gt; Run a full scan across your entire codebase and git history to catch secrets that pre-date your new controls. This is often where the real surprises live.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Environment variable enforcement:&lt;/strong&gt; Lint your codebase for hardcoded strings matching common secret patterns (high-entropy strings, known prefixes like &lt;code&gt;sk_live_&lt;/code&gt;, &lt;code&gt;AKIA&lt;/code&gt;, &lt;code&gt;ghp_&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want a fast baseline picture of what's already exposed across your repos, &lt;a href="https://ghostcred.io/scan?source=blog_api-key-rotation-checklist-exposed-secret" rel="noopener noreferrer"&gt;run a free GhostCred scan&lt;/a&gt;, it checks a repo's config and credential files for exposed API keys, tokens, and IAM misconfigurations in about 60 seconds. The paid report maps findings to SOC 2 and HIPAA controls so you know what actually needs remediation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Rotation Mindset: Make It Boring
&lt;/h2&gt;

&lt;p&gt;The teams that handle credential exposure best are the ones who've made rotation a routine operation rather than a crisis. That means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Short-lived credentials wherever the platform supports them (AWS STS temporary tokens, OIDC-based CI authentication).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Documented runbooks for each credential type so any engineer can rotate without tribal knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Regular scheduled rotation even without a suspected leak, quarterly at minimum for long-lived keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alerting on credential usage anomalies, not just on the leak itself.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A leaked secret doesn't have to become a breach. The difference is almost always speed and process, knowing exactly what to do in the first fifteen minutes while an attacker is still probing what they've found.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://ghostcred.io/blog/api-key-rotation-checklist-exposed-secret" rel="noopener noreferrer"&gt;ghostcred.io&lt;/a&gt;. GhostCred scans repos and cloud configs for exposed credentials and maps each finding to SOC 2, HIPAA, NYDFS and CMMC. First scan is free.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>apikeyrotation</category>
      <category>revokeapikey</category>
    </item>
    <item>
      <title>The .env File Problem: Why Your Secrets Are Closer to Public Than You Think</title>
      <dc:creator>maxxthemate-png</dc:creator>
      <pubDate>Tue, 22 Sep 2026 18:52:01 +0000</pubDate>
      <link>https://dev.to/maxxthematepng/the-env-file-problem-why-your-secrets-are-closer-to-public-than-you-think-55k</link>
      <guid>https://dev.to/maxxthematepng/the-env-file-problem-why-your-secrets-are-closer-to-public-than-you-think-55k</guid>
      <description>&lt;h2&gt;
  
  
  The File That Ships Secrets by Accident
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;.env&lt;/code&gt; file is one of the most convenient conventions in modern development, and one of the most reliably dangerous. It sits in the project root, holds every credential the app needs to boot, and is &lt;em&gt;almost&lt;/em&gt; in &lt;code&gt;.gitignore&lt;/code&gt;. Almost.&lt;/p&gt;

&lt;p&gt;That gap between "almost" and "actually" is where breaches happen. This article walks through the specific ways &lt;code&gt;.env&lt;/code&gt; files escape containment, what the blast radius looks like, and the concrete steps you can take today to close each vector.&lt;/p&gt;

&lt;h2&gt;
  
  
  How .env Files Leak: The Five Most Common Vectors
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. A Missing or Misplaced .gitignore Entry
&lt;/h3&gt;

&lt;p&gt;The classic failure mode. A developer scaffolds a new service, adds credentials to &lt;code&gt;.env&lt;/code&gt;, and forgets to add it to &lt;code&gt;.gitignore&lt;/code&gt; before the first &lt;code&gt;git add .&lt;/code&gt;. The file is committed, pushed, and now lives in every clone of the repository, including your CI runner's workspace and every developer's laptop.&lt;/p&gt;

&lt;p&gt;What makes this worse: even after you delete the file in a later commit, it remains fully recoverable from Git history. Anyone with read access to the repo can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--all&lt;/span&gt; &lt;span class="nt"&gt;--full-history&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; .env
git show :.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The secret is gone from &lt;code&gt;HEAD&lt;/code&gt; but not from the repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Docker Build Context Inclusion
&lt;/h3&gt;

&lt;p&gt;When you run &lt;code&gt;docker build .&lt;/code&gt;, Docker sends the entire build context, including &lt;code&gt;.env&lt;/code&gt;, to the daemon unless a &lt;code&gt;.dockerignore&lt;/code&gt; file explicitly excludes it. If you then push that image to a registry, layer inspection tools can extract the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker save myapp:latest | &lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xO&lt;/span&gt; &lt;span class="nt"&gt;--wildcards&lt;/span&gt; &lt;span class="s1"&gt;'*/layer.tar'&lt;/span&gt; | &lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Public registries on Docker Hub or GitHub Container Registry make this trivially exploitable by anyone who can pull the image.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. CI/CD Pipeline Artifacts and Logs
&lt;/h3&gt;

&lt;p&gt;Some pipelines inadvertently print environment variables to build logs, especially when a step runs &lt;code&gt;env&lt;/code&gt;, &lt;code&gt;printenv&lt;/code&gt;, or a framework that dumps its loaded config on startup. If your CI platform stores logs as downloadable artifacts (common in Jenkins, older GitHub Actions configurations, and self-hosted runners), those logs can be accessed by anyone with read access to the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Shared Developer Machines and Cloud Shells
&lt;/h3&gt;

&lt;p&gt;Developers frequently copy &lt;code&gt;.env&lt;/code&gt; files between projects, store them in shared drives, or paste values into cloud-based IDEs like GitHub Codespaces or Gitpod without realizing those environments sync dotfiles. A single misconfigured dotfile sync can broadcast credentials to a personal cloud workspace that is accessible from a personal device with weaker security controls.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Third-Party Integrations With Repo Read Access
&lt;/h3&gt;

&lt;p&gt;Many developer tools, code review bots, dependency scanners, IDE plugins, request &lt;code&gt;repo&lt;/code&gt; scope on OAuth authorization. That scope gives the integration read access to &lt;em&gt;every file in every repository&lt;/em&gt;, including historical commits containing &lt;code&gt;.env&lt;/code&gt; files you thought were long gone. Auditing your GitHub or GitLab OAuth grants regularly is not optional hygiene, it is a SOC 2 CC6 control.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Actually at Risk When a .env File Leaks
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database credentials&lt;/strong&gt;, direct access to customer PII, which triggers HIPAA breach notification obligations if the database contains PHI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stripe / payment processor keys&lt;/strong&gt;, ability to issue refunds, read transaction history, or create charges.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Third-party API keys&lt;/strong&gt;, cost amplification attacks (think: OpenAI, Twilio, SendGrid) that show up as your bill, not the attacker's.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OAuth client secrets&lt;/strong&gt;, impersonation of your application to any user who has authorized it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cloud provider credentials&lt;/strong&gt;, lateral movement into your AWS, GCP, or Azure environment, potentially escalating to full account compromise.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Concrete Steps to Harden Your .env Hygiene
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Audit Your Entire Git History Now
&lt;/h3&gt;

&lt;p&gt;Don't assume your current &lt;code&gt;.gitignore&lt;/code&gt; is sufficient. Use a scanner to check &lt;em&gt;every commit&lt;/em&gt; across every branch, not just the working tree. If you find a secret in history, assume it is compromised and rotate it immediately, before rewriting history, not after.&lt;/p&gt;

&lt;p&gt;If you &lt;a href="https://ghostcred.io/scan?source=blog_env-file-secret-exposure-risks" rel="noopener noreferrer"&gt;run a free GhostCred scan&lt;/a&gt; against your repository or an uploaded &lt;code&gt;.env&lt;/code&gt; file, you'll typically get results in about a minute, and the paid report maps each finding to the specific SOC 2 or HIPAA controls it affects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Add Both .gitignore and .dockerignore Entries
&lt;/h3&gt;

&lt;p&gt;These are two separate files and must both be configured. A minimal set of entries for each:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="c"&gt;# .gitignore and .dockerignore
&lt;/span&gt;.&lt;span class="n"&gt;env&lt;/span&gt;
.&lt;span class="n"&gt;env&lt;/span&gt;.*
!.&lt;span class="n"&gt;env&lt;/span&gt;.&lt;span class="n"&gt;example&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;!.env.example&lt;/code&gt; exception lets you commit a safe template with placeholder values so teammates know what variables are required, without committing the values themselves.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Use a Secrets Manager, Not a Flat File, in Production
&lt;/h3&gt;

&lt;p&gt;In production, &lt;code&gt;.env&lt;/code&gt; files should not exist. Use your cloud provider's native secrets manager, AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, or a dedicated tool like HashiCorp Vault. Your application fetches secrets at runtime rather than reading a file that must be deployed alongside the code.&lt;/p&gt;

&lt;p&gt;This also makes rotation tractable: you update the value in one place and every instance picks it up on its next credential fetch, rather than requiring a coordinated file replacement across all servers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Rotate Any Secret That May Have Been Exposed
&lt;/h3&gt;

&lt;p&gt;If there is any doubt about whether a credential was committed, even briefly, treat it as compromised. Rotation is the only remediation. History scrubbing with tools like &lt;code&gt;git filter-repo&lt;/code&gt; removes the file from future clones but cannot retroactively invalidate credentials that were copied by anyone who cloned the repo in the interim.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Add Pre-Commit Scanning to Every Repository
&lt;/h3&gt;

&lt;p&gt;Prevent secrets from entering Git history in the first place by running a secret scanner as a pre-commit hook. This catches the mistake at the developer's workstation, before the push, and costs nothing in terms of incident response.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Example using the pre-commit framework&lt;/span&gt;
&lt;span class="na"&gt;repos&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repo&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://github.com/Yelp/detect-secrets&lt;/span&gt;
    &lt;span class="na"&gt;rev&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1.4.0&lt;/span&gt;
    &lt;span class="na"&gt;hooks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;detect-secrets&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pre-commit hooks are bypassed with &lt;code&gt;--no-verify&lt;/code&gt;, so they are a first line of defense, not a replacement for CI-level scanning and periodic repo-wide audits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Audit Third-Party OAuth Grants Quarterly
&lt;/h3&gt;

&lt;p&gt;Review which applications have &lt;code&gt;repo&lt;/code&gt; or &lt;code&gt;read:org&lt;/code&gt; scope on your GitHub organization under &lt;strong&gt;Settings → Third-party access&lt;/strong&gt;. Revoke anything that is unused, unrecognized, or broader in scope than necessary. Document this review cadence in your security runbook, it directly satisfies SOC 2 CC6.6 (logical access revocation).&lt;/p&gt;

&lt;h2&gt;
  
  
  A Note on SOC 2 and HIPAA Implications
&lt;/h2&gt;

&lt;p&gt;Auditors will ask about your secret management practices under SOC 2 CC6 (logical and physical access controls) and, if you handle PHI, under HIPAA's Technical Safeguard requirement for access controls (§164.312(a)). A plaintext &lt;code&gt;.env&lt;/code&gt; file in a repository, even a private one, is a difficult position to defend during an audit. Demonstrating that you run automated secret scanning, rotate credentials on a defined schedule, and use a secrets manager in production puts you in a defensible posture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;.env&lt;/code&gt; file is not inherently dangerous, the habits around it are. Committed history, Docker build contexts, CI logs, and overpermissioned OAuth integrations each represent a distinct leak surface that requires a distinct control. Addressing all five vectors, rotating any secrets that may have been exposed, and moving to a secrets manager for production workloads will close the vast majority of &lt;code&gt;.env&lt;/code&gt;-related risk without requiring significant tooling investment.&lt;/p&gt;

&lt;p&gt;Start with visibility: you cannot remediate what you cannot see.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://ghostcred.io/blog/env-file-secret-exposure-risks" rel="noopener noreferrer"&gt;ghostcred.io&lt;/a&gt;. GhostCred scans public GitHub repos, config files, and cloud accounts for exposed credentials. The first scan is free; the paid report maps each finding to SOC 2, HIPAA, NYDFS and CMMC.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>envfilesecrets</category>
      <category>secretexposure</category>
    </item>
    <item>
      <title>AWS IAM Misconfigurations That Lead to Credential Leaks (And How to Fix Them)</title>
      <dc:creator>maxxthemate-png</dc:creator>
      <pubDate>Tue, 15 Sep 2026 15:03:06 +0000</pubDate>
      <link>https://dev.to/maxxthematepng/aws-iam-misconfigurations-that-lead-to-credential-leaks-and-how-to-fix-them-1452</link>
      <guid>https://dev.to/maxxthematepng/aws-iam-misconfigurations-that-lead-to-credential-leaks-and-how-to-fix-them-1452</guid>
      <description>&lt;h2&gt;
  
  
  Why IAM Misconfigurations Are a Top Cloud Security Risk
&lt;/h2&gt;

&lt;p&gt;Leaked API keys grab headlines, but the quieter threat, overly permissive or poorly structured IAM configurations, is just as dangerous. A single misconfigured IAM role can give an attacker the same access as a stolen root credential, often without triggering any immediate alarms. The worst part: these misconfigurations frequently sit undetected for months because they don't look broken. Everything &lt;em&gt;works&lt;/em&gt;, it just works for attackers too.&lt;/p&gt;

&lt;p&gt;This guide walks through the most common AWS IAM misconfigurations that lead to credential exposure or privilege escalation, and gives you concrete steps to identify and fix each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Overly Permissive IAM Policies (The Wildcard Problem)
&lt;/h2&gt;

&lt;p&gt;The fastest way to write a working IAM policy is to use &lt;code&gt;*&lt;/code&gt; for both &lt;code&gt;Action&lt;/code&gt; and &lt;code&gt;Resource&lt;/code&gt;. It's also one of the most dangerous habits in cloud engineering.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is effectively an admin policy. If the identity attached to this policy, a Lambda function, an EC2 instance role, or a CI/CD service account, is ever compromised, the attacker inherits full account access.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to fix it
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Apply the &lt;strong&gt;principle of least privilege&lt;/strong&gt;: enumerate only the specific actions a role needs (e.g., &lt;code&gt;s3:GetObject&lt;/code&gt;, not &lt;code&gt;s3:*&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scope &lt;code&gt;Resource&lt;/code&gt; to the specific ARN, not &lt;code&gt;*&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;aws iam get-account-authorization-details&lt;/code&gt; and pipe the output into a review to audit all existing policies for wildcards.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use AWS IAM Access Analyzer to surface policies that grant more access than intended.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Long-Lived IAM Access Keys Attached to Human Users
&lt;/h2&gt;

&lt;p&gt;Programmatic access keys (an &lt;code&gt;AKIA…&lt;/code&gt; key ID plus a secret) are static credentials. Unlike short-lived tokens, they don't expire unless you explicitly rotate or delete them. Many teams create these keys for developers or automation, then forget about them for years.&lt;/p&gt;

&lt;p&gt;Long-lived keys attached to human IAM users compound the risk: if a developer accidentally commits the key to a repo, pastes it in Slack, or stores it in an unencrypted config file, it remains valid indefinitely until someone notices.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to fix it
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Audit all active access keys: &lt;code&gt;aws iam generate-credential-report&lt;/code&gt;, then download and review the CSV for any key older than 90 days.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For human users, enforce federated identity (SSO via IAM Identity Center) instead of static keys entirely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For automation, migrate to IAM roles with instance profiles or OIDC-based short-lived tokens (e.g., GitHub Actions OIDC integration with AWS).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set a key rotation policy and enforce it with an AWS Config rule: &lt;code&gt;access-keys-rotated&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  3. Hardcoded Credentials in Lambda Environment Variables
&lt;/h2&gt;

&lt;p&gt;Lambda environment variables are a common shortcut for injecting configuration. But storing an AWS access key, a database password, or a third-party API token as a plain-text environment variable means that credential is visible to anyone with &lt;code&gt;lambda:GetFunctionConfiguration&lt;/code&gt; permissions, a surprisingly broad set of people in many organizations.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to fix it
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Store secrets in &lt;strong&gt;AWS Secrets Manager&lt;/strong&gt; or &lt;strong&gt;Parameter Store (SecureString)&lt;/strong&gt; and fetch them at runtime using the AWS SDK.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Grant the Lambda execution role only &lt;code&gt;secretsmanager:GetSecretValue&lt;/code&gt; on the specific secret ARN, not on &lt;code&gt;*&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you must use environment variables, encrypt them with a customer-managed KMS key and restrict &lt;code&gt;kms:Decrypt&lt;/code&gt; tightly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Audit existing functions: &lt;code&gt;aws lambda list-functions&lt;/code&gt; followed by &lt;code&gt;aws lambda get-function-configuration --function-name&lt;/code&gt; to inspect what's currently stored in plaintext.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Trust Policies That Are Too Broad
&lt;/h2&gt;

&lt;p&gt;An IAM role's trust policy controls &lt;em&gt;who can assume it&lt;/em&gt;. A common mistake is setting the principal to the entire AWS account (&lt;code&gt;"AWS": "arn:aws:iam::123456789012:root"&lt;/code&gt;) or, worse, to &lt;code&gt;"*"&lt;/code&gt;. This means any identity in the account, or even any authenticated AWS principal in the world, can assume the role if they can reach it.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to fix it
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scope trust policies to the exact IAM user, role, or service that needs to assume the role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a &lt;code&gt;Condition&lt;/code&gt; block with &lt;code&gt;aws:PrincipalOrgID&lt;/code&gt; or &lt;code&gt;sts:ExternalId&lt;/code&gt; for cross-account roles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use IAM Access Analyzer regularly to flag roles with public or cross-account trust that you didn't intend.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Unused Roles and Keys That Were Never Cleaned Up
&lt;/h2&gt;

&lt;p&gt;Every stale IAM identity is an attack surface. A role created for a deprecated microservice, a key generated for a contractor who left six months ago, or a service account from a decommissioned integration, any of these can be exploited if the corresponding credential ever surfaces in a leaked config or an old backup.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to fix it
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use &lt;strong&gt;IAM last-accessed information&lt;/strong&gt; (&lt;code&gt;aws iam get-role --role-name&lt;/code&gt;, look at &lt;code&gt;RoleLastUsed&lt;/code&gt;) to identify roles that haven't been used in 60+ days.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tag every IAM identity with an owner, team, and expiry date as part of your provisioning process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implement a quarterly IAM access review as a SOC 2 CC6.3 control, it satisfies auditors &lt;em&gt;and&lt;/em&gt; reduces your blast radius.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Mapping IAM Hygiene to SOC 2 and HIPAA
&lt;/h2&gt;

&lt;p&gt;If your organization is pursuing SOC 2 Type II or HIPAA compliance, IAM hygiene isn't optional, it's directly mapped to specific controls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SOC 2 CC6.1 / CC6.3:&lt;/strong&gt; Logical access controls and access reviews. Least-privilege IAM policies and regular role audits satisfy these directly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SOC 2 CC6.7:&lt;/strong&gt; Transmission and disposal of data. Restricting which roles can access S3 buckets containing customer data is a key evidence artifact.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HIPAA §164.312(a)(1), Access Control:&lt;/strong&gt; Requires unique user identification and emergency access procedures. Static shared keys fail this requirement; federated identity with MFA meets it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HIPAA §164.312(a)(2)(iv), Encryption and Decryption:&lt;/strong&gt; Storing PHI-adjacent secrets in Secrets Manager with KMS encryption supports this safeguard.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Auditors want &lt;em&gt;evidence&lt;/em&gt;, not just intent. Automated scanning that produces a timestamped report of your IAM posture is far stronger than a manual checklist filled out once a year.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Starting Checklist
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Generate and review the IAM credential report today.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enable IAM Access Analyzer in every active region.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Search your codebase and CI/CD environment variables for any string matching &lt;code&gt;AKIA[0-9A-Z]{16}&lt;/code&gt;, that's the pattern for AWS access key IDs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review Lambda and EC2 instance roles for wildcard policies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Delete or disable any access key or role with no activity in the past 90 days.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Migrate static keys to OIDC or instance-profile-based short-lived credentials wherever possible.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;IAM misconfigurations are often invisible until something goes wrong. A proactive scan, covering not just your IAM policies but also your repositories and &lt;code&gt;.env&lt;/code&gt; files for exposed credentials, gives you a complete picture. You can &lt;a href="https://ghostcred.io/scan?source=blog_aws-iam-misconfigurations-credential-leaks" rel="noopener noreferrer"&gt;run a free GhostCred scan&lt;/a&gt; to check a GitHub repo, a config file, or a connected AWS account for exposed secrets and IAM red flags, typically in about a minute. The paid report maps each finding to SOC 2 and HIPAA controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;IAM is infrastructure. Treat it with the same discipline you'd apply to network firewall rules or database access controls. The misconfigurations above aren't exotic edge cases, they appear in real production environments across companies of every size. The good news is that each one is fixable, often in under an hour, and the compounding effect of addressing all five significantly raises the cost for any attacker trying to move laterally through your AWS environment.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://ghostcred.io/blog/aws-iam-misconfigurations-credential-leaks" rel="noopener noreferrer"&gt;ghostcred.io&lt;/a&gt;. GhostCred scans public GitHub repos, config files, and cloud accounts for exposed credentials. The first scan is free; the paid report maps each finding to SOC 2, HIPAA, NYDFS and CMMC.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>iamcredentialleak</category>
      <category>awsaccesskeyrotation</category>
    </item>
    <item>
      <title>How to Find Exposed API Keys in Your Git Repository (Before an Attacker Does)</title>
      <dc:creator>maxxthemate-png</dc:creator>
      <pubDate>Sat, 12 Sep 2026 07:42:01 +0000</pubDate>
      <link>https://dev.to/maxxthematepng/how-to-find-exposed-api-keys-in-your-git-repository-before-an-attacker-does-3e70</link>
      <guid>https://dev.to/maxxthematepng/how-to-find-exposed-api-keys-in-your-git-repository-before-an-attacker-does-3e70</guid>
      <description>&lt;h2&gt;
  
  
  Why Git History Is a Credential Graveyard
&lt;/h2&gt;

&lt;p&gt;Developers move fast. A Stripe secret key gets pasted into &lt;code&gt;.env&lt;/code&gt; for a quick test, the file accidentally lands in a commit, someone notices and deletes it, but the damage is already done. Git history is append-only by design. That deleted file still lives in every clone of the repo, readable with a single &lt;code&gt;git log&lt;/code&gt; or &lt;code&gt;git show&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;The same pattern plays out with CI/CD configs, Docker Compose files, Kubernetes manifests, and Terraform state files. Credentials find their way in during late-night debugging sessions and stay there indefinitely. Attackers know this, and automated scanners continuously probe public repositories looking for exactly these patterns.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Counts as an Exposed Credential?
&lt;/h2&gt;

&lt;p&gt;Before you scan, it helps to know what you're looking for. Common categories include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API keys and tokens&lt;/strong&gt;, AWS access keys, GitHub personal access tokens, Stripe/Twilio/SendGrid API keys, Slack bot tokens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Service account credentials&lt;/strong&gt;, GCP JSON key files, Azure service principal secrets embedded in config.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database connection strings&lt;/strong&gt;, anything containing &lt;code&gt;password=&lt;/code&gt;, &lt;code&gt;://user:pass@&lt;/code&gt;, or similar patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Private keys and certificates&lt;/strong&gt;, PEM-encoded RSA/EC keys, JWT signing secrets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OAuth client secrets&lt;/strong&gt;, often mistaken for "safe" because they require a redirect URI, but still dangerous.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hardcoded .env values&lt;/strong&gt;, even when &lt;code&gt;.env&lt;/code&gt; is in &lt;code&gt;.gitignore&lt;/code&gt;, a single slip can expose it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1, Audit Your Current Working Tree
&lt;/h2&gt;

&lt;p&gt;Start with what's in your current codebase. A fast manual pass uses &lt;code&gt;grep&lt;/code&gt; with patterns common to real credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Look for AWS-style access keys&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rE&lt;/span&gt; &lt;span class="s2"&gt;"AKIA[0-9A-Z]{16}"&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*.env"&lt;/span&gt; &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*.json"&lt;/span&gt; &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*.yml"&lt;/span&gt;

&lt;span class="c"&gt;# Catch generic "secret" or "api_key" assignments&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rniE&lt;/span&gt; &lt;span class="s2"&gt;"(api_key|api_secret|access_token|client_secret)&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="s2"&gt;*=&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="s2"&gt;*['&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;][^'&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;]{8,}"&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a reasonable first pass, but regex alone has a high false-positive rate and misses obfuscated or base64-encoded values. Treat it as a triage step, not a final answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2, Scan Your Full Git History
&lt;/h2&gt;

&lt;p&gt;This is where most teams have blind spots. A secret committed two years ago and "deleted" in a follow-up commit is still fully accessible. Tools like &lt;strong&gt;git-secrets&lt;/strong&gt;, &lt;strong&gt;truffleHog&lt;/strong&gt;, and &lt;strong&gt;gitleaks&lt;/strong&gt; can walk the entire commit graph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Using gitleaks on a local repo&lt;/span&gt;
gitleaks detect &lt;span class="nt"&gt;--source&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--verbose&lt;/span&gt;

&lt;span class="c"&gt;# Scanning history specifically&lt;/span&gt;
gitleaks detect &lt;span class="nt"&gt;--source&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--log-opts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"--all"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pay attention to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Merge commits and feature branches that may never have been squashed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stash objects (&lt;code&gt;git stash list&lt;/code&gt;) which are not always scanned by default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Submodules, they carry their own independent history.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tags pointing at older commits that predate your security practices.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3, Check .env Files and Config Templates
&lt;/h2&gt;

&lt;p&gt;Even if your &lt;code&gt;.env&lt;/code&gt; is gitignored, check that no committed template file (&lt;code&gt;.env.example&lt;/code&gt;, &lt;code&gt;.env.sample&lt;/code&gt;) contains real values rather than placeholders. A surprisingly common mistake is copying a working &lt;code&gt;.env&lt;/code&gt; to &lt;code&gt;.env.example&lt;/code&gt; and committing it directly.&lt;/p&gt;

&lt;p&gt;Also audit your CI/CD pipeline definitions (GitHub Actions &lt;code&gt;.yml&lt;/code&gt;, GitLab CI, CircleCI config) for inline secrets. Secrets should always be injected via your CI platform's secret store, never hardcoded in the pipeline file itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4, Remediate Found Secrets Immediately
&lt;/h2&gt;

&lt;p&gt;Finding a leaked secret triggers a specific remediation sequence. The order matters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Revoke and rotate first.&lt;/strong&gt; Before you do anything to the repo, invalidate the exposed credential. An attacker monitoring public repos can act in minutes; rewriting history takes longer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rewrite history (if the repo is private and you control all forks).&lt;/strong&gt; Use &lt;code&gt;git filter-repo&lt;/code&gt; (preferred over the older &lt;code&gt;BFG Repo Cleaner&lt;/code&gt;) to purge the file or value from all commits, then force-push and have all collaborators re-clone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;If the repo is public, assume the secret is burned.&lt;/strong&gt; History rewriting won't help, GitHub and other forges cache content, and bots may have already captured it. Rotation is your only real fix.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audit access logs.&lt;/strong&gt; Check whether the exposed key was actually used. AWS CloudTrail, GCP Audit Logs, and most SaaS platforms provide usage history. Look for unusual source IPs, regions, or API calls.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document the incident.&lt;/strong&gt; Even a brief internal write-up captures what happened and prevents recurrence. This record is also useful evidence for SOC 2 auditors.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 5, Put Prevention in Place
&lt;/h2&gt;

&lt;p&gt;Remediation without prevention is a treadmill. Add these controls so the same mistake can't recur silently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pre-commit hooks&lt;/strong&gt;, Install &lt;code&gt;gitleaks&lt;/code&gt; or &lt;code&gt;detect-secrets&lt;/code&gt; as a pre-commit hook so secrets are blocked before they ever reach the remote.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Push protection&lt;/strong&gt;, GitHub Advanced Security and similar platforms can block pushes containing known secret patterns at the server side, catching anything a local hook missed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A secrets manager&lt;/strong&gt;, AWS Secrets Manager, HashiCorp Vault, and Doppler are all designed so your application fetches credentials at runtime rather than storing them in files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Least-privilege IAM&lt;/strong&gt;, Even if a key leaks, scoping it to the minimum required permissions limits the blast radius.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Regular rotation schedules&lt;/strong&gt;, Treat API keys like passwords. Many platforms (AWS, GCP) support automatic rotation. Build it into your runbooks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The SOC 2 / HIPAA Angle
&lt;/h2&gt;

&lt;p&gt;If your organization is pursuing or maintaining SOC 2 Type II or HIPAA compliance, exposed credentials aren't just a security problem, they're an audit finding. SOC 2's &lt;em&gt;CC6.1&lt;/em&gt; (logical access controls) and &lt;em&gt;CC6.7&lt;/em&gt; (transmission protection) directly address how credentials must be managed. HIPAA's Security Rule requires covered entities to implement technical safeguards protecting ePHI, which extends to the API keys that access systems storing that data.&lt;/p&gt;

&lt;p&gt;Auditors increasingly ask for evidence of continuous secret scanning, not just a one-time review. Automated tooling that produces scan logs and maps findings to controls provides the paper trail your auditors need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get a Baseline in About 60 Seconds
&lt;/h2&gt;

&lt;p&gt;Manual grep and local tooling are valuable, but they require setup, maintenance, and security expertise to tune correctly. If you want a fast baseline for a GitHub repo or &lt;code&gt;.env&lt;/code&gt; file, &lt;a href="https://ghostcred.io/scan?source=blog_find-exposed-api-keys-git-repository" rel="noopener noreferrer"&gt;run a free GhostCred scan&lt;/a&gt; and see what's actually exposed before someone else does. It reads the config and credential files on your default branch, not your git history, so pair it with the history scan above. The paid report adds mapping to SOC 2 and HIPAA controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Reference Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;☐ Grep working tree for common credential patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;☐ Scan full Git history, including all branches and tags.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;☐ Audit &lt;code&gt;.env.example&lt;/code&gt; and CI pipeline files for inline secrets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;☐ Revoke any found credentials &lt;em&gt;before&lt;/em&gt; rewriting history.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;☐ Check provider access logs for signs of exploitation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;☐ Install pre-commit hooks and enable push protection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;☐ Migrate to a secrets manager; eliminate file-based credentials.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;☐ Schedule periodic rotation for all long-lived keys.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://ghostcred.io/blog/find-exposed-api-keys-git-repository" rel="noopener noreferrer"&gt;ghostcred.io&lt;/a&gt;. GhostCred scans public GitHub repos, config files, and cloud accounts for exposed credentials. The first scan is free; the paid report maps each finding to SOC 2, HIPAA, NYDFS and CMMC.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>exposedapikeys</category>
      <category>gitsecretscanning</category>
    </item>
  </channel>
</rss>
