A Rust-based web application that leverages GPT-4 to provide security audits for Rust code.
This project implements a chatbot interface that allows users to input Rust code snippets and receive security-related feedback. The backend is built with Rust, utilizing an HTTP server and thread pool implementation. The front end is a simple HTML/JavaScript interface that communicates with the Rust backend.
- Web-based chat interface
- Integration with OpenAI's GPT-4 model for code analysis
- Concurrent request handling using a custom thread pool
- Simple and lightweight HTTP server implementation
Before you begin, ensure you have met the following requirements:
- Rust and Cargo installed (https://www.rust-lang.org/tools/install)
- An OpenAI API key for GPT-4 access
-
Clone the repository:
git clone https://github.com/yourusername/security-audit-chatbot.git cd security-audit-chatbot
-
Create a
.env
file in the project root and add your OpenAI API key:OPENAI_API_KEY=your_api_key_here
-
Build the project:
cargo build --release
-
Start the server:
cargo run --release
-
Open a web browser and navigate to
http://localhost:7878
-
Use the chat interface to input Rust code snippets and receive security-related feedback.
src/main.rs
: Main application logic, HTTP server, and request handlingsrc/lib.rs
: Thread pool implementationsrc/chat.rs
: Structures for OpenAI API communicationindex.html
: Frontend chat interface
Contributions to this project are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for providing the GPT-4 API
- The Rust community for excellent documentation and crates
If you have any questions or feedback, please open an issue on the GitHub repository.