A full-stack application that integrates with GitHub to scan repositories for security vulnerabilities and automatically create pull requests with fixes.
- GitHub Integration: Connect to GitHub using personal access tokens
- Repository Selection: Browse and select repositories from your GitHub account
- Security Scanning: Automated vulnerability detection (simulated)
- Auto-Remediation: Automatic creation of pull requests with security fixes
- Modern UI: Built with Next.js and shadcn/ui components
- Backend: Flask API (
app.py) with GitHub integration using PyGithub - Frontend: Next.js application with TypeScript and Tailwind CSS
- API Endpoints:
GET /health- Health checkGET /api/repositories- List GitHub repositoriesGET /api/repositories/<owner>/<repo>- Get repository details
- Python 3.8+
- Node.js 18+
- GitHub Personal Access Token
- Install Python dependencies:
pip install -r requirements.txt- Set your GitHub token:
export GITHUB_TOKEN=your_github_token_here- Start the Flask server:
python app.pyThe API will be available at http://localhost:5000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Start the development server:
npm run devThe frontend will be available at http://localhost:3000
Run the test script to verify everything is working:
python test_api.py-
Connect to GitHub:
- Enter your GitHub Personal Access Token
- Optionally specify a username/organization to browse their repositories
- Click "Connect GitHub"
-
Select Repository:
- Choose a repository from the dropdown
- The list shows repository name, language, privacy status, and star count
-
Start Security Scan:
- Click "Start Security Scan" to begin the automated process
- Watch the progress as the system scans for vulnerabilities
- View the results including discovered issues and generated pull requests
GET /healthGET /api/repositories?token=YOUR_TOKEN&username=USERNAME&per_page=30&page=1Query Parameters:
token(required): GitHub personal access tokenusername(optional): Specific username/organizationorg(optional): Organization nametype(optional): Repository type (all, owner, public, private, member)sort(optional): Sort field (created, updated, pushed, full_name)direction(optional): Sort direction (asc, desc)per_page(optional): Results per page (max 100)page(optional): Page number
GET /api/repositories/{owner}/{repo}?token=YOUR_TOKEN&detailed=trueGITHUB_TOKEN: GitHub personal access tokenPORT: Flask server port (default: 5000)FLASK_DEBUG: Enable debug mode (default: False)NEXT_PUBLIC_API_URL: Frontend API URL (default: http://localhost:5000)
- The Flask app uses PyGithub for GitHub API integration
- Error handling includes proper HTTP status codes
- CORS is enabled for frontend integration
- Built with Next.js 14 and TypeScript
- Uses shadcn/ui components for consistent design
- Implements proper error handling and loading states
- Responsive design for mobile and desktop
- GitHub tokens are handled securely and not stored
- All API calls use HTTPS in production
- Input validation is implemented on both frontend and backend
- "GitHub service not initialized": Make sure GITHUB_TOKEN is set
- "Failed to fetch repositories": Check your token permissions and network connection
- CORS errors: Ensure the Flask server is running and CORS is enabled
- Frontend not loading: Check that both servers are running on correct ports
MIT License - see LICENSE file for details