Skip to content

Youranalyst-coder/gitagent-securebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ GitAgent SecureBot

AI-powered security scanner & auto-fixer that finds vulnerabilities β€” and writes the patches itself.

Built for the Lzyr Builder Challenge using GitAgent.

Deploy with Vercel Deploy to Netlify Open in GitHub Codespaces

Built with GitAgent Next.js TypeScript License: MIT

🎬 Live Demo Β· πŸš€ Quick Start Β· 🧠 Architecture Β· 🩹 Demo Flow Β· πŸ“ Design Decisions


⚑ TL;DR

You paste a GitHub repo URL (or click demo for zero-setup). SecureBot β€” a multi-agent system on the GitAgent SDK β€” scans for OWASP Top 10 vulnerabilities, hardcoded secrets, and known CVEs. Findings stream live to your browser. Click any finding and a second agent generates a minimal, secure patch with a side-by-side diff.

Repo URL ──▢ πŸ” Scanner Agent ──▢ Findings (live SSE) ──▢ 🩹 Click "Auto-Fix" ──▢ Fixer Agent ──▢ Diff

πŸ’‘ Live mode uses Lyzr / OpenAI / Anthropic via the GitAgent SDK with custom tools, hooks, skills, and a multi-agent workflow. Demo mode ships scripted output so anyone can experience the full UX in 60 seconds with zero setup.


🎯 Why this submission stands out

The challenge rewards execution, creativity, product thinking, speed of shipping, and agent workflow design. SecureBot hits each:

Criterion How SecureBot delivers
πŸ›  Execution A working full-stack product, not a sketch. Real custom tools, real hooks, real CWE mappings, real fix templates. Builds clean, deploys in one click.
✨ Creativity Two-agent pipeline (Scanner β†’ Fixer) glued by a workflow YAML. Tool-anchored LLM pattern β€” regex rules find anchors, LLM does the reasoning. Fast, reliable, structured output.
🎯 Product thinking DEMO_MODE=true β†’ 60-second zero-key demo. OPENAI_API_KEY set β†’ live agent mode. One-click deploy buttons for Vercel, Netlify, Codespaces.
⏱ Speed of shipping Single Next.js codebase (no Python bridge), shipped in hours. CI passes on every commit. Production-ready Dockerfile + multi-cloud configs.
🧬 Agent workflow design Uses every GitAgent primitive: SDK query(), tool(), programmatic hooks, declarative tools (YAML + shell), skills, workflows, memory, identity files (SOUL/RULES/DUTIES), compliance config, multi-model fallback.

🎬 Live Demo

Zero-config: click any deploy button above ‴︎ β€” defaults to demo mode, no keys needed.

The flow you see in 60 seconds:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ›‘οΈ SecureBot                                  GitAgent β†—  Source β†—  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                      β”‚
β”‚              Your codebase has bugs.                                 β”‚
β”‚              SecureBot finds them. And fixes them.                   β”‚
β”‚                                                                      β”‚
β”‚      [ github.com/org/repo  or  'demo'        ] [β–Ά Scan with…  ]    β”‚
β”‚                                                                      β”‚
β”‚       Try:  [Demo (vulnerable Node.js)]  [OWASP Juice Shop]  …      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

After clicking β–Ά Scan:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Agent stream (live)             β”‚ Findings (7)                     β”‚
β”‚ ─────────────────────           β”‚ ────────────────────             β”‚
β”‚ ● ● ●  gitagent Β· live          β”‚  [CRITICAL] CWE-798              β”‚
β”‚                                 β”‚  Hardcoded OpenAI Key  🩹 Auto-Fixβ”‚
β”‚ [tool_call] find_secrets        β”‚                                  β”‚
β”‚ [finding]  CRITICAL  CWE-798    β”‚  [CRITICAL] CWE-89               β”‚
β”‚ [tool_call] scan_file           β”‚  SQL Injection         🩹 Auto-Fixβ”‚
β”‚ [finding]  CRITICAL  CWE-89     β”‚                                  β”‚
β”‚ [finding]  CRITICAL  CWE-78     β”‚  [HIGH]     CWE-79               β”‚
β”‚ [finding]  HIGH      CWE-338    β”‚  DOM XSS               🩹 Auto-Fixβ”‚
β”‚ [summary]  7 findings Β· 3.4s    β”‚   ↓ click Auto-Fix              β”‚
β”‚                                 β”‚  β”Œβ”€ before β”€β”β”Œβ”€ after ─┐         β”‚
β”‚ Generating summary…             β”‚  β”‚vulnerableβ”‚β”‚ secure  β”‚         β”‚
β”‚                                 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Option A β€” One-click cloud deploy

Platform Action
Vercel Deploy
Netlify Deploy
GitHub Codespaces Open

Option B β€” Local dev (3 commands)

git clone https://github.com/Youranalyst-coder/gitagent-securebot.git
cd gitagent-securebot
npm install --ignore-scripts && npm run dev

Open http://localhost:3000 β†’ click "Scan with SecureBot".

The --ignore-scripts flag avoids an unrelated postinstall in @googleworkspace/cli (not used by SecureBot). The app itself works perfectly.

Option C β€” Docker

docker compose up --build
# β†’ http://localhost:3000

Option D β€” Live Mode (Real GitAgent SDK)

cp .env.example .env.local
# Edit .env.local:
#   DEMO_MODE=false
#   OPENAI_API_KEY=sk-...        (or LYZR_API_KEY, or ANTHROPIC_API_KEY)
npm run dev

Now SecureBot uses the actual GitAgent SDK β€” runs custom tools, fires hooks, the works.


🧠 Architecture

flowchart TB
    User[πŸ‘€ User<br/>browser] -->|repo URL| FE[πŸ–₯ Next.js Frontend<br/>app/scan/page.tsx]

    FE -->|POST /api/scan| API1[πŸ“‘ Scan API Route<br/>SSE stream]
    API1 -->|SDK query| Scanner[πŸ” Scanner Agent<br/>skills/scan-security]

    Scanner -->|custom tools| Tools1[πŸ›  scan_file<br/>find_secrets<br/>check_deps]
    Scanner -->|preToolUse hook| Audit[πŸͺ Audit Hook<br/>blocks rm -rf, etc.]
    Scanner -->|finding blocks| API1
    API1 -->|SSE events| FE

    FE -->|click 🩹 Fix β†’ POST /api/fix| API2[πŸ“‘ Fix API Route<br/>SSE stream]
    API2 -->|SDK query| Fixer[🩹 Fixer Agent<br/>skills/fix-vulnerability]
    Fixer -->|generate_fix tool| Tools2[πŸ’Š Canonical CWE<br/>fix templates]
    Fixer -->|fix block| API2
    API2 -->|SSE events| FE

    subgraph AgentRepo ["πŸ“ agent/ β€” the agent IS a git repo"]
        SOUL[SOUL.md<br/>identity]
        RULES[RULES.md<br/>safety]
        DUTIES[DUTIES.md<br/>scope]
        AGENT[agent.yaml<br/>model + compliance]
        SKILL1[skills/scan-security]
        SKILL2[skills/fix-vulnerability]
        WORK[workflows/scan-and-fix.yaml]
        DECL[tools/grep-secrets.yaml]
        HOOKS[hooks/audit.sh]
        MEM[memory/MEMORY.md]
    end

    Scanner -.identity.- SOUL
    Scanner -.skill.- SKILL1
    Fixer -.skill.- SKILL2

    style User fill:#0d1117,stroke:#58a6ff,color:#fff
    style FE fill:#21262d,stroke:#58a6ff,color:#fff
    style Scanner fill:#1f6feb,stroke:#58a6ff,color:#fff
    style Fixer fill:#3fb950,stroke:#3fb950,color:#fff
    style Tools1 fill:#21262d,stroke:#bc8cff,color:#fff
    style Tools2 fill:#21262d,stroke:#bc8cff,color:#fff
    style Audit fill:#21262d,stroke:#f85149,color:#fff
Loading

🧩 GitAgent primitives β€” coverage matrix

GitAgent Primitive Where in this project What it does
SDK query() lib/gitagent-client.ts Streams agent events to SSE
SDK tool() lib/tools/*.ts (4 tools) Custom security scanners
Programmatic hooks lib/hooks.ts preToolUse blocks rm -rf, audits everything
Declarative tool agent/tools/grep-secrets.yaml + .sh Shell-script tool from YAML
Script hook agent/hooks/audit.sh Filesystem audit log
Skills agent/skills/{scan-security,fix-vulnerability}/SKILL.md Composable instruction modules
Workflow agent/workflows/scan-and-fix.yaml Chains Scanner β†’ Fixer
Identity files agent/{SOUL,RULES,DUTIES}.md Personality, constraints, scope
Memory agent/memory/MEMORY.md Git-committed, append-only
Compliance agent.yaml β†’ compliance: block risk_level: high, audit logging
Multi-model fallback agent.yaml β†’ model.fallback Lyzr β†’ OpenAI β†’ Anthropic
Cost tracking UI status bar Surfaced from query.costs()

πŸ” Vulnerabilities detected

Each finding maps to a real CWE identifier with a canonical fix template:

CWE Vulnerability Canonical Fix
CWE-89 SQL Injection Parameterized queries
CWE-78 Command Injection spawn with arg array
CWE-94 Code Injection (eval) JSON.parse
CWE-79 DOM XSS (innerHTML) textContent / DOMPurify
CWE-327 Weak hashing (MD5/SHA1) SHA-256 / bcrypt
CWE-338 Math.random() for secrets crypto.randomBytes
CWE-502 Unsafe deserialization safe_load / JSON
CWE-798 Hardcoded secrets process.env + rotate
CWE-352 CSRF disabled Re-enable middleware
CWE-1104 Vulnerable dependencies Bump to patched version

πŸ“‚ Project Structure

gitagent-securebot/
β”œβ”€β”€ πŸ“ agent/                       # The GitAgent agent IS a git repo
β”‚   β”œβ”€β”€ agent.yaml                  # Model, tools, runtime, compliance
β”‚   β”œβ”€β”€ SOUL.md                     # Identity & output discipline
β”‚   β”œβ”€β”€ RULES.md                    # 8 hard safety rules
β”‚   β”œβ”€β”€ DUTIES.md                   # Scope: scan vs fix duties
β”‚   β”œβ”€β”€ skills/scan-security/       # OWASP Top 10 scanning skill
β”‚   β”œβ”€β”€ skills/fix-vulnerability/   # CWE-mapped fix skill
β”‚   β”œβ”€β”€ workflows/scan-and-fix.yaml # Multi-agent workflow
β”‚   β”œβ”€β”€ tools/grep-secrets.{yaml,sh}
β”‚   β”œβ”€β”€ hooks/{hooks.yaml,audit.sh,alert.sh,session-start.sh}
β”‚   └── memory/MEMORY.md
β”œβ”€β”€ πŸ“ app/                         # Next.js 14 App Router
β”‚   β”œβ”€β”€ api/scan/route.ts           # POST /api/scan β€” SSE
β”‚   β”œβ”€β”€ api/fix/route.ts            # POST /api/fix β€” SSE
β”‚   β”œβ”€β”€ scan/page.tsx               # Real-time dashboard
β”‚   β”œβ”€β”€ components/                 # 5 React components
β”‚   β”œβ”€β”€ page.tsx                    # Landing page
β”‚   └── layout.tsx
β”œβ”€β”€ πŸ“ lib/
β”‚   β”œβ”€β”€ gitagent-client.ts          # SDK wrapper, demo mode, SSE bridge
β”‚   β”œβ”€β”€ hooks.ts                    # Programmatic preToolUse + onError
β”‚   β”œβ”€β”€ tools/                      # 4 custom GitAgent SDK tools
β”‚   └── types.ts
β”œβ”€β”€ 🐳 Dockerfile, docker-compose.yml
β”œβ”€β”€ ☁  vercel.json, netlify.toml
β”œβ”€β”€ πŸ€– .github/workflows/ci.yml
β”œβ”€β”€ πŸ“ ARCHITECTURE.md              # Design decisions for submission
β”œβ”€β”€ πŸ“œ README.md
└── πŸ“‹ LICENSE

🎬 Demo Flow

  1. Open http://localhost:3000 β†’ click "β–Ά Scan with SecureBot" (default value demo)
  2. Land on /scan?demo=1
  3. Watch the left panel light up with [tool_call] find_secrets β†’ [finding] CRITICAL CWE-798 …
  4. Right panel populates with vulnerability cards as findings stream
  5. Summary bar crystallizes: 7 findings Β· 4 critical / 2 high / 1 medium
  6. Click 🩹 Auto-Fix on any card β†’ second agent runs β†’ diff appears inline

πŸŽ₯ Demo Video β€” 3 minutes (coming soon β€” record against running app)


πŸ† Submission Checklist

  • βœ… GitHub repository β€” Youranalyst-coder/gitagent-securebot
  • βœ… Live deployment β€” see deploy buttons above
  • βœ… Architecture document β€” ARCHITECTURE.md
  • βœ… Working demo (zero config via DEMO_MODE=true)
  • βœ… Live mode using real GitAgent SDK with custom tools + hooks
  • βœ… Multi-agent workflow (Scanner β†’ Fixer chained via workflow YAML)
  • βœ… Uses every major GitAgent primitive (12/12 β€” see matrix above)
  • βœ… Production-ready: Dockerfile, CI, multiple deploy targets
  • πŸ“Ή 3–5 min demo video

πŸ“œ License

MIT β€” see LICENSE.

πŸ™ Credits

  • GitAgent β€” universal git-native agent framework
  • Lyzr AI Studio β€” primary model provider, free tier
  • OWASP & MITRE CWE β€” vulnerability taxonomy

Built with ❀️ for the Lzyr Builder Challenge

⭐ Star this repo if it helped you understand the GitAgent SDK ⭐

About

AI-powered security scanner & auto-fixer built on GitAgent SDK. Multi-agent pipeline (Scanner -> Fixer) with custom tools, hooks, skills, and live SSE streaming. Built for the Lzyr Builder Challenge.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors