<?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: FLOURISH </title>
    <description>The latest articles on DEV Community by FLOURISH  (@cybwithflourish).</description>
    <link>https://dev.to/cybwithflourish</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%2F1191551%2F05dd5eba-9e3b-4bd7-a46b-c128126378b5.png</url>
      <title>DEV Community: FLOURISH </title>
      <link>https://dev.to/cybwithflourish</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cybwithflourish"/>
    <language>en</language>
    <item>
      <title>G4ENV: THE LAZY SECRET HUNTER THAT NEVER LEAVES YOUR LAPTOP</title>
      <dc:creator>FLOURISH </dc:creator>
      <pubDate>Wed, 21 Oct 2026 19:54:46 +0000</pubDate>
      <link>https://dev.to/cybwithflourish/g4env-5ggp</link>
      <guid>https://dev.to/cybwithflourish/g4env-5ggp</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;g4env&lt;/strong&gt; is a terminal-native security auditor that hunts for exposed secrets in your &lt;code&gt;.env&lt;/code&gt; files, config files, CI/CD pipelines, and codebases, so you don't have to.&lt;/p&gt;

&lt;p&gt;Checking a project for leaked credentials by hand means grepping, squinting at YAML, and hoping you remembered to add &lt;code&gt;.env&lt;/code&gt; to &lt;code&gt;.gitignore&lt;/code&gt;. g4env replaces all of that with one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;g4env audit &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It doesn't just flag problems. It hands you a remediation plan: what leaked, why it matters, and what to fix first. It's built for the developer who wants to set up a check once (pre-commit or CI) and forget about it until it catches something.&lt;/p&gt;

&lt;p&gt;It's also different from GitHub secret scanning. GitHub blocks known provider key formats on their way to GitHub. g4env is a linter for configuration that runs &lt;em&gt;before anything leaves your machine&lt;/em&gt;, and it catches things GitHub has no opinion on: your internal Postgres password, a real key pasted into &lt;code&gt;.env.example&lt;/code&gt;, a hardcoded &lt;code&gt;Authorization&lt;/code&gt; header, a literal secret in a CI workflow, or a &lt;code&gt;.env&lt;/code&gt; file that was never added to &lt;code&gt;.gitignore&lt;/code&gt;. The strongest setup uses both.&lt;/p&gt;
&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;g4env is a CLI, so the demo is one command. The repo ships fixtures that trigger every rule, so you can see it work with no model, no API key, and no network:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/CYBWithFlourish/g4env.git
&lt;span class="nb"&gt;cd &lt;/span&gt;g4env
python &lt;span class="nt"&gt;-m&lt;/span&gt; venv .venv &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate
python &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;".[dev]"&lt;/span&gt;
g4env audit examples
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;(It isn't on PyPI yet, so you run it from a clone.)&lt;/p&gt;

&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;g4env 1.0.0  |  target: examples
provider: rules (offline)  |  model: -  |  schema: 1.0
files scanned: 10  |  duration: 9 ms
risk score: 100/100

17 finding(s): 1 critical, 11 high, 5 medium.

  [CRITICAL] env.private-key  keys/deploy_key.txt:5
    Private key embedded in configuration
    ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And here's what a finding looks like on a typical project. Note that secret values are masked in the output:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  [HIGH] env.raw-secret  .env:2
    Raw API token detected
    A plaintext Stripe key was found assigned to STRIPE_API_KEY.
    evidence  STRIPE_API_KEY=sk_live_****
    impact    Exposed credentials can lead to unauthorized service access.
    fix       Move secrets to a secure secret manager or environment store.

Next steps
  1. Rotate every credential that is stored in plaintext; assume it has already leaked through version control history.
  2. Move the values into a secret manager or your platform's encrypted environment store and reference them with a variable.
  3. Add the .env files to .gitignore, remove them from the index and purge them from the git history.
  4. Re-run `g4env audit .` to confirm that the remediation worked.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&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/CYBWithFlourish" rel="noopener noreferrer"&gt;
        CYBWithFlourish
      &lt;/a&gt; / &lt;a href="https://github.com/CYBWithFlourish/g4env" rel="noopener noreferrer"&gt;
        g4env
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A fast, offline-first CLI tool for auditing .env files, configuration schemas, and codebases for hardcoded credentials, secret leaks, and security anti-patterns using deterministic rules and local Gemma models.
    &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;g4env - Gemma 4 Environment Security&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Catch exposed secrets before they become security vulnerabilities.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;g4env&lt;/code&gt; is a local-first, terminal-native security auditing tool designed to help developers identify exposed credentials, hardcoded secrets, and insecure environment configurations before they become a problem.&lt;/p&gt;

&lt;p&gt;It scans &lt;code&gt;.env&lt;/code&gt; files, configuration files, CI/CD pipeline definitions, and codebases for potential security risks, including API keys, private keys, database credentials, weak passwords, and other sensitive values that should never be exposed or committed to version control.&lt;/p&gt;

&lt;p&gt;By combining fast, deterministic rule-based detection with optional AI-powered contextual analysis through locally running Gemma models, &lt;code&gt;g4env&lt;/code&gt; helps developers identify security issues while maintaining control over their sensitive configuration data.&lt;/p&gt;

&lt;p&gt;Unlike tools that require cloud-based analysis by default, &lt;code&gt;g4env&lt;/code&gt; is designed to work offline out of the box. Its default rule-based auditing engine makes no network requests, while its optional Ollama integration enables deeper analysis using models running on your own machine.&lt;/p&gt;

&lt;p&gt;…&lt;/p&gt;&lt;/div&gt;


&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/CYBWithFlourish/g4env" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Licensed GPL-3.0-or-later. Docs for providers, rules, and CI wiring are in the repo's &lt;code&gt;docs/&lt;/code&gt; folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;g4env is a Python CLI with a layered design:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic rules first.&lt;/strong&gt; Nine rules cover raw vendor keys (AWS, GitHub, GitLab, Google, OpenAI, Anthropic, Stripe, Slack and more), embedded private keys, database URLs with passwords, weak passwords, real secrets in template files, high-entropy strings, hardcoded &lt;code&gt;Authorization&lt;/code&gt; headers, literal secrets in CI files, and &lt;code&gt;.env&lt;/code&gt; files not excluded from version control. These run instantly with zero network requests, on any machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optional local Gemma on top.&lt;/strong&gt; With &lt;code&gt;--provider ollama&lt;/code&gt;, g4env sends redacted content to a Gemma model running on your own machine through Ollama (&lt;code&gt;gemma2:2b&lt;/code&gt; by default). The model adds contextual findings that regexes can't catch, like an internal bearer token with no recognizable format.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama pull gemma2:2b
g4env audit &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--provider&lt;/span&gt; ollama   &lt;span class="c"&gt;# rules + local Gemma reasoning&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No GPU? No problem.&lt;/strong&gt; Not every machine can run local inference, so g4env also supports an opt-in hosted provider through the Gemini API:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;
g4env audit &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--provider&lt;/span&gt; gemini   &lt;span class="c"&gt;# rules + hosted Gemini reasoning&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key is read from the environment and is never accepted as a command-line flag. Only redacted content is sent, and the report records that a network call happened (&lt;code&gt;"offline": false&lt;/code&gt;, &lt;code&gt;"network_scope": "remote"&lt;/code&gt;). So there are three tiers: rules only (zero network, the default), local Gemma via Ollama (localhost only), and hosted Gemini (remote, explicit opt-in).&lt;/p&gt;

&lt;p&gt;A few other design decisions worth calling out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Redaction on the way out and on the way in.&lt;/strong&gt; Secrets are masked in terminal output by default, and redacted again before any content reaches a model, so a screenshot or CI log never becomes a new leak.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Schema-validated reports.&lt;/strong&gt; Every report follows a versioned JSON schema and is validated before it's written, so you can diff it, store it, and gate CI on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI-friendly exit codes.&lt;/strong&gt; &lt;code&gt;--fail-on high&lt;/code&gt; (the default) exits with code 3 when a finding meets the threshold, so g4env works as a pipeline gate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Respects your ignore rules.&lt;/strong&gt; Directory scans honor &lt;code&gt;.gitignore&lt;/code&gt; and a &lt;code&gt;.g4envignore&lt;/code&gt; file, and skip vendored dependencies, build output, and binaries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measurable quality.&lt;/strong&gt; &lt;code&gt;g4env bench&lt;/code&gt; runs a labelled test set so detection quality can be compared across providers instead of guessed at.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The project also ships with automated tests, linting, type-checking, and a CI workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;A secret scanner has an awkward property: &lt;strong&gt;the thing it analyzes is your secrets.&lt;/strong&gt; Sending &lt;code&gt;.env&lt;/code&gt; files to a closed API in order to find leaked credentials is a bit like mailing your house key to a locksmith to check whether your lock is weak.&lt;/p&gt;

&lt;p&gt;An open-weight model changes that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nothing leaves your machine.&lt;/strong&gt; With Gemma on Ollama, analysis stays on localhost, and the report says so (&lt;code&gt;"network_scope": "localhost-only"&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It works air-gapped.&lt;/strong&gt; Auditing proprietary code doesn't require uploading it anywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It costs nothing per scan,&lt;/strong&gt; so there's no reason not to run it on every commit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's swappable.&lt;/strong&gt; The &lt;code&gt;--model&lt;/code&gt; flag lets you change models without touching the tool, and you can point &lt;code&gt;--host&lt;/code&gt; at any Ollama server you control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's a real trade-off, and I'd rather state it than hide it: a small local model reasons less well than a large hosted one, and not everyone has hardware that can run one. That's why the deterministic rules run first and work everywhere, with local Gemma as the private upgrade and hosted Gemini as a clearly labelled opt-in for people who want more reasoning power without a GPU. The open-weight path is what makes the privacy-first default possible, and the hosted path is there when convenience matters more. With open models that choice is yours. With a closed API, it's made for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;p&gt;The goal was to turn a tedious manual audit into a command you run once and trust. Pointed at the bundled demo fixtures, g4env scans 10 files and surfaces 17 findings (1 critical, 11 high, 5 medium) in about 9 milliseconds, each with a severity, the exact file and line, and a concrete fix. The "next steps" list at the end of every report means you never have to work out what to do after a finding. Wire &lt;code&gt;g4env audit&lt;/code&gt; into pre-commit or CI and the check runs on every change without you thinking about it again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Gemma:&lt;/strong&gt; g4env runs Gemma locally through Ollama to add contextual secret detection on top of its deterministic rules, keeping sensitive configuration on the user's own machine.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>gemma</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
