<?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: Wang Donghui</title>
    <description>The latest articles on DEV Community by Wang Donghui (@donhui).</description>
    <link>https://dev.to/donhui</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%2F491194%2F529886e0-f351-481a-8fd2-3d564404f88d.jpeg</url>
      <title>DEV Community: Wang Donghui</title>
      <link>https://dev.to/donhui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/donhui"/>
    <language>en</language>
    <item>
      <title>Stop Shipping Secrets in Jenkins: A Look at Secret Guard</title>
      <dc:creator>Wang Donghui</dc:creator>
      <pubDate>Fri, 29 May 2026 08:12:06 +0000</pubDate>
      <link>https://dev.to/donhui/stop-shipping-secrets-in-jenkins-a-look-at-secret-guard-4l9a</link>
      <guid>https://dev.to/donhui/stop-shipping-secrets-in-jenkins-a-look-at-secret-guard-4l9a</guid>
      <description>&lt;h1&gt;
  
  
  Stop Shipping Secrets in Jenkins: A Look at Secret Guard
&lt;/h1&gt;

&lt;p&gt;If you’ve run Jenkins for long enough, you’ve probably seen this happen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a token hardcoded in a Jenkinsfile&lt;/li&gt;
&lt;li&gt;a password hidden in a job config&lt;/li&gt;
&lt;li&gt;an API key passed through a command line&lt;/li&gt;
&lt;li&gt;a webhook URL with sensitive data baked into it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this usually starts as a security incident. It starts as a shortcut.&lt;/p&gt;

&lt;p&gt;That’s why I wanted to highlight &lt;code&gt;jenkinsci/secret-guard-plugin&lt;/code&gt;, a Jenkins plugin focused on detecting hardcoded secret leakage risks in jobs and Pipeline definitions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Secret Guard is trying to solve
&lt;/h2&gt;

&lt;p&gt;Jenkins has a long memory. Job configuration, Pipeline definitions, and build settings can all become places where secrets accidentally persist.&lt;/p&gt;

&lt;p&gt;Secret Guard is designed to catch those patterns early, especially in places that traditional repo scanners may miss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;job &lt;code&gt;config.xml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;inline Pipeline scripts&lt;/li&gt;
&lt;li&gt;Pipeline-from-SCM Jenkinsfiles&lt;/li&gt;
&lt;li&gt;multibranch Jenkinsfiles&lt;/li&gt;
&lt;li&gt;parameter defaults&lt;/li&gt;
&lt;li&gt;environment variable definitions&lt;/li&gt;
&lt;li&gt;command content in &lt;code&gt;sh&lt;/code&gt;, &lt;code&gt;bat&lt;/code&gt;, &lt;code&gt;powershell&lt;/code&gt;, and HTTP-style requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It does not try to be a general-purpose code scanner. It focuses on high-risk secret exposure patterns that show up again and again in Jenkins.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;The plugin supports a few useful modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;AUDIT&lt;/code&gt;: record findings, do not block&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WARN&lt;/code&gt;: allow saves, but mark builds unstable when findings exist&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;BLOCK&lt;/code&gt;: block unexempted high-severity findings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;job-level &lt;code&gt;Scan Now&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;global &lt;code&gt;Scan All Jobs&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;lightweight reads for Pipeline-from-SCM and multibranch Jenkinsfiles&lt;/li&gt;
&lt;li&gt;masked latest-result persistence&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That makes it practical both for teams just starting to clean up and for teams that want stronger enforcement.&lt;/p&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%2Fcs12902368xpg7qo7vvw.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%2Fcs12902368xpg7qo7vvw.png" alt=" " width="800" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A simple example
&lt;/h2&gt;

&lt;p&gt;Here is the kind of thing you want to avoid:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;API_TOKEN = 'ghp_exampleplaintexttoken'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And here is the better pattern:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;withCredentials([string(credentialsId: 'api-token', variable: 'API_TOKEN')])&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Secret Guard is basically there to push you toward the second pattern.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I like it
&lt;/h2&gt;

&lt;p&gt;What makes this plugin interesting is that it is Jenkins-native.&lt;/p&gt;

&lt;p&gt;It understands Jenkins-specific places where secrets tend to leak, instead of only looking at source code. That matters in real-world CI/CD systems, where the risk often lives in configuration, not just in git.&lt;/p&gt;

&lt;p&gt;It also stores only masked latest-result data, which is exactly what you want from a security tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who should try it
&lt;/h2&gt;

&lt;p&gt;I’d recommend Secret Guard if you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run Jenkins in a team or enterprise setup&lt;/li&gt;
&lt;li&gt;have lots of older jobs or mixed Pipeline styles&lt;/li&gt;
&lt;li&gt;want guardrails against accidental secret exposure&lt;/li&gt;
&lt;li&gt;prefer a lightweight, Jenkins-specific security layer&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;Secret leaks in CI are often boring, repetitive, and easy to miss.&lt;/p&gt;

&lt;p&gt;That is exactly why they deserve boring, repetitive protection.&lt;/p&gt;

&lt;p&gt;If your Jenkins instance has grown beyond a handful of trusted jobs, Secret Guard is worth a look.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/jenkinsci/secret-guard-plugin" rel="noopener noreferrer"&gt;https://github.com/jenkinsci/secret-guard-plugin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Jenkins plugin page: &lt;a href="https://plugins.jenkins.io/secret-guard/" rel="noopener noreferrer"&gt;https://plugins.jenkins.io/secret-guard/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>jenkins</category>
      <category>devops</category>
      <category>security</category>
      <category>cicd</category>
    </item>
  </channel>
</rss>
