<?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: João Antonio Lourenço</title>
    <description>The latest articles on DEV Community by João Antonio Lourenço (@ja_lourenco).</description>
    <link>https://dev.to/ja_lourenco</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3914830%2Fd2663b00-7fd4-42b2-ac60-4ef4c0db2457.jpeg</url>
      <title>DEV Community: João Antonio Lourenço</title>
      <link>https://dev.to/ja_lourenco</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ja_lourenco"/>
    <language>en</language>
    <item>
      <title>🔐 TruffleHog Secret Scanner Automation</title>
      <dc:creator>João Antonio Lourenço</dc:creator>
      <pubDate>Tue, 12 May 2026 02:17:02 +0000</pubDate>
      <link>https://dev.to/ja_lourenco/trufflehog-secret-scanner-automation-1ana</link>
      <guid>https://dev.to/ja_lourenco/trufflehog-secret-scanner-automation-1ana</guid>
      <description>&lt;h3&gt;
  
  
  Context and Problem
&lt;/h3&gt;

&lt;p&gt;An AWS EKS Cluster was attacked, and its secrets were compromised. The Kubernetes Secrets were not encrypted, anyone who works with Kubernetes know they are only &lt;a href="https://kubernetes.io/docs/concepts/configuration/secret/#working-with-secrets" rel="noopener noreferrer"&gt;base64-encoded by default&lt;/a&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Task
&lt;/h3&gt;

&lt;p&gt;I had a mission to scan 115 repositories across GitHub and Azure DevOps for secrets exposed anywhere in the Git history.&lt;/p&gt;

&lt;p&gt;The goal was simple: identify exposed secrets and provide actionable reports for the engineering team to fix them.&lt;/p&gt;

&lt;p&gt;A colleague recommended a tool called &lt;a href="https://trufflesecurity.com/trufflehog" rel="noopener noreferrer"&gt;TruffleHog&lt;/a&gt;, which became the foundation of the workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  TruffleHog
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;"TruffleHog is a secrets scanning tool that digs deep into your code repositories to find secrets, passwords, and sensitive keys."&lt;/p&gt;

&lt;p&gt;— TruffleHog official website&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Read the TruffleHog documentation;&lt;/li&gt;
&lt;li&gt;Ran a test in a personal GitHub repository to see how the tool works;&lt;/li&gt;
&lt;li&gt;Check the total amount of repositories to scan, 115;&lt;/li&gt;
&lt;li&gt;Designed how I was going to complete the Task:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Decided to automate the process using Bash and jq.
- The script would receive the repository URL as a parameter.
- Used jq to filter and mask findings.
- Used jq to generate separate JSON files for active and inactive secrets.
- Generated standardized Notion reports to support remediation workflows.
- Used the generated JSON data with Gemini to create the reports.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Report Example
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tdrh77o38r464g7mra5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tdrh77o38r464g7mra5.png" alt="Report Example"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Lessons Learned
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Standardizing reports made remediation much faster.
- Active and inactive secrets should be separated to improve prioritization.
- Automation becomes essential when dealing with dozens of repositories.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Why Bash and jq?
&lt;/h3&gt;

&lt;p&gt;Keep the workflow simple and easy to run.&lt;/p&gt;

&lt;p&gt;jq made it easy to:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- filter findings
- mask sensitive values
- split active and inactive secrets
- generate structured outputs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Check the code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ja-lourenco" rel="noopener noreferrer"&gt;
        ja-lourenco
      &lt;/a&gt; / &lt;a href="https://github.com/ja-lourenco/trufflehog-scan" rel="noopener noreferrer"&gt;
        trufflehog-scan
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;🔐 TruffleHog Secret Scanner Automation&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;Simple Bash automation to scan Git repositories for exposed secrets using TruffleHog, classify results, and generate structured outputs.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;🚀 Features&lt;/h3&gt;
&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Scan any Git repository for secrets&lt;/li&gt;
&lt;li&gt;Classify findings (active vs inactive)&lt;/li&gt;
&lt;li&gt;Mask sensitive data automatically&lt;/li&gt;
&lt;li&gt;Generate structured JSON outputs&lt;/li&gt;
&lt;li&gt;Organize results per repository&lt;/li&gt;
&lt;/ul&gt;




&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;⚙️ Requirements&lt;/h3&gt;
&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Bash&lt;/li&gt;
&lt;li&gt;jq&lt;/li&gt;
&lt;li&gt;TruffleHog&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;📦 Install TruffleHog&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://github.com/trufflesecurity/trufflehog#floppy_disk-installation" rel="noopener noreferrer"&gt;Official Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify installation:&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;trufflehog --version&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;📦 Install jq&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://jqlang.org/download/" rel="nofollow noopener noreferrer"&gt;Official Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify installation:&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;jq --version&lt;/pre&gt;

&lt;/div&gt;




&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;
▶️ Usage&lt;/h3&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Clone this repository:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone &lt;span class="pl-k"&gt;&amp;lt;&lt;/span&gt;your-repo-url&lt;span class="pl-k"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="pl-c1"&gt;cd&lt;/span&gt; &lt;span class="pl-k"&gt;&amp;lt;&lt;/span&gt;repo-folder&lt;span class="pl-k"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Make script executable:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;chmod +x trufflehog-scan.sh&lt;/pre&gt;

&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Run the scan:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;./trufflehog-scan.sh &lt;span class="pl-k"&gt;&amp;lt;&lt;/span&gt;REPOSITORY_URL&lt;span class="pl-k"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;./trufflehog-scan.sh https://github.com/user/repo.git&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;📂 Output&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;A directory will be created with the repository name:&lt;/p&gt;

&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;repo-name/
├── repo-name_raw.json       # Full raw scan output
├── repo-name_active.json    # Active (verified) secrets
└── repo-name_inactive.json  # Inactive (unverified) secrets
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;🧠 How it works&lt;/h3&gt;

&lt;/div&gt;


&lt;ul&gt;

&lt;li&gt;Runs TruffleHog scan on the repository&lt;/li&gt;

&lt;li&gt;Filters results using jq&lt;/li&gt;

&lt;li&gt;Masks sensitive values&lt;/li&gt;

&lt;li&gt;Splits…&lt;/li&gt;

&lt;/ul&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ja-lourenco/trufflehog-scan" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>devops</category>
      <category>security</category>
      <category>bash</category>
      <category>kubernetes</category>
    </item>
  </channel>
</rss>
