Skip to content

AI-Powered DevSecOps tool for contextual security auditing of Linux kernel and system configuration files, enforced by structured JSON output

Notifications You must be signed in to change notification settings

Champbreed/Devsecop-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

​## AI-Powered Kernel Security Analyzer (KMSH)

​This project implements a fully automated, cloud-deployed DevSecOps tool that leverages Generative AI (Gemini) for deep, contextual security auditing of low-level system configuration files. The KMSH is designed to bridge the gap left by traditional security tools by analyzing infrastructure configuration and synthesizing actionable remediation steps and training materials.

​Research and Implementation by: Simon Essien

Live Demo: https://devsecop-analyzer.onrender.com

​## The Problem & Solution

-​The Problem

​Traditional security tools (like SAST) excel at syntax and rule-based checks for application code, but they fundamentally lack the contextual reasoning required to evaluate the security implications of low-level infrastructure configuration files (e.g., Linux kernel .conf files). Auditing these files typically requires slow, manual human expertise, creating a bottleneck in the security pipeline.

-The Solution

​The KMSH (Kernel Module Security Hardener) transforms the security review process by:

​Automating Expert Reasoning: Leveraging the Gemini API as a specialized reasoning engine to analyze configuration text and infer systemic security risks. Gemini's advanced reasoning allows it to identify subtle forms of risks that rule-based systems miss.

​Enforcing Automation: Utilizing a strict JSON Schema to guarantee structured, machine-readable output from the AI, ensuring the analysis can be reliably parsed and integrated into downstream automation processes.

​Shifting Security Left: Providing immediate, actionable feedback directly to the developer, significantly reducing the time to remediate vulnerabilities

​## 1. System Architecture & Methodology

​The KMSH is a single-service Python application built for reliability and speed in a production setting.

​Goal: To automate expert-level security auditing of kernel-level configuration files (e.g., mock_kernel_module.conf).

​Architecture:

​Frontend: Minimal HTML/CSS/Jinja provides an interactive user form for submitting configuration text.

​Backend & Logic: Flask framework running on Python 3. Handles request processing, analysis orchestration, and response formatting.

​Production Server: Gunicorn is utilized for serving the Flask application, ensuring stability and concurrency required for production load.

​Intelligence Layer: The Google Gemini API (gemini-2.5-flash) functions as an external service to perform the core contextual security reasoning.

​Data Contract & Reliability

​The most critical technical implementation is ensuring AI output reliability for automation:

​The application defines a precise JSON Schema within the Gemini API call's GenerateContentConfig.

​This schema strictly mandates the structure of the AI's response, enforcing specific fields like severity, remediation_action, and feynman_explanation.

​This design ensures a predictable data contract, preventing parsing failures and enabling seamless automation.

​## 2. DevSecOps & Security Controls

​The deployment and operation of the KMSH adhere strictly to modern security best practices.

​Continuous Deployment (CI/CD): The entire application lifecycle is managed via an automated pipeline: Git \rightarrow GitHub \rightarrow Render. Any code change triggers an immediate, hands-free build and deployment.

​Secrets Management (Crucial): The GEMINI_API_KEY is never hardcoded or committed to version control. It is securely injected into the runtime environment via Render Environment Variables, demonstrating competence in securing cloud-native credentials.

​Tooling Interleaving: The project is designed to complement traditional SAST tools. While the AI audits the infrastructure configuration, a separate process (like Bandit) is the best practice for auditing the application source code (the Flask logic).

​## 3. Key Features

​The KMSH provides unique value to the security pipeline:

​Contextual Auditing: Solves the "Configuration Blindness" problem inherent in traditional security tools by using AI to analyze system-level text and infer security risk based on domain knowledge.

​Automated Training (Feynman Explanation): Every security finding includes a simplified, non-technical explanation to accelerate security knowledge transfer across the engineering team.

​Structured Output: Findings are automatically categorized by severity (CRITICAL, HIGH, MEDIUM) for rapid triage and integration into dashboards or ticketing systems.

​Interactive Interface: Enables security teams to rapidly test arbitrary configuration snippets and obtain immediate, structured feedback, speeding up the security review lifecycle.

​4. Quick Start & Local Setup

Prerequisites

  • Python 3.10+
  • A valid Gemini API Key

Local Installation and Execution

  1. Clone the Repository: bash git clone https://github.com/Champbreed/Devsecop-analyzer.git cd Devsecop-analyzer

  2. Install Dependencies: bash pip install -r requirements.txt

  3. Set Environment Variable: (Replace "YOUR_KEY" with your actual Gemini API Key) bash export GEMINI_API_KEY="YOUR_KEY_HERE"

  4. Run Production Server (Gunicorn):

    bash gunicorn --bind 0.0.0.0:8000 app:app

    Access the application at http://localhost:8000.

About

AI-Powered DevSecOps tool for contextual security auditing of Linux kernel and system configuration files, enforced by structured JSON output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published