惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
GbyAI
GbyAI
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
量子位
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
CERT Recently Published Vulnerability Notes
Recent Announcements
Recent Announcements
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
P
Privacy International News Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
NISL@THU
NISL@THU
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
The Register - Security
The Register - Security
M
MIT News - Artificial intelligence
Know Your Adversary
Know Your Adversary
A
Arctic Wolf
F
Full Disclosure
T
Threat Research - Cisco Blogs
P
Privacy & Cybersecurity Law Blog
The Hacker News
The Hacker News
博客园 - 【当耐特】
D
Docker
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Jina AI
Jina AI
Help Net Security
Help Net Security
V
Visual Studio Blog
小众软件
小众软件
B
Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
Forbes - Security
Forbes - Security
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
AI vs Rule-Based Secret Scanning in CI: Which Actually Works
Oleksandr Kuryzhev · 2026-06-18 · via DEV Community

Oleksandr Kuryzhev

Originally published on kuryzhev.cloud


Your CI pipeline passed clean, the PR merged, and three hours later your AWS keys were rotating — because your regex scanner never saw the secret encoded inside a base64 config blob. AI secret scanning in CI pipelines promises to close that gap, but it comes with its own set of tradeoffs that most comparison posts quietly skip over. I've run both approaches in production environments ranging from a 5-person startup to a 200-developer platform org, and the answer is not as simple as "just use the AI tool."

When You Face This Choice

The moment that forces this decision is always the same: a developer pushes code containing a hardcoded credential, and your post-incident review surfaces the question — did our scanner miss this, or did we not have one at all? Either answer is bad, but they lead to very different remediation paths.

There are two distinct camps in secret detection tooling right now. The first is traditional pattern and regex-based scanning: tools like Gitleaks and detect-secrets operate deterministically. They match known patterns against your code, flag high-entropy strings, and give you a binary pass/fail. No external calls, no inference latency, no monthly invoice from an API vendor.

The second camp is AI-assisted scanning: tools like Nightfall, GitGuardian with its ML classification models, and Semgrep AI use trained models to understand context. They can distinguish a real Stripe live key from a placeholder string, or catch a secret that's been obfuscated in a way that defeats a simple regex.

The stakes here are not abstract. The IBM Cost of a Data Breach 2023 report puts the average incident cost at $4.45M. Leaked secrets in CI logs and version history are consistently ranked as a top initial access vector by threat intelligence teams. Getting this wrong is expensive. Getting it right requires understanding what each tool category actually does — and doesn't — protect you against.

Option A: Rule-Based Scanners (Gitleaks / detect-secrets)

I've used Gitleaks on every project I've joined for the past three years. Version 8.18.4 is the current stable release, ships as a single binary, and you can pull it with brew install gitleaks or use the container image ghcr.io/gitleaks/gitleaks:v8.18.4. The default config detects 150+ secret types out of the box. That coverage is genuinely impressive for a free, offline tool.

Pros:

  • Fully offline. No data leaves your infrastructure. For air-gapped environments, regulated industries, or teams under strict data classification policies, this is not a nice-to-have — it's a hard requirement.
  • Predictable performance. Gitleaks scans a 10,000-commit repository in under 30 seconds on a standard CI runner. That's fast enough to sit in a blocking PR gate without annoying your developers.
  • Zero per-scan cost. Runs as a single binary in any pipeline stage. No API keys, no vendor relationship, no surprise billing.

Cons:

  • Alert fatigue is real and fast. High false-positive rates on entropy-based rules mean teams start ignoring alerts within weeks. I've seen this pattern on three separate teams. The scanner becomes noise, and the one real finding gets buried.
  • Context blindness. A Slack token embedded in a base64-encoded JSON blob will pass most regex rules. A real AWS key stored as a Kubernetes secret YAML value and then committed to a config repo? Also likely to slip through depending on your rule configuration.
  • Rule maintenance becomes a second codebase. Custom .gitleaks.toml files grow to 200+ lines over time and nobody owns them. I've inherited repos where the allowlist had grown so permissive it was suppressing entire file types.

⚠️ Watch out for this: A common mistake is adding the --no-git flag to Gitleaks in CI. This disables commit history scanning and only checks the working tree. You will miss secrets committed three sprints ago. Always use fetch-depth: 0 in your checkout step and never pass --no-git unless you have a specific reason.

⚠️ Another one: The allowlist in .gitleaks.toml has a regexTarget field that accepts "line" or "match". If you use "line", it suppresses the entire line — including any other secrets that happen to be on the same line. Use "match" unless you explicitly want line-level suppression.

Here's the .gitleaks.toml configuration I use as a starting point. It extends the defaults, adds a custom rule for internal service tokens, and sets up an allowlist that suppresses known false positives without being dangerously broad:

# .gitleaks.toml
# Custom Gitleaks config — extends defaults, adds allowlist for known test fixtures
# Place at repo root; Gitleaks auto-discovers this file

title = "kuryzhev.cloud secret scan config"

[extend]
  # Inherit all 150+ default rules from upstream
  useDefault = true

# ── Custom rule: internal service tokens follow pattern SVC-[env]-[hex32] ────
[[rules]]
  id = "internal-service-token"
  description = "Internal service account token"
  regex = '''SVC-(prod|staging|dev)-[0-9a-f]{32}'''
  tags = ["internal", "service-account"]
  severity = "CRITICAL"

# ── Allowlist: suppress known false positives ─────────────────────────────────
[allowlist]
  description = "Global allowlist for test fixtures and docs"
  # regexTarget = "match" — only suppresses the matched string, not the full line
  regexTarget = "match"
  regexes = [
    '''EXAMPLE_API_KEY_REPLACE_ME''',       # placeholder in README templates
    '''sk_test_[0-9a-zA-Z]{24}''',          # Stripe test keys — not valid in prod
    '''ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''',  # GitHub docs example token
  ]
  paths = [
    '''tests/fixtures/.*''',                # test fixture directory
    '''docs/.*\.md''',                      # documentation files
    '''\.gitleaks\.toml''',                 # this file itself
  ]
  # Commits known to contain intentional secret-like strings (e.g. security test commits)
  commits = [
    "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
  ]

# ── Entropy tuning: reduce false positives on high-entropy non-secrets ────────
[[rules]]
  id = "suppress-lock-file-entropy"
  description = "Ignore high-entropy strings in lock files"
  regex = '''.+'''
  allowlist.paths = [
    '''package-lock\.json''',
    '''yarn\.lock''',
    '''Gemfile\.lock''',
    '''poetry\.lock''',
  ]

Option B: AI-Assisted Scanners (Nightfall / GitGuardian ML / Semgrep AI)

AI-assisted secret scanning has matured significantly in the last two years. GitGuardian's ML model, Nightfall's detection API, and Semgrep's AI Assistant are all production-grade tools used by teams I respect. But they come with a very different set of tradeoffs that are easy to underestimate when you're reading a vendor's marketing page.

Pros:

  • Context-aware classification. This is the genuine differentiator. These tools can distinguish a real Stripe live key (sk_live_...) from a test key (sk_test_XXXX) or a placeholder string. GitGuardian's model reports under 1% false-positive rate on public benchmark datasets, compared to 15–30% for pure regex approaches. That difference in signal quality is the entire argument for paying for an AI tool.
  • Inline PR remediation. Semgrep Assistant, backed by GPT-4, can post a PR comment explaining exactly why a finding is a secret and what the developer should do instead. That's a developer experience improvement that reduces time-to-remediation significantly compared to a raw SARIF report.
  • Historical scanning depth. GitGuardian's historical scan via ggshield secret scan repo . on a repo with 50,000 commits takes 4–8 minutes and will surface secrets buried in branches that have never been reviewed. Run this once on onboarding for every existing repository.

Cons:

  • Data egress is a hard compliance problem. SaaS AI scanners send code snippets to external APIs. Under SOC 2, HIPAA, or strict internal data classification policies, this may be an immediate disqualifier — regardless of how accurate the model is. Always check your data processing agreement before enabling these integrations.
  • Cost scales faster than you expect. Nightfall charges per API call. A monorepo with 500 daily commits in a team of 20 developers can exceed $300–500 per month quickly. GitGuardian's team tier starts at $25 per developer per month — for a 20-dev team, that's $500/month before volume discounts.
  • Latency compounds in parallel pipelines. AI inference adds 15–45 seconds per scan job. In a pipeline with 8 parallel jobs, that's acceptable. In a pipeline where this scan is on the critical path and your total CI SLA is already tight, it will cause friction.

⚠️ Watch out for this one specifically: The ggshield secret scan ci command returns exit code 1 on any finding and exit code 128 on authentication failure. Pipelines that don't distinguish these two exit codes will silently pass when your service account token expires. I stopped trusting ggshield integrations I didn't write myself after seeing this exact failure mode in a client's pipeline — the scanner had been silently passing for six weeks because the API token had rotated.

⚠️ Nightfall-specific gotcha: The detectionRuleUUID must be pre-created in the Nightfall dashboard. If you hardcode a deleted rule UUID in your pipeline config, the scan completes with no error and no findings. Silent pass. Always validate rule existence in your pipeline bootstrap step.

Decision Matrix

Rather than a vague recommendation, here's the framework I use when advising teams on this choice. Score each factor for your actual situation, not your aspirational situation.

Factor Rule-Based (Gitleaks) AI-Assisted (GitGuardian/Nightfall) Hybrid
Data residency required ✅ Fully offline ❌ Hard blocker ⚠️ Use local AI rules only
False-positive tolerance (low) ❌ 15–30% FP rate ✅ <1% FP rate ✅ Rule-based gates, AI audits
Budget (<$200/month) ✅ Free ❌ Likely over budget at >8 devs ⚠️ GitGuardian free tier + Gitleaks
Monorepo with 50k+ commits ⚠️ Slow on full history ✅ Historical scan designed for this ✅ Gitleaks on delta, GG on schedule
Context-aware detection needed ❌ Pattern-only ✅ Core capability ✅ AI handles deep audit
CI latency SLA (<5 min total) ✅ <30s scan time ⚠️ Adds 15–45s per job ✅ AI runs async, off critical path

The hard blocker column matters most. If data residency is required, AI SaaS is eliminated regardless of accuracy scores. If your false-positive tolerance is near zero because your security team has zero capacity to triage noise, rule-based tools will create more problems than they solve. Use this matrix honestly.

For teams in regulated industries who need AI-level accuracy without data egress, the practical answer is Semgrep with local rules (semgrep scan --config auto without a token) or a self-hosted Nightfall enterprise deployment. Neither is free, but both keep your code on your infrastructure. More on secure CI/CD patterns at kuryzhev.cloud.

My Pick

I prefer the hybrid approach, and I'm not hedging — this is the architecture I deploy on every new project I own.

Gitleaks in pre-commit and as a blocking PR gate. GitGuardian as a scheduled async scan. Never both blocking the merge at the same time.

Here's the reasoning. Rule-based tools should own the fast path — the developer feedback loop. A Gitleaks scan that completes in under 30 seconds and blocks a PR merge on a clear pattern match is genuinely useful. It catches the obvious mistakes before they land. It's free, it's fast, and it's offline.

AI tools should own the deep audit path. Run GitGuardian as a post-push async scan on main and develop branches, non-blocking, with P1 alert routing to your incident response channel. This catches the context-aware leaks — the encoded secrets, the test keys that are actually real, the internal service tokens — without adding latency to the developer loop or creating a blocking dependency on an external API.

The GitHub Actions workflow below implements exactly this pattern. Gitleaks runs on every PR and blocks on findings. GitGuardian runs async on pushes to main and develop, exits zero even on findings (alerting is handled by the GitGuardian dashboard), and uploads results as a pipeline artifact for audit purposes:

# .github/workflows/secret-scan.yml
# Hybrid secret scanning: Gitleaks (fast, blocking) + ggshield (AI-assisted, async)
# Requires: GITGUARDIAN_API_KEY stored as GitHub Actions secret (masked + protected)

name: Secret Detection

on:
  push:
    branches: ["**"]
  pull_request:
    branches: [main, develop]

jobs:
  # ── Job 1: Fast rule-based scan — blocks merge if triggered on PR ──────────
  gitleaks-scan:
    name: Gitleaks Rule-Based Scan
    runs-on: ubuntu-latest
    steps:
      - name: Checkout full history
        uses: actions/checkout@v4
        with:
          fetch-depth: 0  # REQUIRED: scan full commit history, not just HEAD

      - name: Run Gitleaks
        uses: gitleaks/gitleaks-action@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}  # only needed for org-level scans
        with:
          args: >
            --config .gitleaks.toml
            --redact
            --exit-code 1
            --report-format sarif
            --report-path gitleaks-report.sarif

      - name: Upload SARIF to GitHub Security tab
        if: always()  # upload even on failure so findings appear in Security tab
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: gitleaks-report.sarif

  # ── Job 2: AI-assisted scan — non-blocking, async, alerts via ggshield ─────
  gitguardian-scan:
    name: GitGuardian AI-Assisted Scan
    runs-on: ubuntu-latest
    # Run on push to main/develop only; do NOT block PR merge gate
    if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
    steps:
      - name: Checkout full history
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install ggshield
        run: pip install ggshield==1.29.0  # pin version for reproducibility

      - name: Authenticate ggshield
        run: ggshield auth login --method=token
        env:
          GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}

      - name: Run GitGuardian secret scan
        run: |
          ggshield secret scan ci \
            --output gg-results.json \
            --json \
            --exit-zero  # non-blocking: exit 0 even on findings; alerting handled by GitGuardian dashboard
        env:
          GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}

      - name: Upload scan results as artifact
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: gitguardian-results
          path: gg-results.json
          retention-days: 30

One concrete caveat: if you're in a regulated industry with strict data egress controls, replace the GitGuardian job with Semgrep using local AI rules or a self-hosted enterprise scanner. The architecture stays the same — fast rule-based gate on PR, deep AI audit async — but the AI component runs on your own infrastructure. Check the GitHub secret scanning documentation if you're on GitHub Advanced Security and want to layer native scanning on top of this setup.

One final thing I want to flag: wherever you store your GITGUARDIAN_API_KEY or NIGHTFALL_API_KEY — make sure it's masked, protected, and injected via a secrets manager or CI secret store. Storing a secret scanner's own API key as a plain CI environment variable is the specific kind of irony that shows up in post-incident reviews. I've seen it happen. Don't let it happen to you.

The bottom line on AI secret scanning in CI pipelines: use rule-based tools to protect the developer loop, use AI tools to protect the audit trail. Neither one alone is sufficient. Both together, in the right places, is the architecture that actually holds up under real-world conditions.

Related