<?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: stackpulse-lab</title>
    <description>The latest articles on DEV Community by stackpulse-lab (@stackpulselab).</description>
    <link>https://dev.to/stackpulselab</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%2F4269035%2F317d452f-bbe0-496e-bbbd-c6f0993f6a36.png</url>
      <title>DEV Community: stackpulse-lab</title>
      <link>https://dev.to/stackpulselab</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stackpulselab"/>
    <language>en</language>
    <item>
      <title>The first 10 minutes after a secret leak: a reproducible response playbook</title>
      <dc:creator>stackpulse-lab</dc:creator>
      <pubDate>Fri, 27 Nov 2026 13:19:16 +0000</pubDate>
      <link>https://dev.to/stackpulselab/the-first-10-minutes-after-a-secret-leak-a-reproducible-response-playbook-1ec6</link>
      <guid>https://dev.to/stackpulselab/the-first-10-minutes-after-a-secret-leak-a-reproducible-response-playbook-1ec6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;By StackPulse Lab · 2026-11-27 · Tool: &lt;a href="https://github.com/stackpulse-lab/leakpulse" rel="noopener noreferrer"&gt;LeakPulse v0.4.0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every console block below comes from a real run on a plain Linux box. The demo credentials are generated at runtime; no usable secret is stored in this repository.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Rotate first. Clean up second.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git rm&lt;/code&gt;, editing &lt;code&gt;.env&lt;/code&gt;, or deleting a branch does not invalidate a key that already exists in history, logs, forks, CI caches, or screenshots. The only thing that makes the attacker's copy worthless is &lt;strong&gt;revoking or rotating it on the provider side&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;What follows is a 10-minute timeline: stop the bleeding, collect evidence, and only then clean up and add a gate.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;Goal&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;T+0&lt;/td&gt;
&lt;td&gt;Revoke / rotate&lt;/td&gt;
&lt;td&gt;Make the leaked value useless&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T+2&lt;/td&gt;
&lt;td&gt;Local history forensics&lt;/td&gt;
&lt;td&gt;Establish scope and the introducing commit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T+5&lt;/td&gt;
&lt;td&gt;Blast-radius review&lt;/td&gt;
&lt;td&gt;Decide on notifications, log review, allowlists&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T+7&lt;/td&gt;
&lt;td&gt;History rewrite (optional)&lt;/td&gt;
&lt;td&gt;Reduce spread, but never a substitute for rotation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T+9&lt;/td&gt;
&lt;td&gt;Add a gate&lt;/td&gt;
&lt;td&gt;Block the next commit locally and in CI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T+10&lt;/td&gt;
&lt;td&gt;Write it down&lt;/td&gt;
&lt;td&gt;Turn the incident into reusable checks&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  T+0: invalidate the credential before anything else
&lt;/h2&gt;

&lt;p&gt;The console path differs per provider; the action is always &lt;strong&gt;revoke&lt;/strong&gt; or &lt;strong&gt;rotate&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Credential&lt;/th&gt;
&lt;th&gt;Where to act (example)&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DeepSeek API key&lt;/td&gt;
&lt;td&gt;Platform → API Keys&lt;/td&gt;
&lt;td&gt;Create the new key before deleting the old one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aliyun AccessKey&lt;/td&gt;
&lt;td&gt;RAM console → user → AccessKey&lt;/td&gt;
&lt;td&gt;Prefer RAM roles / STS temporary credentials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tencent Cloud SecretId/Key&lt;/td&gt;
&lt;td&gt;CAM → API key management&lt;/td&gt;
&lt;td&gt;Check the bound sub-account and policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Feishu / WeCom / DingTalk webhook&lt;/td&gt;
&lt;td&gt;Group bot settings → reset&lt;/td&gt;
&lt;td&gt;The old URL dies immediately; redistribute the new one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Afdian API token&lt;/td&gt;
&lt;td&gt;Developer console&lt;/td&gt;
&lt;td&gt;Also check that the callback URL was not altered&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Do three things at the same time:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Keep a timeline.&lt;/strong&gt; Who found it, when it was revoked, when the replacement went live. You will need this for the postmortem and for any compliance review.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Export recent call logs first.&lt;/strong&gt; Deleting the key too fast can delete the evidence of abuse with it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-check least privilege.&lt;/strong&gt; Why could that key read production data? Narrowing permissions is worth more than swapping one string.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Common mistake: changing &lt;code&gt;.env&lt;/code&gt; and calling it done. &lt;code&gt;.env&lt;/code&gt; is a local copy; the leaked thing is the &lt;strong&gt;key on the server&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  T+2: forensics — look at history, not just the worktree
&lt;/h2&gt;

&lt;p&gt;Most "I already deleted it" repositories are clean in the worktree while the plaintext still sits in history. Here is a two-commit demo that reproduces exactly that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build a repo that looks "already fixed"
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mkdir -p /tmp/leak-case &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /tmp/leak-case
git init -q -b main
git config user.email demo@example.invalid
git config user.name demo

&lt;span class="c"&gt;# Generate fake credentials at runtime: this article contains no complete key literal&lt;/span&gt;
python3 - &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'PY'&lt;/span&gt;
from pathlib import Path

tail &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0123456789abcdefghij"&lt;/span&gt; * 2          &lt;span class="c"&gt;# 40 characters&lt;/span&gt;
Path&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"config.py"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.write_text&lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'DEEPSEEK_API_KEY = "sk-demo'&lt;/span&gt; + tail&lt;span class="o"&gt;[&lt;/span&gt;:28&lt;span class="o"&gt;]&lt;/span&gt; + &lt;span class="s1"&gt;'"\n'&lt;/span&gt;
    &lt;span class="s1"&gt;'ALIYUN_ACCESS_KEY_ID = "LTAI'&lt;/span&gt; + tail&lt;span class="o"&gt;[&lt;/span&gt;:16&lt;span class="o"&gt;]&lt;/span&gt; + &lt;span class="s1"&gt;'"\n'&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt;
hexish &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt; * 8 + &lt;span class="s2"&gt;"-"&lt;/span&gt; + &lt;span class="s2"&gt;"2"&lt;/span&gt; * 4 + &lt;span class="s2"&gt;"-"&lt;/span&gt; + &lt;span class="s2"&gt;"3"&lt;/span&gt; * 4 + &lt;span class="s2"&gt;"-"&lt;/span&gt; + &lt;span class="s2"&gt;"4"&lt;/span&gt; * 4 + &lt;span class="s2"&gt;"-"&lt;/span&gt; + &lt;span class="s2"&gt;"5"&lt;/span&gt; * 12
Path&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"notify.sh"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.write_text&lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'curl -s "https://open.feishu.cn/open-apis/bot/v2/hook/'&lt;/span&gt; + hexish + &lt;span class="s1"&gt;'"\n'&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt;
PY

git add -A &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit -qm &lt;span class="s2"&gt;"feat: wire up deploy notifications"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first commit hardcodes credentials in two files. Now simulate the "fix":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git rm -q config.py notify.sh
cat &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; config.py &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'EOF'&lt;/span&gt;
import os
DEEPSEEK_API_KEY &lt;span class="o"&gt;=&lt;/span&gt; os.environ&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"DEEPSEEK_API_KEY"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
ALIYUN_ACCESS_KEY_ID &lt;span class="o"&gt;=&lt;/span&gt; os.environ&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ALIYUN_ACCESS_KEY_ID"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
EOF
cat &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; notify.sh &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'EOF'&lt;/span&gt;
curl -s &lt;span class="s2"&gt;"$FEISHU_WEBHOOK"&lt;/span&gt; -H &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; -d &lt;span class="s1"&gt;'{"msg_type":"text"}'&lt;/span&gt;
EOF
git add -A &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit -qm &lt;span class="s2"&gt;"fix: stop hardcoding credentials"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The repo now looks safe. Scan the worktree, as intuition suggests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ leakpulse scan . --history 0
No potential secrets found. Scanned 2 files &lt;span class="k"&gt;in&lt;/span&gt; 0.00s.
$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clean, exit code 0. That is exactly the trap: history has not been checked.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scan history: three findings, one old commit
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ leakpulse scan . --history 20
HIGH   deepseek-key         config.py:1 @1d788669  sk-d****************4567  DeepSeek API key &lt;span class="o"&gt;(&lt;/span&gt;sk-…, same shape as OpenAI keys&lt;span class="o"&gt;)&lt;/span&gt;
HIGH   aliyun-access-key-id config.py:2 @1d788669  LTAI************cdef    Alibaba Cloud &lt;span class="o"&gt;(&lt;/span&gt;Aliyun&lt;span class="o"&gt;)&lt;/span&gt; AccessKey ID
HIGH   feishu-webhook       notify.sh:1 @1d788669  1111****************5555 Feishu/Lark bot webhook token

3 potential secrets found &lt;span class="o"&gt;(&lt;/span&gt;3 high, 0 medium, 0 low&lt;span class="o"&gt;)&lt;/span&gt; Scanned 2 files and 2 commits &lt;span class="k"&gt;in&lt;/span&gt; 0.01s.
$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three things matter here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Commit id&lt;/strong&gt; (&lt;code&gt;@1d788669&lt;/code&gt;): the introducing commit, which tells you who to notify and what to review;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File and line&lt;/strong&gt;: the original context, without guessing;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Masked value&lt;/strong&gt;: only the first and last four characters survive, so the output is safe to paste into a ticket or chat without leaking again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Exit code &lt;code&gt;1&lt;/code&gt; means findings at or above &lt;code&gt;--fail-on high&lt;/code&gt; (the default), which is exactly what a CI gate needs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: &lt;code&gt;--history N&lt;/code&gt; walks the last N commits of the &lt;strong&gt;current branch&lt;/strong&gt; (&lt;code&gt;git rev-list --max-count=N HEAD&lt;/code&gt;). Multi-branch repos need the extra pass shown in T+7.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  One scan, three deliverables
&lt;/h3&gt;

&lt;p&gt;Incident response usually serves three audiences: engineers read the terminal, CI consumes SARIF, reviewers and auditors want HTML.&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;# Machine-readable: feed a ticket system or a triage script&lt;/span&gt;
leakpulse scan . --history 500 --format json --output leak.json

&lt;span class="c"&gt;# SARIF 2.1.0: upload to GitHub Code Scanning&lt;/span&gt;
leakpulse scan . --history 500 --format sarif --output leak.sarif

&lt;span class="c"&gt;# Single-file HTML: no JS, no remote assets, masked values, safe as an attachment&lt;/span&gt;
leakpulse scan . --history 500 --format html --output leak.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All three share one result set and one exit code, so the terminal and the report cannot disagree.&lt;/p&gt;

&lt;p&gt;Turn JSON into a ticket list with nothing but the standard library:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 - &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'PY'&lt;/span&gt;
import json
&lt;span class="k"&gt;for&lt;/span&gt; f &lt;span class="k"&gt;in&lt;/span&gt; json.load&lt;span class="o"&gt;(&lt;/span&gt;open&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"leak.json"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"findings"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;:
    print&lt;span class="o"&gt;(&lt;/span&gt;f&lt;span class="s1"&gt;'{f["severity"]}\t{f["rule"]}\t{f["path"]}:{f.get("line")}\t{f.get("commit", "-")}'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
PY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;high    deepseek-key          config.py:1   1d788669
high    aliyun-access-key-id  config.py:2   1d788669
high    feishu-webhook        notify.sh:1   1d788669
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  T+5: blast radius, not just a finding count
&lt;/h2&gt;

&lt;p&gt;A count is not a risk assessment. Work through these in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Is the credential still valid?&lt;/strong&gt; If you rotated at T+0, the remaining risk is "history is readable", not "usable right now".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is the repo public or private?&lt;/strong&gt; Treat a public repo as fully leaked; private repos still need fork, collaborator and CI-log review.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What could the key do?&lt;/strong&gt; Read-only or write? Production database, object storage, message queue?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where else did it appear?&lt;/strong&gt; CI variables, container layers, build artifacts, issue screenshots, local &lt;code&gt;.env&lt;/code&gt; backups. LeakPulse scans the repository only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does it trigger an external obligation?&lt;/strong&gt; Customer-data notifications, a cloud vendor ticket, audit records.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Write the conclusion as one sentence, for example:&lt;br&gt;
"One DeepSeek key (read-only, quota-limited) + one Aliyun AK (write access to OSS) + one Feishu webhook; rotated; public history still contains the old values; no anomalous calls."&lt;/p&gt;


&lt;h2&gt;
  
  
  T+7: history rewrite is optional, and it has a price
&lt;/h2&gt;

&lt;p&gt;A rewrite reduces spread, but it is &lt;strong&gt;not a security boundary&lt;/strong&gt;: any clone, fork or CI cache that already exists will not disappear.&lt;/p&gt;

&lt;p&gt;If the team decides to rewrite anyway:&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;# Requires a separate install of git-filter-repo; never run this on an unbacked-up repo&lt;/span&gt;
git filter-repo --path config.py --path notify.sh --invert-paths

&lt;span class="c"&gt;# Re-add the remote and force-push all branches and tags (everyone must re-clone)&lt;/span&gt;
git remote add origin &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;repo-url&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
git push --force --all
git push --force --tags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before running it, confirm:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;every collaborator knows and will re-clone (otherwise the old history gets pushed right back);&lt;/li&gt;
&lt;li&gt;evidence is archived (commit ids, reports, timeline);&lt;/li&gt;
&lt;li&gt;platform-side caches, forks and PR refs are handled separately;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the old credential was already rotated&lt;/strong&gt; — without that, a rewrite is only psychological comfort.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For most small teams the cheaper order is: &lt;strong&gt;rotate → add a gate → schedule the rewrite&lt;/strong&gt;, not the other way around.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cover every branch (&lt;code&gt;--history&lt;/code&gt; follows the current branch only)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; ref &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;git for-each-ref --format=&lt;span class="s1"&gt;'%(refname:short)'&lt;/span&gt; refs/heads refs/tags&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  git checkout -q --detach &lt;span class="s2"&gt;"$ref"&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"== $ref =="&lt;/span&gt;
  leakpulse scan . --history 500 --quiet &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"!! findings at $ref"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
git checkout -q main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it on a clean worktree; &lt;code&gt;git stash&lt;/code&gt; first if you have local changes.&lt;/p&gt;




&lt;h2&gt;
  
  
  T+9: prevention — put the check before the commit
&lt;/h2&gt;

&lt;p&gt;The most common second incident is "we added a rule but nobody runs it". A gate needs two properties: &lt;strong&gt;on by default&lt;/strong&gt; and &lt;strong&gt;fail closed&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: pre-commit (local, fastest feedback)
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;.pre-commit-config.yaml&lt;/code&gt;:&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="na"&gt;repos&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://github.com/stackpulse-lab/leakpulse&lt;/span&gt;
    &lt;span class="na"&gt;rev&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v0.4.0&lt;/span&gt;
    &lt;span class="na"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;leakpulse&lt;/span&gt;          &lt;span class="c1"&gt;# staged changes only, blocks the commit
&lt;/span&gt;      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;leakpulse-worktree&lt;/span&gt; &lt;span class="c1"&gt;# whole tree, no history
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pipx install pre-commit
pre-commit install
pre-commit run --all-files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No pre-commit? Use the built-in hook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;leakpulse install-hook
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Measured blocking behavior (stage a fake GitHub token, then commit):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ git commit -m &lt;span class="s2"&gt;"oops"&lt;/span&gt;
HIGH   github-token  bad.py:1  ghp_****************1234  GitHub token &lt;span class="o"&gt;(&lt;/span&gt;classic app/OAuth/refresh&lt;span class="o"&gt;)&lt;/span&gt;

1 potential secret found &lt;span class="o"&gt;(&lt;/span&gt;1 high, 0 medium, 0 low&lt;span class="o"&gt;)&lt;/span&gt; Scanned 1 file &lt;span class="k"&gt;in&lt;/span&gt; 0.01s.
$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The commit is rejected, the file stays staged, and you fix it before retrying.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The hook is &lt;strong&gt;fail-closed&lt;/strong&gt;: if &lt;code&gt;leakpulse&lt;/code&gt; is not on &lt;code&gt;PATH&lt;/code&gt;, it fails instead of silently allowing the commit.&lt;br&gt;
With a virtualenv, activate it before committing, or set &lt;code&gt;LEAKPULSE_SRC&lt;/code&gt; inside the hook.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Option 2: CI gate + Code Scanning (team, cannot be skipped)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secret-scan&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;push&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;pull_request&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
  &lt;span class="na"&gt;security-events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;scan&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;stackpulse-lab/leakpulse@v0.4.0&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"."&lt;/span&gt;
          &lt;span class="na"&gt;history&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"100"&lt;/span&gt;
          &lt;span class="na"&gt;fail-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;high&lt;/span&gt;
          &lt;span class="na"&gt;format&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sarif&lt;/span&gt;
          &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;leakpulse.sarif&lt;/span&gt;
        &lt;span class="na"&gt;continue-on-error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github/codeql-action/upload-sarif@v3&lt;/span&gt;
        &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;always()&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;sarif_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;leakpulse.sarif&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;history: "100"&lt;/code&gt; lets CI catch secrets that were committed once and removed later;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;continue-on-error: true&lt;/code&gt; plus &lt;code&gt;if: always()&lt;/code&gt; keeps the SARIF report flowing into the Security tab even when the gate fails;&lt;/li&gt;
&lt;li&gt;to observe before enforcing, set &lt;code&gt;fail-on: never&lt;/code&gt; for a week, then tighten it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Three cheap policies
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Allow test fixtures explicitly&lt;/strong&gt;: append &lt;code&gt;# leakpulse:allow&lt;/code&gt; to the line instead of excluding all of &lt;code&gt;tests/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Placeholders only in examples&lt;/strong&gt;: &lt;code&gt;.env.example&lt;/code&gt; should say &lt;code&gt;your-key-here&lt;/code&gt;, never a real value with one character changed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rotate on a schedule&lt;/strong&gt;: put quarterly rotation on the calendar. Leaks are passive; rotation is active.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  T+10: postmortem checklist (copy into your incident template)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Credential revoked/rotated server-side; replacement verified working&lt;/li&gt;
&lt;li&gt;[ ] Call logs exported and reviewed for unusual sources or volume&lt;/li&gt;
&lt;li&gt;[ ] Scope confirmed: files, commits, branches, public or private&lt;/li&gt;
&lt;li&gt;[ ] Blast radius assessed: permissions, data, customers, obligations&lt;/li&gt;
&lt;li&gt;[ ] Evidence archived: commit ids, reports (JSON/SARIF/HTML), timeline&lt;/li&gt;
&lt;li&gt;[ ] Local hook or CI gate enabled and actually tested against a real block&lt;/li&gt;
&lt;li&gt;[ ] History rewrite scheduled, or explicitly declined with a recorded reason&lt;/li&gt;
&lt;li&gt;[ ] Write-up filed so the next drill has a baseline&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Appendix: the 10-minute command card
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1) Forensics: worktree + last 500 commits&lt;/span&gt;
leakpulse scan . --history 500

&lt;span class="c"&gt;# 2) Three deliverables&lt;/span&gt;
leakpulse scan . --history 500 --format json  --output leak.json
leakpulse scan . --history 500 --format sarif --output leak.sarif
leakpulse scan . --history 500 --format html  --output leak.html

&lt;span class="c"&gt;# 3) Local gate&lt;/span&gt;
leakpulse install-hook

&lt;span class="c"&gt;# 4) Self-check&lt;/span&gt;
leakpulse scan . --history 0 --fail-on high
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;LeakPulse is MIT-licensed, has zero third-party dependencies, and runs entirely locally: no network, no uploads, no telemetry. It cannot tell whether a key is still valid, and it is not a SAST replacement — &lt;strong&gt;rotate on discovery&lt;/strong&gt; is the most important advice it can give.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Repository: &lt;a href="https://github.com/stackpulse-lab/leakpulse" rel="noopener noreferrer"&gt;https://github.com/stackpulse-lab/leakpulse&lt;/a&gt; · Questions and ideas: open an issue.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>git</category>
      <category>python</category>
    </item>
  </channel>
</rss>
