ai newsSo., 25. Okt.

SecureScope: Datenschutzorientierter Code-Security-Agent mit Gemma 2

SecureScope kombiniert Google Gemma 2, SerpApi und ElevenLabs zu einem Open-Source-KI-Agenten fuer Code-Sicherheit. Das Hacktoberfest-Projekt setzt auf lokale Modelle, um zu verhindern, dass beim schnellen Entwickeln API-Keys und vertrauliche Daten leaken.

dev.toSonntag 09:42 · 25.10.DE6 Min. Lesezeit
Bild: dev.to

Hacktoberfest Open-Source AI Challenge Woche 3: Slow and Steady Einreichung

Dieses Projekt wurde für die **Hacktoberfest 2026, Woche 3: Open-Source AI Challenge** eingereicht ( #hf26challenge ).

Im Sinne der Sloth-Philosophie von Hacktoberfest, Slow and Steady: Zu schnell zu arbeiten und dabei Dinge zu zerstören ist genau der Weg, wie API-Schlüssel leaken und Injection-Schwachstellen in Produktion gelangen. SecureScope bringt gleichmäßige, methodische und datenschutzfreundliche AI-Audits in Ihren Workflow, denn langsam und stetig gewinnt das Sicherheitsrennen.

Jeder Entwickler kennt das mulmige Gefühl, wenn man in Produktion eine unbeabsichtigte Sicherheitsschwachstelle entdeckt. Vielleicht war es ein nicht escapeter SQL-Parameter, ein geleakter API-Schlüssel in einer Konfigurationsdatei oder ein unsicherer Deserialisierungsaufruf, der die Code-Review passiert hat.

Natürlich hat die Industrie AI für die Codeanalyse entdeckt. Doch die heutigen kommerziellen AI-Code-Scanner präsentieren ein schmerzhaftes Paradox:

Um Schwachstellen in Ihrem privaten Code zu finden, müssen Sie Ihre gesamte proprietäre Codebasis in eine geschlossene Cloud eines Drittanbieters hochladen.

Für einzelne Open-Source-Entwickler, datenschutzbewusste Startups und regulierte Branchen (Fintech, Gesundheitswesen, Verteidigung) ist dies oft ein inakzeptabler Kompromiss. Ihr geistiges Eigentum wird übertragen, unterliegt den Aufbewahrungsrichtlinien Dritter, den Rate Limits des Anbieters und wiederkehrenden Abonnementrechnungen.

Ich habe SecureScope gebaut, um diesen Kompromiss zu brechen.

SecureScope ist ein Open-Source- und Local-First-Agent für Code-Sicherheitsintelligenz, der auf Google Gemma 2 basiert. Er scannt Code in über 6 Sprachen, filtert Schwachstellen mit einem Mikrosekunden-Regex-Pre-Filter vor, verifiziert Bedrohungen mithilfe spezialisierter Open-Weight-AI-Personas, verankert Funde in Live-CVE-Daten von SerpApi und erstellt Executive-Voice-Briefings mit ElevenLabs, während Ihr Quellcode strikt unter Ihrer Kontrolle bleibt.

SecureScope wurde bewusst so konstruiert, dass es Open-Weight-AI und Partnerökosysteme hervorhebt:

Der zentrale Prompt der Woche 3 lautet: Wo funktioniert ein offener Ansatz besser als ein geschlossener? Hier die direkte technische Realität:

Ja, zu 100 Prozent. Mit Ollama lädt SecureScope Google Gemma 2 einmal herunter und läuft vollständig offline:

python cli.py --path./my-project --provider ollama --model gemma2 --output all Ob Sie im Flugzeug sitzen, in einem air-gapped Labor arbeiten oder remote ohne WLAN arbeiten: Die gesamte Audit-Pipeline, von der Dateisuche über das AI-Reasoning bis zur HTML-Report-Generierung, läuft lokal auf Ihrer CPU/GPU.

Absolut. Ihr Code verlässt nie den Localhost. Keine proprietäre Logik, keine internen Datenbank-Connection-Strings und keine architektonischen Geheimnisse werden an Anbieter geschlossener Modelle übertragen oder in externen Prompt-Logs gespeichert.

Ja. Geschlossene Plattformen sperren Sie auf ihre Modellwahl ein. SecureScope verwendet eine modulare Adapter-Architektur. Möchten Sie von Google Gemma 2 zu CodeGemma wechseln oder ein eigenes Security-Fine-Tuning testen? Übergeben Sie einfach ein Flag:

python cli.py --path. --provider ollama --model codegemma Die spezialisierten Security-Prompts ( analyzer/prompts.py ) sind vollständig Open Source und lassen sich an team spezifische Coding-Standards anpassen.

Null Grenzkosten. Kommerzielle API-Audits über hochfrequente CI/CD-Pipelines können monatlich hunderte Dollar an Token-Kosten verursachen. Gemma 2 lokal oder über großzügige kostenlose Open-Model-Endpunkte zu betreiben bedeutet, dass Maintainer und Studierende unbegrenzt viele Scans für 0 Dollar ausführen können.

SecureScope vermeidet es, gesamte Repositorys brachial in ein LLM-Kontextfenster zu pressen. Stattdessen nutzt es eine effiziente Pipeline mit 5 Stufen:

┌───────────────────────────────┐ │ Target Codebase / Repo │ └──────────────┬────────────────┘ │ 1. Git-Aware File Walker (respektiert.gitignore, unterstützt --diff mode) │ ▼ 2. Regex Pre-Filter Engine (Prüft über 200 Muster; überspringt saubere Dateien) │ ▼ 3.

Google Gemma 2 Analyse (Multi-Role AI Security Agent) ┌──────────────────┼──────────────────┐ ▼ ▼ ▼ Role 1: Secrets Role 2: Injection Role 3: Auth & SSRF └──────────────────┬──────────────────┘ │ 4. Live CVE Grounding (SerpApi) (Ruft NIST NVD & MITRE CVEs ab) │ ▼ 5. OWASP Top 10 Mapping (A01:2021 bis A10:2021) │ ▼ 6.

Multi-Modal Reporting ┌──────────────────┼──────────────────┐ ▼ ▼ ▼ Rich Terminal Interactive HTML ElevenLabs Voice Dashboard Dashboard Briefing Stufe 1: Git-Aware File Traversal Der File Walker ( scanner/file_walker.py ) fragt git ls-files ab, um.gitignore-Regeln automatisch zu beachten, überspringt Build-Verzeichnisse ( node_modules, dist, venv ) und enthält einen --diff-Modus, der die im aktiven Git-Branch geänderten Dateien isoliert.

Kandidaten-Snippets werden an Google Gemma 2 ( analyzer/ai_client.py ) übergeben. Statt eines vagen Prompts weisen wir spezialisierte Security-Auditor-Personas zu:

Wenn Gemma 2 eine Schwachstelle bestätigt, ruft SecureScope SerpApi ( analyzer/cve_search.py ) auf, um die National Vulnerability Database (NVD) und MITRE CWE abzufragen:

search_query = f " { vulnerability } { language } (site:cve.mitre.org OR site:nvd.nist.gov) " Dadurch wird jeder Fund mit realen CVE-Identifikatoren, CVSS-Kontext und direkten Recherche-Links angereichert.

Die Ergebnisse werden in drei Ausgabeströme kompiliert:

Um das System zu testen, habe ich SecureScope gegen ein absichtlich verwundbares Beispiel mit einer unsicheren SQL-Abfrage laufen lassen:

def search_users ( username ): conn = sqlite3. connect ( " users.db " ) cursor = conn. cursor () # Flaw: Direct string interpolation into SQL query cursor. execute ( f " SELECT * FROM users WHERE name = ' { username } '" ) return cursor. fetchall () SecureScope Terminal-Ausgabe: ╭──────────────── #1 — SQL Injection via String Formatting ────────────────╮ │ Severity: 🔴 CRITICAL │ │ OWASP: A03:2021 — Injection │ │ Confidence: HIGH │ │ File: app.py (line 45) │ │ │ │ Description: User-controlled 'username' parameter is directly formatted │ │ into the SQL query string, allowing arbitrary SQL command execution. │ │ │ │ 💡 Fix: Use parameterized queries: │ │ cursor.execute("SELECT * FROM users WHERE name =?", (username,)) │ │ │ │ 🌐 Live CVE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html) │ ╰──────────────────────────────────────────────────────────────────────────╯ Generiertes ElevenLabs-Voice-Briefing-Transkript: "Achtung Sicherheitsteam. Dies ist Ihr automatisiertes Sicherheitsaudit-Briefing von SecureScope. Wir haben 2 Dateien in 0,1 Sekunden gescannt und 1 kritische Schwachstelle identifiziert: SQL Injection via String Formatting in app.py.

Die von der AI vorgeschlagenen Patches mit parametrisierten Abfragen wurden in Ihrem HTML-Report zusammengestellt."

git clone https://github.com/SuperSaiyan101/securescope.git cd securescope pip install -r requirements.txt 2. Sofortiger Scan (Offline, kein API-Schlüssel nötig) python cli.py --path./tests/fixtures/vulnerable_app --skip-ai --output all 3. Vollständiger AI-Scan mit Google Gemma 2 # Kostenlosen Groq API-Schlüssel für Cloud Gemma 2 setzen export GROQ_API_KEY = "gsk_..." # Windows: $env:GROQ_API_KEY="gsk_..." python cli.py --path./my-project --output all 4.

100 Prozent offline lokaler Scan mit Ollama ollama pull gemma2 python cli.py --path./my-project --provider ollama --model gemma2 --output all 5. Voice-Briefing mit ElevenLabs generieren export ELEVENLABS_API_KEY = "your_key" python cli.py --path./my-project --voice --output all CI/CD-Integration: GitHub Actions SecureScope enthält ein Plug-and-Play-Workflow (.github/workflows/securescope.yml ), um eingehende Pull Requests automatisch zu auditieren:

name: SecureScope Security Gate on: [ push, pull_request ] jobs: audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ' 3.12' - run: pip install -r requirements.txt - name: Run SecureScope Audit env: GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} run: python cli.py --path. --output all --report-file pr_report - uses: actions/upload-artifact@v4 with: name: security-report path: pr_report.html 🛠️ Wie ich es gebaut habe (Show Your Work) Dieses Projekt wurde iterativ mit OpenCode entwickelt, einem Open-Source-Terminal-Coding-Agent-Harness, der sich mit Open-Weight-LLMs verbindet.

Ein offenes Sicherheitstool mit einem offenen Agent-Harness zu bauen fühlte sich wie die ultimative Demonstration dessen an, was Open-Source-AI im Jahr 2026 möglich macht.

Was sind Ihre größten Schmerzpunkte bei modernen Code-Sicherheits-Scannern? Probieren Sie SecureScope an Ihrem Projekt aus und teilen Sie Ihre Gedanken und Ihr Feedback unten mit!

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

This project is submitted for the **Hacktoberfest 2026 — Week 3: Open-Source AI Challenge * ( #hf26challenge ).*

In the spirit of Hacktoberfest's 'Slow and Steady' sloth philosophy: moving too fast and breaking things is how API keys leak and injection flaws reach production. SecureScope brings steady, methodical, privacy-preserving AI audits to your workflow — because slow and steady wins the security race. 🦥

Every developer knows the sinking feeling of discovering an unintentional security vulnerability in production. Maybe it was an unescaped SQL parameter, a leaked API key in a configuration file, or an insecure deserialization call that slipped past code review.

Naturally, the industry has turned to AI for code analysis. But today's commercial AI code scanners present a painful paradox:

To find vulnerabilities in your private code, you must upload your entire proprietary codebase to a third-party closed-source cloud.

For individual open-source developers, privacy-conscious startups, and regulated industries (fintech, healthcare, defense), this is often an unacceptable trade-off. Your intellectual property is transferred over the wire, subject to third-party retention policies, vendor rate limits, and recurring subscription bills.

I built SecureScope to break this trade-off.

SecureScope is an open-source, local-first code security intelligence agent built with Google Gemma 2 at its core. It scans code across 6+ languages, screens vulnerabilities with a microsecond regex pre-filter, verifies threats using specialized open-weight AI personas, grounds findings in live SerpApi CVE data, and synthesizes executive voice briefings with ElevenLabs — all while keeping your source code strictly under your control.

SecureScope was intentionally engineered to highlight open-weight AI and partner ecosystems:

The core prompt for Week 3 asks: Where does an open-based approach work better than a closed one? Here is the direct engineering reality:

Yes, 100%. Using Ollama, SecureScope downloads Google Gemma 2 once and runs completely offline:

python cli.py --path./my-project --provider ollama --model gemma2 --output all Enter fullscreen mode Exit fullscreen mode Whether you are on an airplane, in an air-gapped lab, or working remotely without Wi-Fi, the entire audit pipeline — from file discovery to AI reasoning and HTML report generation — executes locally on your CPU/GPU.

Absolutely. Your code never leaves localhost. No proprietary logic, internal database connection strings, or architectural secrets are transmitted to closed-model API providers or stored in external prompt logs.

Yes. Closed platforms lock you into their choice of model. SecureScope uses a modular adapter architecture. Want to switch from Google Gemma 2 to CodeGemma, or test a custom security fine-tune? Simply pass a flag:

python cli.py --path. --provider ollama --model codegemma Enter fullscreen mode Exit fullscreen mode The specialized security prompts ( analyzer/prompts.py ) are fully open-source and customizable for team-specific coding standards.

Zero marginal cost. Running commercial API audits across high-frequency CI/CD pipelines can cost hundreds of dollars monthly in token usage. Running Gemma 2 locally or via generous free open-model endpoints means maintainers and students can run unlimited scans for $0.

SecureScope avoids brute-forcing entire repositories into an LLM context window. Instead, it utilizes an efficient 5-stage pipeline:

┌───────────────────────────────┐ │ Target Codebase / Repo │ └──────────────┬────────────────┘ │ 1. Git-Aware File Walker (respects.gitignore, supports --diff mode) │ ▼ 2. Regex Pre-Filter Engine (Screens 200+ patterns; skips clean files) │ ▼ 3.

Google Gemma 2 Analysis (Multi-Role AI Security Agent) ┌──────────────────┼──────────────────┐ ▼ ▼ ▼ Role 1: Secrets Role 2: Injection Role 3: Auth & SSRF └──────────────────┬──────────────────┘ │ 4. Live CVE Grounding (SerpApi) (Fetches NIST NVD & MITRE CVEs) │ ▼ 5. OWASP Top 10 Mapping (A01:2021 to A10:2021) │ ▼ 6.

Multi-Modal Reporting ┌──────────────────┼──────────────────┐ ▼ ▼ ▼ Rich Terminal Interactive HTML ElevenLabs Voice Dashboard Dashboard Briefing Enter fullscreen mode Exit fullscreen mode Stage 1: Git-Aware File Traversal The file walker ( scanner/file_walker.py ) queries git ls-files to automatically honor.gitignore rules, skips build directories ( node_modules, dist, venv ), and includes a --diff mode that isolates files changed in the active Git branch.

Candidate snippets are dispatched to Google Gemma 2 ( analyzer/ai_client.py ). Instead of a vague prompt, we assign specialized security auditor personas:

When Gemma 2 confirms a vulnerability, SecureScope calls SerpApi ( analyzer/cve_search.py ) to query the National Vulnerability Database (NVD) and MITRE CWE:

search_query = f " { vulnerability } { language } (site:cve.mitre.org OR site:nvd.nist.gov) " Enter fullscreen mode Exit fullscreen mode This decorates each finding with real-world CVE identifiers, CVSS context, and direct research links.

Results are compiled into three output streams:

To test the system, I ran SecureScope against a deliberately vulnerable fixture containing an unsafe SQL query:

def search_users ( username ): conn = sqlite3. connect ( " users.db " ) cursor = conn. cursor () # Flaw: Direct string interpolation into SQL query cursor. execute ( f " SELECT * FROM users WHERE name = ' { username } '" ) return cursor. fetchall () Enter fullscreen mode Exit fullscreen mode SecureScope Terminal Output: ╭──────────────── #1 — SQL Injection via String Formatting ────────────────╮ │ Severity: 🔴 CRITICAL │ │ OWASP: A03:2021 — Injection │ │ Confidence: HIGH │ │ File: app.py (line 45) │ │ │ │ Description: User-controlled 'username' parameter is directly formatted │ │ into the SQL query string, allowing arbitrary SQL command execution. │ │ │ │ 💡 Fix: Use parameterized queries: │ │ cursor.execute("SELECT * FROM users WHERE name =?", (username,)) │ │ │ │ 🌐 Live CVE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html) │ ╰──────────────────────────────────────────────────────────────────────────╯ Enter fullscreen mode Exit fullscreen mode Generated ElevenLabs Voice Briefing Transcript: "Attention security team. This is your SecureScope automated security audit briefing. We scanned 2 files in 0.1 seconds, identifying 1 critical vulnerability: SQL Injection via String Formatting in app.py.

AI-suggested parameterized query patches have been compiled in your HTML report."

git clone https://github.com/SuperSaiyan101/securescope.git cd securescope pip install -r requirements.txt Enter fullscreen mode Exit fullscreen mode 2. Instant Scan (Offline / No API Key Needed) python cli.py --path./tests/fixtures/vulnerable_app --skip-ai --output all Enter fullscreen mode Exit fullscreen mode 3. Full AI Scan with Google Gemma 2 # Set free Groq API key for cloud Gemma 2 export GROQ_API_KEY = "gsk_..." # Windows: $env:GROQ_API_KEY="gsk_..." python cli.py --path./my-project --output all Enter fullscreen mode Exit fullscreen mode 4.

100% Offline Local Scan with Ollama ollama pull gemma2 python cli.py --path./my-project --provider ollama --model gemma2 --output all Enter fullscreen mode Exit fullscreen mode 5. Generate Voice Briefing with ElevenLabs export ELEVENLABS_API_KEY = "your_key" python cli.py --path./my-project --voice --output all Enter fullscreen mode Exit fullscreen mode 🐙 CI/CD Integration: GitHub Actions SecureScope includes a drop-in workflow (.github/workflows/securescope.yml ) to automatically audit incoming Pull Requests:

name: SecureScope Security Gate on: [ push, pull_request ] jobs: audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ' 3.12' - run: pip install -r requirements.txt - name: Run SecureScope Audit env: GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} run: python cli.py --path. --output all --report-file pr_report - uses: actions/upload-artifact@v4 with: name: security-report path: pr_report.html Enter fullscreen mode Exit fullscreen mode 🛠️ How I Built It (Show Your Work) This project was developed iteratively using OpenCode, an open-source terminal coding agent harness connecting to open-weight LLMs.

Building an open security tool using an open agent harness felt like the ultimate demonstration of what open-source AI makes possible in 2026.

What are your biggest pain points with modern code security scanners? Try running SecureScope on your project, and share your thoughts and feedback below!

Originaltitel: SecureScope: Building a Privacy-First AI Code Security Agent with Google Gemma 2, SerpApi & ElevenLabsQuelle: dev.to (dev.to). Original öffnen