Skip to main content

A solution for remediating vulnerable source code using LLMs.

Project description

AutoFiC

Remediate vulnerable source code at scale using LLMs and automation.

License Python

🚀 Overview

AutoFiC is the project, providing a CLI-based automation pipeline for detecting, analyzing, and remediating source code vulnerabilities using the power of LLMs and static analysis tools.

The project is designed for automated security auditing, bulk code scanning, and mass vulnerability remediation across multiple repositories, with seamless integration into modern CI/CD workflows.

✨ Features

  • Automated Vulnerability Detection
    Integrates with tools like CodeQL, Semgrep, Snyk Code to identify vulnerabilities in source code.

  • LLM-Powered Remediation
    Uses Large Language Models to suggest and patch vulnerabilities automatically.

  • Multi-Repository Support
    Bulk-clone and analyze many repositories with configurable filters (e.g., stars, language).

  • CLI Tooling
    Command-line interface for easy integration into scripts and CI/CD pipelines.

  • SARIF/JSON Reporting
    Outputs results in standardized formats for downstream processing or dashboards.

  • Extensible and Modular
    Easily extend with new vulnerability scanners, languages, or custom rules.

🏗️ Architecture

                                            +---------------------+
                                            |   [GitHub Repos]    |
                                            +----------+----------+
                                                       |
                                                       v
                                            +---------------------+
                                            | Vulnerability Scan  |   (CodeQL / Semgrep / Snyk)
                                            +----------+----------+
                                                       |
                                          SARIF/JSON   v
                                            +---------------------+
                                            |    autofic-core     |
                                            |   (Orchestrator)    |
                                            +----------+----------+
                                                       |
                                    +------------------+-------------------+
                                    |                                      |
                                    v                                      v
                          +---------------------+                +---------------------+
                          |   LLM-based Patch   |<-------------->|   Patch Validator   |
                          |  (OpenAI, etc.)     |                |   (Optional CI)     |
                          +---------------------+                +---------------------+
                                    |
                                    v
                            +---------------+
                            |  Auto PR to   |
                            |   GitHub Repo |
                            +---------------+
  • Vulnerability Scan : Detect vulnerabilities with static analysis tools (CodeQL, Semgrep, Snyk).
  • autofic-core : Parses findings, sends code to LLM, receives patch suggestions, applies fixes.
  • LLM-based Patch : Uses large language models (e.g., OpenAI) to generate secure code patches.
  • Patch Validator (Optional) : Runs CI/tests to validate patches.
  • Auto PR : Automatically creates a pull request with the fix to the target repository.

⚡ Getting Started

1. Prerequisites

  • Python 3.8+
  • CodeQL CLI (for CodeQL support)
  • Semgrep CLI (for Semgrep support)
  • Snyk CLI (optional)
  • GitHub Personal Access Token (if accessing private repos)

2. Installation

Clone the repo and install dependencies:

git clone https://github.com/AutoFiC/autofic-core.git
cd autofic-core
python -m venv .venv
source .venv/bin/activate   # (Windows: .venv\Scripts\activate)
pip install --upgrade pip; pip install -r requirements.txt; pip install -e .;

3. Usage

🚦 CLI Example

python -m autofic_core.cli \
  --repo <Vulnerable Repository> \
  --sast <semgrep|codeql|snyk> \
  --llm \
  --save-dir <Absolute Path> \
  --patch \
  --pr
  • --repo : Target repository URL
  • --sast : Vulnerability scanner to use (semgrep, codeql, etc.)
  • --llm : Enable LLM-based remediation
  • --save-dir : Directory to store scan results
  • --patch : Apply suggested patches
  • --pr : Automatically create a Pull Request with fixes

🔄 Typical Workflow

  • Scan the target repository for vulnerabilities using static analysis.
  • Remediate detected vulnerabilities with automated LLM-based patch suggestions.
  • Generate reports and/or create a Pull Request with the security fixes.
  • See python -m autofic_core.cli --help for the full list of options and usage details.

🧩 Configuration

Configuration is done via CLI flags and/or .env files.

  • GITHUB_TOKEN - For accessing private repositories and creating pull requests.
  • OPENAI_API_KEY - For LLM-powered patch suggestions.
  • USER_NAME - Name or ID for audit trails or commit information.
  • DISCORD_WEBHOOK_URL - (Optional) Discord webhook URL for notifications.
  • SLACK_WEBHOOK_URL - (Optional) Slack webhook URL for notifications.

🤝 Contributing

We welcome all contributions!

  1. Fork the repo and create your branch : git checkout -b feature/your-feature
  2. Commit your changes : git commit -am 'Add new feature'
  3. Push to the branch : git push origin feature/your-feature
  4. Open a Pull Request

📄 License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

🙋 Contact

👨‍💻 Developers

👩🏻‍💻 Development Team

🔬 Research Team

👨🏻‍🏫 Mentor

👨🏻‍🏫 Project Leader

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autofic_core-0.1.0.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autofic_core-0.1.0-py3-none-any.whl (62.5 kB view details)

Uploaded Python 3

File details

Details for the file autofic_core-0.1.0.tar.gz.

File metadata

  • Download URL: autofic_core-0.1.0.tar.gz
  • Upload date:
  • Size: 48.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for autofic_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d582ae85d0c495e2037cde1265e676364b6635eba6629adf87642398ac6dd3a
MD5 ebb18bbb8eb998317fa2d5b2ae5e084a
BLAKE2b-256 0fa4175a0e06315e121bff2fb86e5300847254d4f57cbb60fe1130db45c16235

See more details on using hashes here.

File details

Details for the file autofic_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: autofic_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 62.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for autofic_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4dba1943dccc33930fd57cb603ce0f885f532298706a80fc1cc91134d8f4ca63
MD5 01cb0d35ac5b33e95bd13d5ae74975bf
BLAKE2b-256 e0bf7e3f4b05b4b17111b521fef677d6b53162468b0ebb7f79cb77f7f22d7764

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page