AI-Driven Pull Request Security Review Platform
Tech Stack
- appsec
- devsecops
- ai
- code-review
- dotnet
- github-integration
- kubernetes
Project Overview
This project is an enterprise-grade, automated Application Security (AppSec) review platform designed to continuously monitor source control activity and apply AI-powered analysis to every code change before it is merged. The core problem it solves is the scalability gap between security engineering capacity and engineering throughput: as development teams grow, manual code review for security vulnerabilities becomes a bottleneck. This platform eliminates that bottleneck by running autonomous, AI-driven security analysis on pull requests across multiple repositories and organizations, 24/7, without human intervention.
The platform integrates directly with a source control management API to discover new and updated pull requests in near real-time. Each discovered PR is queued and processed through a multi-phase AI pipeline that analyzes changed files for vulnerabilities — including injection flaws, authentication bypasses, insecure deserialization, and secrets exposure — before synthesizing a structured verdict. The resulting security review, including file-level findings and a final risk classification, is persisted and surfaced through a web-based management dashboard.
Beyond passive reporting, the platform enforces active gatekeeping: it can block PR merges automatically when a high-risk verdict is issued by posting a blocking status check. This transforms security review from an advisory process into an enforceable compliance control, delivering measurable reduction in the risk of vulnerable code reaching production.
Key Features
Continuous PR Discovery Engine: A resilient background service continuously polls the source control API for open pull requests across all configured organizations and repositories, applying a configurable look-back window and deduplication logic to avoid redundant processing.
Multi-Phase AI Security Analysis Pipeline: Changed files are processed through a token-aware chunking algorithm and submitted to a large language model in two phases — per-file analysis and a final cross-file synthesis — producing structured JSON verdict objects with detailed reasoning and remediation recommendations.
Automated Merge Gatekeeping (Policy as Code) Security alerts are useless if developers can bypass them to hit a release deadline. This platform eliminates that loophole by translating static compliance rules into executable Policy as Code.
By injecting real-time status checks directly into your VCS, the system automatically blocks merges on flagged PRs. It enforces rigid workflow SLAs and shuts the gate instantly the moment a vulnerability is detected. The result? A pristinemainbranch and a security team that no longer has to play manual babysitter.
But handing over the keys to an automated gatekeeper introduces a new, critical risk. If the pipeline is making hard merge decisions, the AI analyzer itself must be bulletproof against malicious manipulation.
Prompt Injection & Output Sanitization: AI prompt inputs (file names, patch content, PR titles) are sanitized before construction, and all AI-generated outputs rendered in the web UI are HTML-encoded by default. GitHub comment content undergoes additional Markdown neutralization to prevent downstream injection.
Admin Dashboard with Runtime Controls: A web-based management interface allows operators to monitor active reviews, inspect per-file analysis details, view platform metrics, and dynamically toggle settings — such as the active AI model and gatekeeping mode — without restarting the service.
Disaster Recovery CLI Tool: A companion command-line utility enables operators to replay or force-trigger reviews for specific repositories and PRs, supporting incident recovery and audit scenarios without requiring direct database access.
Tech Stack
Backend
Runtime: .NET 8 (ASP.NET Core MVC), C# 12
AI Integration: Google Generative AI SDK (
Google.GenAI) for structured content generation using configurable large language modelsSource Control Integration:
OctokitandOctokit.Reactivefor GitHub REST API interaction;GitHubJwtfor Asymmetric Key-based App AuthenticationBackground Processing:
IHostedService-based orchestration with a producer/consumerChannel<T>queue, watchdog-wrapped loops with exponential backoff restart, andSemaphoreSlim-bounded concurrency (max 5 concurrent AI jobs)Authentication: OpenID Connect (
Microsoft.AspNetCore.Authentication.OpenIdConnect) with data protection backed by Entity Framework CoreORM & Database: Entity Framework Core 9 with Npgsql provider targeting PostgreSQL
Frontend
Rendering Engine: Razor Views (ASP.NET Core MVC server-side rendering)
Security: Default Razor HTML encoding on all AI-generated and user-controlled output; URL scheme validation on external links;
rel="noopener noreferrer"on all outbound anchors
DevOps & Infrastructure
Containerization: Docker with Linux target OS; multi-service local environment via Docker Compose
Orchestration: Kubernetes deployment via Helm Chart, with configmap-backed application settings and secret volume mounts for private key material
Secrets Management: Zero-hardcoded-secret policy; all credentials injected via environment variables or Kubernetes secrets at runtime
Conclusion
The platform demonstrates a mature architectural approach to embedding security automation into the software development lifecycle. The deliberate decoupling of PR discovery from review execution — via a bounded in-memory channel — ensures the system remains responsive and backpressure-safe under high load. The multi-phase AI pipeline with token-aware chunking addresses the practical challenge of reviewing large changesets that exceed single-prompt context windows, while the watchdog-wrapped background loops provide resilience against transient external API failures.
The consistent application of zero-trust principles — prompt sanitization, output encoding, secrets injection, and log redaction — ensures the platform itself does not become an attack surface despite processing untrusted, externally-sourced code content. The result is a production-hardened tool that raises the security baseline across an engineering organization without introducing friction into the development workflow.