Code Janitor
The quality assurance layer for the AI age.
Created on 24th January 2026
•
Code Janitor
The quality assurance layer for the AI age.
The problem Code Janitor solves
CodeJanitor: The Autonomous Security Engineer
CodeJanitor is an agentic AI system that doesn't just find bugs it fixes them.
Modern development teams are drowning in security alerts. Traditional scanners (SAST/DAST) flag thousands of "potential" issues, forcing developers to waste hours manually triaging false positives. CodeJanitor changes the game by introducing an Autonomous Red Team/Blue Team loop directly into your CI/CD pipeline.
The Problem: The "Security Bottleneck"
In the modern DevSecOps landscape, finding vulnerabilities is easy, but fixing them is hard.
- Alert Fatigue: Developers are flooded with thousands of warnings, many of which are false alarms.
- The Remediation Gap: Critical bugs remain open for weeks because manual verification takes too long.
- Shadow Code: The rise of "Vibe Coding" (AI generated code) is creating massive amounts of unverified software that human reviewers cannot keep up with.
The Result: We are finding bugs faster than humans can fix them.
Our Solution: Autonomous Orchestration
CodeJanitor bridges the gap between detection and remediation. It acts as a "Self-Healing" layer for your repository.
How It Works (The Closed-Loop Architecture)
We treat security like a game of "Capture the Flag" between two AI agents:
- The Detective (Scan): CodeJanitor scans the repo using context-aware LLMs to find deep logical flaws, not just regex patterns.
- The Attacker (Red Team Agent): Instead of just alerting you, it spins up an isolated Docker Sandbox and writes a custom exploit script to attack the code.
- If the attack fails: The alert is dismissed (Zero False Positives).
- If the attack succeeds: The bug is proven real.
- The Defender (Blue Team Agent): The Blue Team analyzes the successful exploit and writes a surgical patch to fix the root cause.
- The Quality Gate (Verification): The Red Team attacks the new patch. The system only creates a Pull Request if the fix withstands the attack.
What People Can Use It For
- Self-Healing Repositories
Turn CodeJanitor loose on legacy codebases. It autonomously scans, verifies, and patches neglected vulnerabilities like SQL Injection or Hardcoded Secrets without human intervention. - The "Vibe Coding" Safety Net
As developers use AI to generate code faster, CodeJanitor acts as the Automated Auditor. It verifies that AI generated logic is secure before it merges to production, preventing "hallucinated vulnerabilities." - Zero False Positive Triage
Security teams use CodeJanitor to filter noise. If the Red Team agent can't exploit it, the engineer doesn't need to wake up for it.
How It Makes Development Safer & Easier
| Feature | Impact on Workflow |
|---|---|
| Proof of Concept Verification | Easier: Eliminates the guesswork. Developers receive a "Proof of Exploit" with every ticket, so they know exactly why a fix is needed. |
| Sandboxed Execution | Safer: All attacks and tests run in ephemeral, isolated Docker containers. Malicious payloads never touch your production environment or developer machines. |
| One Click Remediation | Easier: What used to take hours of debugging is reduced to a single Pull Request. Developers simply review the verified fix and click "Merge." |
| Adversarial Validation | Safer: Fixes are battle tested against active exploits, ensuring that a patch doesn't just "look" right it actually stops the attack. |
Technical Edge
- Docker in Docker (DinD): Enables safe, isolated execution of dangerous exploits.
- Multi-Agent Orchestration: Decouples "Attacker" and "Defender" logic to prevent bias.
- Agentic Feedback Loops: Agents learn from failed patch attempts, iterating until a robust solution is found.
Challenges we ran into
The "Docker-in-Docker" Nightmare
The core feature of CodeJanitor is that it spawns isolated environments for every security test. We thought, "Easy, we'll just run Docker commands from Python." We were wrong.
The Hurdle: Since our backend itself runs inside a Docker container, it couldn't see the host's Docker daemon. When the Red Team agent tried to spin up a sandbox, it failed with FileNotFoundError: /var/run/docker.sock. Even after mounting the socket, we hit a networking wall: the "sibling" containers (the sandboxes) couldn't communicate with the main backend because they were on different internal networks.
The Fix: We had to architect a Sibling Container setup rather than a true "Child" setup.
We mounted the host's /var/run/docker.sock into the backend container. We created a dedicated janitor_network bridge in Docker Compose. We forced the backend to spawn new containers explicitly attached to this shared network so the Red Team could "see" the target application.
The "Lazy Agent" Problem
Early in testing, our Blue Team agent (the Patcher) would often just... lie. It would say Fixed the SQL Injection! but just add a comment to the code without actually changing the logic. The Red Team would then fail to exploit it (because the exploit script was brittle), and the system would mark it as "Fixed" falsely.
The Fix: We implemented a "Strict Verification Loop."
We stopped trusting the agents' text output. We forced the Red Team to capture the exit code of the exploit script. If the Blue Team claims a fix, the Red Team must run the exact same exploit again. If the exit code isn't 0 (blocked), the pipeline rejects the PR automatically.
Technologies used
