*AI-Powered Code Protection That Never Sleeps - Built with Google's ADK, Vertex AI & Gemini 2.5 Flash GuardianAI is an autonomous AI agent that acts as your personal security guardian. Using Google's Agent Development Kit (ADK) and Vertex AI, it continuously monitors your repositories, detects 100+ vulnerability patterns across OWASP Top 10, and autonomously creates Pull Requests with security fixes. Built for the GenAI Hackathon Mumbai 2025.
Security & signing notes:
- SIGNING_KEY: optional HMAC key used to sign persisted patches for auditable certificates (set
SIGNING_KEYin.env.localor let server use an ephemeral key for demos). - ADMIN_KEY: set
ADMIN_KEY(orVITE_ADMIN_KEY) to protect admin-only endpoints (patch signing, CI check-run). Admin endpoints read headerx-admin-keyor query?adminKey=for convenience in demos; in production use a secure secret store.
Use these keys for secure signing and CI integrations while keeping keys off the client and logs.
- Create PR UI with Dry-Run preview and Confirm Create PR flow (preview
prEditsbefore creating PRs). - Demo fallback when Gemini quota is exhausted (set
DEMO_FALLBACK=trueor use the UI 'Use Demo Edits'). - Gemini CLI support (optional) via
USE_GEMINI_CLI=trueforgcloud-based model calls. - Patch persistence & exports: patches are persisted on the server and are downloadable as JSON or ZIP:
GET /api/patchesβ list saved patchesGET /api/patches/:idβ view a single patchGET /api/patches/:id/downloadβ download a single patch JSONGET /api/patches/download-allβ JSON with all patchesGET /api/patches/download-zipβ zip archive of patches (optional?ids=comma,separated).
New analysis & integration endpoints:
-
POST /api/scaβ Software Composition Analysis: checkspackage.jsonagainst npm latest versions and reports outdated deps & licenses. -
POST /api/ci/check-runβ Create a GitHub Check Run for CI reporting (requiresGITHUB_TOKEN). -
GET /api/patches/:id/certificate.pdfβ Download a signed PDF certificate for a signed patch (requires patch to be signed via/api/patches/:id/sign). -
POST /api/patches/:id/generate-testsβ Request an auto-generated test skeleton for the patched files (Jest test suggestions). -
Presentation & proof: judge-ready slides and a combined PDF are at
presentation/GuardianAI-presentation.pdf. -
Server-side AI keys: move
GEMINI_API_KEYandGITHUB_TOKENinto.env.local(server performs all model calls and PR creation).
ML Mumbai GenAI Hackathon | December 2025
- β Uses Google's ADK for autonomous agent orchestration
- β Deploys on Vertex AI for enterprise-scale security
- β Integrates Gemini 2.5 Flash via API (optional gcloud CLI support available)
- β Solves $200B annual security spending problem with AI automation
View your app in AI Studio: https://ai.studio/apps/drive/1juDPrvEiHyYxMiHI6kBWI1VhbFwZ7NhL
Autonomous Security Engineering in 4 Steps:
π Step 1: Continuous Monitoring
ββ> ADK schedules scans via Cloud Scheduler (every 60 min)
ββ> Monitors GitHub webhooks for new commits
π Step 2: Deep Analysis
ββ> Vertex AI + Gemini 2.5 Flash analyzes code
ββ> 100+ local intelligence patterns (OWASP Top 10)
ββ> Multi-language support (JS, TS, Python, Java, PHP, Go)
π οΈ Step 3: Autonomous Fix Generation
ββ> Agent generates secure code patches
ββ> Validates fixes against best practices
ββ> 85%+ confidence threshold for auto-fix
β
Step 4: Auto-PR & Learning
ββ> Creates GitHub PR with security fixes
ββ> Learns from each scan (improves patterns)
ββ> Alerts team via Slack/Email integration
Prerequisites: Node.js 18+, GCP Account (free tier OK)
-
Install dependencies:
npm install
-
Configure Agent (copy
.env.exampleto.env.local):VITE_VERTEX_PROJECT_ID=your_gcp_project_id VITE_VERTEX_LOCATION=us-central1 VITE_GEMINI_API_KEY=your_gemini_api_key VITE_GITHUB_TOKEN=your_github_token_with_repo_scope VITE_AGENT_AUTO_PR=true
-
Deploy Agent to Vertex AI:
gcloud ai deploy --region=us-central1
-
Or run locally for testing:
npm run dev # Open http://localhost:5173
Advanced Cybersecurity Analysis - OWASP Top 10 2021 Integration
- OWASP Top 10 2021 Threat Detection:
- A01: Broken Access Control
- A02: Cryptographic Failures
- A03: Injection (SQL, NoSQL, Command, LDAP)
- A05: Security Misconfiguration
- A07: Identification & Authentication Failures
- Security Posture Dashboard with 7-dimensional scoring:
- Overall Security Score (0-100%)
- Threat Level (CRITICAL/HIGH/MEDIUM/LOW)
- Encryption Score
- Authentication Score
- Data Protection Score
- Input Validation Score
- Code Quality Score
- Exploitability & Impact Analysis with visual bars
- CWE & CVE Mapping for vulnerability tracking
- Mitigation Strategies with actionable remediation steps
- 8 Secret Pattern Detection:
- API Keys (Google, AWS, Azure, Generic)
- Passwords (plaintext in code)
- Tokens (Bearer, OAuth, JWT)
- Private Keys (RSA, SSH)
- Database Connection Strings
- AWS Access Keys
- Stripe Secret Keys
- JWT Secrets
- Severity Classification (CRITICAL/HIGH/MEDIUM)
- Secure Storage Recommendations
- Best Practices Panel with industry-standard secret management
- Masked Value Display for security
- Automated Vulnerability Testing:
- SQL Injection Detection
- Cross-Site Scripting (XSS)
- Cross-Site Request Forgery (CSRF)
- Command Injection
- Path Traversal
- Insecure Deserialization
- Server-Side Request Forgery (SSRF)
- XML External Entity (XXE)
- Exploit Payload Generation with proof-of-concept
- Vulnerability Confirmation (exploitable vs. theoretical)
- Compliance Checking:
- OWASP ASVS
- GDPR Security Requirements
- PCI-DSS
- HIPAA
- SOC 2
- ISO 27001
- Remediation Guidance for each finding
Comprehensive Code Quality & Performance Analysis
- π₯ Developer contribution tracking with expertise mapping
- π₯ Code hot spot detection (frequently changed files)
- π Code complexity metrics (average, maintainability index)
- π Commit velocity and impact analysis
- π‘οΈ Security score dashboard (0-100 scale)
- π― Confidence scores for each bug prediction (70-95%)
- π‘ AI-generated fix suggestions
- π Pattern analysis (XSS, SQL injection, eval, innerHTML)
β οΈ Critical security issues panel
- π Technical debt scoring with hours-to-fix estimates
- π¨ Architecture violation detection (5+ patterns)
- π Circular dependency detection
- π Maintainability index tracking
- π’ Layer violation alerts (UI β DB direct access)
- π΅ Cost breakdown by category (Compute, Storage, Database, Network)
- π Cost trend analysis (increasing/stable/decreasing)
- π‘ 3 optimization tips per service
- π Annual savings projections
- π― Service-specific recommendations
- β‘ Performance bottleneck detection
- π Interactive dependency graph with D3.js
- π Module coupling score (0-10 scale)
- π― Optimization opportunity counting
- π±οΈ Drag-and-drop node exploration
- π€ Multi-modal code + documentation analysis
- π‘ Real-time security recommendations
- π OWASP Top 10 compliance checking
- π‘οΈ Best practices for secure coding
- π Threat modeling and risk assessment
- π Fallback to local intelligence (100+ patterns) on rate limits
- ADK (Agent Development Kit): Autonomous agent orchestration & decision-making
- Vertex AI: Enterprise deployment of Gemini models at scale
- Gemini 2.5 Flash: Multi-modal AI for code analysis (API by default; optional
gcloudCLI supported) - Google Cloud Functions: Automated scanning triggers on commits
- Cloud Scheduler: Continuous monitoring (24/7 autonomous operation)
- Frontend: React 19.2.3 + TypeScript 5.8.2
- Local Intelligence: 100+ vulnerability patterns (regex-based)
- UI Framework: Tailwind CSS 3.4.17
- Visualization: Recharts + D3.js force-directed graphs
- Build Tool: Vite 6.0.5
- OWASP Top 10 2021: 100% coverage with 60+ patterns
- Advanced Threats: XXE, SSTI, Prototype Pollution, ReDoS, NoSQL Injection
- Compliance: GDPR, PCI-DSS, HIPAA, SOC 2, ISO 27001
- Multi-Language: JavaScript, TypeScript, Python, Java, PHP, Go
CodeIntel AI now supports automatic failover between Gemini and Grok APIs:
- Primary: Gemini 2.5 Flash (fast, cost-effective)
- Fallback: Grok Beta (when Gemini hits rate limits)
- Zero Downtime: Seamless switching between APIs
- Rate Limit Protection: Never fails due to API quotas
How it works:
- System tries Gemini first
- If rate limited (HTTP 429) β Automatically switches to Grok
- If both fail β Shows clear error message
- No user intervention needed! π―
- Visit https://aistudio.google.com/app/apikey
- Sign in with your Google account
If you receive a Gemini quota error even on your first attempt for the day, common causes include:
- A sample or shared API key is present in
.env.local(checkGEMINI_API_KEY/VITE_GEMINI_API_KEY). Replace it with your own key tied to your GCP project. - Autoscan is enabled and ran at startup (check
server/autoscan.jsonorVITE_AGENT_CONTINUOUS_SCAN/VITE_AGENT_SCAN_INTERVAL). Autoscan can consume requests automatically. - Other services or team members may be using the same GCP project / API key and consuming the free-tier quota.
What to do:
- Verify which key the server is using by checking
.env.localin the project root. - Visit the Google AI usage dashboard to inspect quota and rate limits: https://ai.dev/usage?tab=rate-limit
- If you want to keep demoability while under quota, enable the demo fallback (default behavior) or set
DEMO_FALLBACK=truein.env.localto fall back to simulated edits automatically. - To avoid unexpected autoscan usage during testing, set
VITE_AGENT_CONTINUOUS_SCAN=falseor clearserver/autoscan.json. - Consider enabling billing or requesting higher quota for production use.
See the Gemini rate-limits documentation for more details: https://ai.google.dev/gemini-api/docs/rate-limits
You can configure the project to use the Google Cloud CLI (gcloud) for Gemini model calls instead of the Node SDK β this can produce slightly different results and aligns with the Google Cloud toolchain.
Steps:
- Install the Google Cloud SDK: https://cloud.google.com/sdk/docs/install
- Authenticate: run
gcloud auth loginand (for application default credentials)gcloud auth application-default login. - Enable the Generative AI API on your project and set your project and location (if not already set):
gcloud config set project YOUR_PROJECT_ID
export GCLOUD_PROJECT=YOUR_PROJECT_ID
export VITE_VERTEX_PROJECT_ID=YOUR_PROJECT_ID
export VITE_VERTEX_LOCATION=us-central1- (Optional) Enable CLI usage in the project by setting the env var
USE_GEMINI_CLI=true(orVITE_USE_GEMINI_CLI=truein.env.local). The server loads.env.localin dev. If not set, the project will use the Node SDK and API calls by default.
Gemini CLI Quick Start (gcloud):
# Install Cloud SDK: https://cloud.google.com/sdk/docs/install
gcloud auth login
# optional: application default credentials
gcloud auth application-default login
# set your project
gcloud config set project YOUR_PROJECT_ID
# Then enable CLI usage in .env.local
USE_GEMINI_CLI=true
# Run a quick test
npm run test:gemini-cli -- https://github.com/githubtraining/hellogitworldNotes & troubleshooting:
- If the CLI is not available or fails, the server will automatically fall back to the SDK-based path.
- The server attempts several common
gcloudvariants (gcloud ai models predict,gcloud alpha ai models predict,gcloud ai generate-text) and parses JSON output when available. - To test locally, set
USE_GEMINI_CLI=trueand run a dry-run via the UI orcurlto/api/scan.
If you'd like, I can add a convenience test script to run a quick CLI-based dry-run locally; tell me if you want that and I will add it.
Saving and sharing generated patches for judges
- The server persists every generated patch (dry-run, autoscan, demo, and PR-created) in
server/patches.jsonfor auditing. - To list saved patches: call the API endpoint
GET /api/patches(Vite proxies/apito server). - To view a single patch:
GET /api/patches/:id. - To download a patch (JSON):
GET /api/patches/:id/downloadβ this returns a JSON file you can share with judges as proof. - To download all recorded patches:
GET /api/patches/download-allβ returns a single JSON attachment with all patches. - To download patches as a ZIP file:
GET /api/patches/download-zipβ returns a zip archive of all patches. UseGET /api/patches/download-zip?ids=patch-...to include specific patch ids (comma-separated).
Quick deploy scripts (safe defaults):
scripts/deploy-cloudrun.sh PROJECT_ID [GITHUB_TOKEN] [GEMINI_API_KEY]β builds & deploys to Cloud Run with DEMO_FALLBACK enabled (conservative defaults)scripts/deploy-cloudrun.ps1β PowerShell alternative for Windows users
Judge handout (one-page): docs/judge-handout.md
From the UI, click the View Patches button in the header to open the patches modal and download per-patch JSON files for sharing with judges.
To run the CLI test script locally (uses ts-node loader):
npm run test:gemini-cli -- https://github.com/githubtraining/hellogitworldNote: Set USE_GEMINI_CLI=true in your .env.local to force CLI usage. If gcloud is not installed or the CLI fails, the script will fall back to the Node SDK path.
3. Click "Create API Key"
4. Copy the key and add it to your .env.local file