About
## The problem it solves
### 🛑 The Problem Modern development teams face a frustrating paradox with CI/CD security: 1. **Alert Fatigue & False Positives:** Traditional SAST tools and secret scanners spam developers with hundreds of theoretical warnings (such as mock test tokens or unreachable CVEs), conditioning developers to ignore alerts or disable security gates altogether. 2. **The "Detection Without Resolution" Gap:** Existing linters and bots point out what is broken, but leave engineers to context-switch, manually trace the call stack, research a fix, write the patch, and re-commit. 3. **Fatal Production Leaks:** Accidentally committing API keys, database credentials, or fatal runtime defects (null pointer dereferences, unhandled promise rejections, race conditions) leads to emergency rollbacks, credential revoking, and production downtime.
---
### 🛡️ How GitGuard Solves It
**GitGuard** is an autonomous, multi-agent GitHub security and code correctness gatekeeper that installs as a native GitHub App. Instead of relying on a single generic prompt or noisy regexes, it orchestrates an ensemble of specialized agents via **LangGraph**:
- **Deep Exploitability AI Reasoning (Not Just Theoretical CVEs):** Pairs Semgrep OWASP Top 10 SAST with frontier AI models to evaluate data-flow taint propagation and sink reachability. It recognizes framework-level mitigations (like Next.js auto-escaping or ORM parameterized queries) and **only blocks merges for confirmed, real-world exploitable vulnerabilities**.
- **Zero-False-Positive Secret Protection:** Shells out to Gitleaks with Shannon entropy analysis, then uses AI verification to filter out mock strings and dummy test fixtures.
- **Fatal Defect Elimination:** Scans diff hunks specifically for 4 critical failure modes: null/undefined dereferences, unhandled promise rejections, race conditions, and boundary off-by-one errors.
- **Autonomous Auto-Solve & One-Click Fixes:** GitGuard doesn't just complain—it generates verified, production-ready code fixes. Developers can commit suggestions directly in GitHub with a **single click**, or enable **Autonomous Auto-Solve**, allowing GitGuard to commit and push verified patches directly to the branch as `GitGuard [bot]`.
- **Audited Exemption Governance (`.gitguardignore`):** Enforces accountability by requiring every ignored rule to include an explicit `# reason: ...`. Rules without documented justifications are rejected, and all exemptions are logged to an immutable compliance audit trail.
- **Consensus Arbitration:** When security and correctness agents disagree on the same line of code, a LangGraph `DialogueNode` conducts an automated debate to determine the true root cause before rendering a final **PASS / WARN / BLOCK** verdict.
## Challenges we ran into
Building a low-latency, autonomous multi-agent pipeline that interacts directly with GitHub's live API presented several demanding engineering hurdles:
### 1. Token Rate Limits & Context Window Optimization (8K TPM Hard Cap) * **The Challenge:** Passing entire source files to frontier LLMs burned tens of thousands of tokens per push, instantly triggering 429 rate limit exceptions on Groq and Gemini free tiers (capped at 8,000 Tokens Per Minute). * **How We Overcame It:** We engineered a **Diff Hunk Slicing Engine** that extracts only modified code chunks with 3 lines of surrounding lexical scope rather than full files. We implemented a **multi-model failover engine** (`gpt-oss-120b` → `gpt-oss-20b` → `qwen-27b`) with exponential token-bucket backoff, plus a **Zero-Token Fast Path** that deterministically approves clean changesets without burning LLM tokens.
### 2. Distributed Queue & Lock Synchronization in Serverless Redis * **The Challenge:** Multi-agent evaluation (running Gitleaks, Semgrep AST scans, and LLM consensus) occasionally exceeded BullMQ's default 30-second job lock window. Additionally, serverless Upstash Redis connections intermittently dropped idle sockets during multi-agent pauses, causing `could not renew lock ... moveToDelayed` errors. * **How We Overcame It:** We customized the worker to use a 120-second lock window with 60-second automatic heartbeats, set single-job concurrency to eliminate Redis socket contention, and configured `ioredis` with exponential retry backoff and custom TLS keep-alives.
### 3. Node.js 24 Global Fetch & GitHub API TLS Timeouts * **The Challenge:** Fetching PR metadata and raw unified diffs in parallel frequently triggered `Connect Timeout Error (10000ms)` in Node.js 24 due to `undici`'s internal hardcoded 10-second connection timeout colliding with GitHub edge TLS handshakes. * **How We Overcame It:** We overridden `globalThis.fetch` process-wide with a dedicated `undici.Agent` configured with a 45-second connect timeout and keep-alive pool. We also engineered `octokitRequestWithRetry` with automatic patch fallback: if GitHub's raw `.diff` endpoint ever lags, GitGuard dynamically synthesizes the unified diff directly from commit patch blocks without failing.
### 4. Headless Atomic Git Tree Mutation for Auto-Solve * **The Challenge:** The Auto-Solve engine needed to patch multiple files and commit back to the target branch as `GitGuard [bot]` without cloning the entire repository to local disk (which would introduce severe disk and latency overhead). * **How We Overcame It:** We utilized GitHub's low-level Git Data API (`createBlob`, `createTree`, `createCommit`, and `updateRef`) to construct atomic commit trees entirely in memory, delivering complete auto-solved commits in under 1.5 seconds.
Screenshots
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.











