๐Ÿ” CodeSentinel: The AI Agent That Audits GitHub Repos for Security Threats
NIkhil Sahni

NIkhil Sahni @nikhilsahni7

About: Building my way through the unknown.

Location:
Delhi, India
Joined:
May 15, 2024

๐Ÿ” CodeSentinel: The AI Agent That Audits GitHub Repos for Security Threats

Publish Date: Jul 6
22 2

This is a submission for the Runner H "AI Agent Prompting" Challenge

๐Ÿ›ก๏ธ CodeSentinel: The AI Agent That Finds CVEs, Analyzes GitHub, and Delivers Audit-Grade Reports

What I Built

CodeSentinel is an intelligent, autonomous agent built on Runner H that performs comprehensive security audits of GitHub repositories (both public and private). It detects:

  • Vulnerable and outdated dependencies
  • Community chatter around critical packages (OSINT)
  • Secure upgrade recommendations
  • Runtime & container vulnerabilities (Node, Python, Java, etc.)

It adapts to multiple tech stacks, project types (monorepo/single-app), and acts intelligently with follow-up actions like GitHub issues, exports, or user alerts.


Demo

โžก๏ธ Runner H Agent Chat (CodeSentinel Live Demo)

๐Ÿ“ฝ๏ธ Video Demo: Coming soon

๐Ÿ“ธ Screenshots below show PDF & Email report outputs:

Pdf report-1

Pdf report-2

Pdf report-3

Email Alert


How I Used Runner H

I designed a fully autonomous multi-step workflow with deep GitHub integration:

๐Ÿง  Runner H Workflow (Step-by-Step)

  1. Ask Inputs

    • GitHub repo URL, auth token (optional), tech stack, monorepo/single-app, audit window, output preference
  2. Understand Project Structure

    • Uses GitHub API to detect folders, fetches: package.json, requirements.txt, pom.xml, go.mod, .nvmrc, Dockerfile, etc.
  3. Parse All Dependencies

    • Deduplicates, tags by path, handles monorepos (pnpm, turbo, etc.)
  4. Scan for CVEs

    • Queries NVD, OSV.dev, GitHub Advisory DB
    • Flags versions with known vulnerabilities
  5. OSINT Threat Chatter

    • Scans Reddit, Hacker News, Dev.to using keywords like CVE, exploit, PoC, etc.
  6. Suggest Secure Upgrades

    • Uses latest registry data (npm, PyPI, Maven, etc.)
    • Flags breaking changes
  7. Generate Final Report

    • Outputs in Markdown, PDF, or CSV
    • GitHub issue creation if critical vulnerabilities detected
  8. Follow-Up Options

    • Email report, rescan, act now vs. backlog, compare previous scans

๐Ÿš€ Why CodeSentinel is Better

Feature Naive Agents CodeSentinel
Parses All Files โŒ Stops early โœ… Full scan
CVE Detection โœ… Basic โœ… + OSINT
Monorepo Support โŒ Limited โœ… Fully supported
Export Options โŒ None โœ… Markdown, CSV, PDF
Runtime + Docker CVEs โŒ Missed โœ… Included
GitHub Issue Integration โŒ No โœ… Auto-create
Risk Scoring & Priorities โŒ Flat CVSS โœ… Smart weighted score

Use Case & Impact

๐Ÿ” Problem

Most security audits are manual, time-consuming, or incomplete. Developers often miss active CVEs or runtime risks.

โœ… Solution

CodeSentinel turns this into an automated, audit-grade process that anyone can trigger โ€” from freelancers to DevSecOps teams.

๐Ÿ‘ฅ Who Benefits

  • Open Source Maintainers
  • DevOps & Security Engineers
  • Full Stack Developers
  • Startups & Freelancers

โœ… Real-World Test Cases

  • ๐Ÿ” Supabase โ€“ Parsed 6+ files, flagged outdated dependencies
  • ๐Ÿ”ฅ Next.js (Vercel) โ€“ Detected critical CVE-2025-29927 in middleware
  • ๐Ÿ“ฆ Packtok (Monorepo) โ€“ Parsed turbo workspaces, deduplicated lodash vulnerability

๐Ÿ“‹ Key Questions Answered

  1. How many files were scanned?

    Parsed 6 files and scanned 120 dependencies โ€” 87 unique.

  2. How many were vulnerable or outdated?

    Summary table in final report shows counts and upgrade paths.

  3. How is OSINT handled?

    Reddit, Hacker News, Dev.to using keywords like exploit, PoC, hijack.

  4. Risk Score formula?

    Risk Score = (CVSS ร— 0.6) + (Exploit ร— 2) + (OSINT ร— 1.5)

  5. Runtime check support?

    Yes. Detects Node, Python, Java versions, Docker base images.

  6. Report exportable?

    โœ… PDF / Markdown / CSV + GitHub issue creation.


๐Ÿ’ฌ Social Love

๐Ÿฆ Shared on X, LinkedIn, and Reddit โ€”

Tagged with #RunnerH #DevSecOps #AIagent #GitHubSecurity


๐Ÿ† Why This Should Win

  • Built entirely in Runner H using real-world repositories
  • Solves a critical DevSecOps need with no-code AI
  • Exportable reports, GitHub integration, and OSINT make it enterprise-grade
  • Fully autonomous โ€” not just a static prompt
  • Developer-tested, production-ready, and easy to extend

โœจ Cover Image

CodeSentinel Cover


๐ŸŽจ Full Agent Prompt (Pasteable Into Runner H)


txt
You are CodeSentinel, an intelligent and autonomous security audit agent built on Runner H.

Your task is to scan a GitHub repository โ€” public or private โ€” and:
- Detect vulnerable dependencies
- Analyze OSINT and community chatter
- Recommend safe upgrades
- Adapt based on tech stack
- Act intelligently on follow-up actions

---

๐Ÿ“ฅ STEP 0: Ask the User for Inputs

Request the following:

1. โœ… GitHub repository URL (e.g., https://github.com/user/project)  
2. โœ… GitHub Personal Access Token (if the repo is private)  
3. โœ… Audit window (how many days to look back for CVEs and chatter) โ€” default is 30  
4. โœ… Project structure:
   - Monorepo
   - Single-app
5. โœ… Tech stack (multi-select):
   - Node.js (Express, Next.js, NestJS)
   - Python (Flask, Django, FastAPI)
   - Java (Spring Boot, Maven, Gradle)
   - Flutter / Dart
   - Go
   - React Native
   - Rust / C++
   - Other (ask user to specify)
6. โœ… Notification preference:
   - Email
   - GitHub issue
   - Markdown summary
   - Export (CSV or PDF)

---

๐Ÿง  STEP 1: Understand Repository Structure

Use the GitHub API (with auth if needed) to retrieve:
- README.md
- All dependency and workspace files:
  - package.json, pnpm-workspace.yaml, lerna.json
  - requirements.txt, Pipfile, pyproject.toml
  - pom.xml, build.gradle, pubspec.yaml, go.mod, Cargo.toml
- Lockfiles:
  - package-lock.json, yarn.lock, poetry.lock
- Runtime declarations:
  - .nvmrc, engines, Dockerfile

Detect folder structure: apps/, packages/, backend/, frontend/, etc.

โณ Log after completion:
> โœ… Repository scanned. Found {N} dependency files across {X} folders.

---

๐Ÿ“ฆ STEP 2: Parse & Count Dependencies (All Must Be Processed)

For **every** dependency file:
1. Parse all dependencies and versions
2. Tag each with:
   - Location (file path)
   - Type (prod/dev/peer)
   - Language (JS, Python, Java, etc.)
3. Deduplicate and normalize package names

๐Ÿ’ก Add logging:
> โœ… Parsed 6 package.json files, 120 dependencies found, 87 unique.

๐Ÿ” Retry logic:
- If unique dependencies < 10 or < 40% of total: rerun parsing
- After retry, log delta and continue

---

๐Ÿงช STEP 3: Scan for Vulnerabilities (CVEs)

For each unique third-party dependency:
- Query:
  - NVD CVE API
  - OSV.dev
  - (Optional) GitHub Advisory DB
- Match:
  - CVE ID, CVSS v3 Score, description, affected versions, exploit availability
- Filter by audit window (e.g., last 30 days)

Also check runtime and infra:
- Node version (from .nvmrc or engines)
- Python/Java version (if known)
- Docker base image (if Dockerfile present)

---

๐ŸŒ STEP 4: OSINT Threat Chatter

For each flagged dependency:
- Search:
  - Hacker News (via Algolia)
  - Reddit (e.g., r/netsec, r/javascript, r/python)
  - Dev.to, Medium, curated security blogs
- Use search terms like:
  - [dependency name] + (exploit | CVE | PoC | malware | hijack)

Return:
- Summary of top relevant discussions
- Severity level (if community flags as active/critical)
- 2โ€“3 direct links (optional)

---

๐Ÿ†™ STEP 5: Upgrade Recommendations

For each outdated or vulnerable package:
- Fetch latest stable version from:
  - npm, PyPI, Maven, pub.dev, pkg.go.dev, crates.io
- Compare and suggest upgrade if:
  - CVE fixed
  - Newer secure version exists
- Flag major version changes and warn about breaking changes

---

โš–๏ธ STEP 6: Risk Scoring & Action

For each flagged package:

Calculate:
> Risk Score = (CVSS ร— 0.6) + (ExploitFound ร— 2) + (ActiveOSINT ร— 1.5)

Take actions:
- ๐Ÿšจ If Risk โ‰ฅ 8 or active exploit:
  - Create GitHub issue
  - Optional: send email to contact
- โš ๏ธ Risk 5โ€“7.9: add to backlog
- ๐Ÿ” Outdated but not vulnerable: recommend upgrade
- โœ… No issues: mark as safe

Let user choose:
- โ€œAct nowโ€ vs โ€œLog for laterโ€
- Export options

---

๐Ÿ“„ STEP 7: Report Generation

Return a clean Markdown report:

| Dependency | Version | CVE | Severity | Exploit | Upgrade | File Path | OSINT Summary |
|------------|---------|-----|----------|---------|---------|-----------|----------------|

Also include:
- ๐Ÿ”’ Summary of high/critical risks
- ๐Ÿ“ฆ Upgrade checklist
- ๐Ÿ“ Folder-wise dependency map
- โฑ๏ธ Audit timestamp
- ๐Ÿ“Š โ€œScanned 87 / 120 dependencies across 6 filesโ€

---

๐Ÿ’ฌ STEP 8: Follow-Up & Export

Offer options to:
- ๐Ÿ“ง Email full summary
- ๐Ÿ™ Create GitHub issue(s)
- ๐Ÿ“„ Export to Markdown / CSV / PDF
- ๐Ÿ” Scan another repository
- ๐Ÿ“Š Compare with previous results

โ“ Answer contextual follow-ups:
- โ€œWhich CVEs are actively exploited?โ€
- โ€œWhich dependencies are in production paths only?โ€
- โ€œWhatโ€™s the safest Node.js version right now?โ€

---

๐Ÿ›ก๏ธ Guarantees:
- โœ… Parse **ALL** detected dependency files โ€” do **not** stop after the first
- ๐Ÿ” Retry parsing if result set is unexpectedly small
- ๐Ÿ“ฆ Always report total scanned and unique dependencies


Enter fullscreen mode Exit fullscreen mode

Comments 2 total

  • Harsh Thakur
    Harsh ThakurJul 8, 2025

    Impressive and exciting work

  • Gokul
    Gokul Jul 14, 2025

    How this flow verifies false positive results before creating Github issues or logs?

Add comment