Thank you for your interest in contributing to Moxy! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Code Style Guidelines
- Submitting Changes
- Project Structure
Important: Moxy is designed strictly for ethical security testing and research purposes. It is intended to assist security professionals, developers, and organizations in identifying and remediating vulnerabilities in applications that they own or have explicit permission to test.
By contributing to Moxy, you agree to:
- Use the tool only for authorized security testing
- Respect the privacy and security of others
- Not use Moxy for malicious purposes
- Follow responsible disclosure practices
Before contributing, please:
- Read the README.md to understand the project
- Check existing issues and pull requests to avoid duplicate work
- Fork the repository and create a new branch for your contribution
- Python 3.11+ (backend)
- Node.js 18+ and npm (frontend)
- uv (Python package manager) - Installation guide
- Git
-
Navigate to the backend directory:
cd backend -
Install dependencies using
uv:uv sync
-
Run the backend server:
uv run moxy
The backend runs on http://localhost:5000 by default.
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run moxy
The frontend runs on http://localhost:8080 by default.
For AI agent features, create a .env file in the backend directory:
OpenAI:
OPENAI_API_KEY=sk-proj-...
MODEL=gpt-4o-miniOllama (Local AI):
USE_OLLAMA=true
OPENAI_API_KEY=test
OPENAI_BASE_URL=http://localhost:11434/v1/
MODEL=qwen3:8bWhen reporting issues, please include:
- A clear description of the issue
- Steps to reproduce the problem
- Expected vs. actual behavior
- Environment details (OS, Python version, Node version)
- Relevant logs or error messages
- Screenshots if applicable
Feature suggestions are welcome! Please:
- Check if the feature has already been requested
- Provide a clear description of the proposed feature
- Explain the use case and benefits
- Consider implementation complexity
-
Create a branch:
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix -
Make your changes:
- Write clean, maintainable code
- Follow the project's code style
- Add comments where necessary
- Update documentation if needed
-
Test your changes:
- Test both backend and frontend if applicable
- Ensure existing functionality still works
- Test edge cases
-
Commit your changes:
git commit -m "feat: add new feature" # or git commit -m "fix: resolve bug in proxy handling"
-
Push and create a PR:
git push origin feature/your-feature-name
- Follow PEP 8 style guidelines
- Use type hints where appropriate
- Keep functions focused and single-purpose
- Use descriptive variable and function names
- Add docstrings for public functions and classes
Example:
def process_request(request: dict) -> dict:
"""Process an HTTP request and return modified version.
Args:
request: Dictionary containing request data
Returns:
Modified request dictionary
"""
# Implementation
pass- Follow the existing code style in the project
- Use TypeScript types for all props and state
- Prefer functional components with hooks
- Use meaningful component and variable names
- Keep components small and focused
- Use the existing UI components from
src/components/ui/
Example:
interface RequestListProps {
requests: Request[];
onSelect: (request: Request) => void;
}
export function RequestList({ requests, onSelect }: RequestListProps) {
// Implementation
}- Keep it simple: Write code that is easy to understand and maintain
- Comment wisely: Add comments for complex logic, not obvious code
- Be consistent: Follow existing patterns in the codebase
- Test thoroughly: Ensure your changes work as expected
Use conventional commit format:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
Examples:
feat: add request filtering by status code
fix: resolve memory leak in proxy manager
docs: update API documentation
refactor: simplify request processing logic
-
Update your branch:
git checkout main git pull upstream main git checkout your-branch git rebase main
-
Write a clear PR description:
- What changes were made
- Why the changes were needed
- How to test the changes
- Any breaking changes
-
Ensure your PR:
- Follows the code style guidelines
- Includes necessary documentation updates
- Doesn't break existing functionality
- Has a clear commit history
-
Respond to feedback:
- Be open to suggestions and feedback
- Make requested changes promptly
- Ask questions if something is unclear
Moxy/
├── backend/ # Python backend
│ ├── src/
│ │ ├── api/ # API endpoints
│ │ ├── addon.py # MITMproxy addon
│ │ ├── db.py # Database operations
│ │ └── ...
│ ├── pyproject.toml # Python dependencies
│ └── main.py # Entry point
│
├── frontend/ # React/TypeScript frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── lib/ # Utilities and API client
│ │ ├── pages/ # Page components
│ │ └── ...
│ ├── package.json # Node dependencies
│ └── vite.config.ts # Vite configuration
│
└── README.md # Project documentation
- Backend API: RESTful API endpoints in
backend/src/api/ - Proxy Manager: MITMproxy integration in
backend/src/proxy_manager.py - MITMproxy Addon: Request/response capture and interception logic in
backend/src/addon.py - Database: SQLite databases managed in
backend/src/db.py - Frontend Components: React components in
frontend/src/components/ - UI Library: shadcn/ui components in
frontend/src/components/ui/
Moxy uses MITMproxy as an intercepting HTTP/HTTPS proxy to capture and modify traffic during dynamic application security testing. The proxy runs on port 8081 by default.
The addon.py file contains the ProxyRecorder addon class that integrates Moxy with MITMproxy. This addon is responsible for:
- Request/Response Capture: Captures HTTP requests and responses as they flow through the proxy, storing them in the project database
- Request Interception: When intercept mode is enabled, the addon can pause requests and wait for user action (forward, drop, or modify)
- Flow Management: Manages intercepted flows, allowing users to forward or drop requests individually or in bulk
- Database Integration: Synchronizes intercepted flow state with the database, allowing the API and frontend to query and control intercepted requests
- Project Switching: Automatically handles project changes and clears intercepted flows when switching between projects
Key Methods:
request()- Called when a request is complete; saves the request and handles interceptionresponse()- Called when a response is received; updates the saved request with response datarequestheaders()- Called when request headers are received; checks for forward commands_check_forward_commands()- Periodically checks the database for forward/drop commands from the API_save_request()- Saves request data to the project database_update_with_response()- Updates saved requests with response data
Important Notes:
- The addon runs in a separate process from the main Flask API server
- Communication between the addon and API happens through the database (using
db.get_proxy_state()anddb.set_proxy_state()) - The addon uses a background thread for periodic checks since
tick()doesn't work inmitmdump(non-interactive) mode - When intercept mode is disabled, all queued intercepted flows are automatically forwarded
When working on proxy-related features, familiarize yourself with the MITMproxy addon API and the addon.py implementation to understand how requests flow through the system.
When making database changes:
- Consider migration strategies
- Document schema changes
- Be aware of potential data loss
If you have questions about contributing:
- Check existing issues and discussions
- Open a new issue with the
questionlabel - Review the codebase to understand patterns
Thank you for contributing to Moxy! 🚀