|
| 1 | +# Contributing to Cybersecurity Agent Platform |
| 2 | + |
| 3 | +Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this polyglot cybersecurity platform. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Code of Conduct](#code-of-conduct) |
| 8 | +- [Getting Started](#getting-started) |
| 9 | +- [Development Setup](#development-setup) |
| 10 | +- [Architecture Overview](#architecture-overview) |
| 11 | +- [Contribution Guidelines](#contribution-guidelines) |
| 12 | +- [Pull Request Process](#pull-request-process) |
| 13 | +- [Testing Requirements](#testing-requirements) |
| 14 | +- [Code Style](#code-style) |
| 15 | + |
| 16 | +## Code of Conduct |
| 17 | + |
| 18 | +This project adheres to a code of conduct. By participating, you are expected to uphold this code. Please be respectful and constructive in all interactions. |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +### Prerequisites |
| 23 | + |
| 24 | +| Component | Version | Purpose | |
| 25 | +|-----------|---------|---------| |
| 26 | +| Docker | 24.0+ | Container runtime | |
| 27 | +| Docker Compose | 2.20+ | Local orchestration | |
| 28 | +| Go | 1.21+ | Gateway service | |
| 29 | +| Python | 3.11+ | Brain service | |
| 30 | +| Rust | 1.70+ | Core scanner | |
| 31 | +| Node.js | 18+ | Dashboard | |
| 32 | +| PostgreSQL | 15+ | Database | |
| 33 | +| Redis | 7+ | Caching | |
| 34 | + |
| 35 | +### Quick Start |
| 36 | + |
| 37 | +```bash |
| 38 | +# Clone the repository |
| 39 | +git clone https://github.com/csa7mdm/Cypersecurity.git |
| 40 | +cd Cypersecurity |
| 41 | + |
| 42 | +# Start all services |
| 43 | +docker-compose up -d |
| 44 | + |
| 45 | +# Verify services are running |
| 46 | +docker-compose ps |
| 47 | + |
| 48 | +# Run tests |
| 49 | +./scripts/run-tests.sh |
| 50 | +``` |
| 51 | + |
| 52 | +## Development Setup |
| 53 | + |
| 54 | +### Gateway (Go) |
| 55 | + |
| 56 | +```bash |
| 57 | +cd gateway |
| 58 | +go mod download |
| 59 | +go build ./cmd/gateway |
| 60 | +go test ./... |
| 61 | +``` |
| 62 | + |
| 63 | +### Brain (Python) |
| 64 | + |
| 65 | +```bash |
| 66 | +cd brain |
| 67 | +python -m venv venv |
| 68 | +source venv/bin/activate # On Windows: venv\Scripts\activate |
| 69 | +pip install -e ".[dev]" |
| 70 | +pytest |
| 71 | +``` |
| 72 | + |
| 73 | +### Core Scanner (Rust) |
| 74 | + |
| 75 | +```bash |
| 76 | +cd core |
| 77 | +cargo build |
| 78 | +cargo test |
| 79 | +cargo clippy |
| 80 | +``` |
| 81 | + |
| 82 | +### Dashboard (React/TypeScript) |
| 83 | + |
| 84 | +```bash |
| 85 | +cd dashboard |
| 86 | +npm install |
| 87 | +npm run dev |
| 88 | +npm test |
| 89 | +``` |
| 90 | + |
| 91 | +## Architecture Overview |
| 92 | + |
| 93 | +``` |
| 94 | +┌─────────────────────────────────────────────────────────┐ |
| 95 | +│ Dashboard (React) │ |
| 96 | +├─────────────────────────────────────────────────────────┤ |
| 97 | +│ Gateway (Go/Gin) │ |
| 98 | +│ JWT Auth, RBAC, Rate Limiting │ |
| 99 | +├─────────────────┬───────────────────┬───────────────────┤ |
| 100 | +│ Brain (Py) │ Core (Rust) │ Database (PG) │ |
| 101 | +│ AI Analysis │ Fast Scanning │ Multi-tenant │ |
| 102 | +└─────────────────┴───────────────────┴───────────────────┘ |
| 103 | +``` |
| 104 | + |
| 105 | +## Contribution Guidelines |
| 106 | + |
| 107 | +### Types of Contributions |
| 108 | + |
| 109 | +1. **Bug Fixes**: Fix issues reported in GitHub Issues |
| 110 | +2. **Features**: Implement features from the roadmap or propose new ones |
| 111 | +3. **Documentation**: Improve docs, add examples, fix typos |
| 112 | +4. **Tests**: Add missing tests, improve coverage |
| 113 | +5. **Performance**: Optimize algorithms, reduce resource usage |
| 114 | + |
| 115 | +### Branch Naming |
| 116 | + |
| 117 | +| Type | Format | Example | |
| 118 | +|------|--------|---------| |
| 119 | +| Feature | `feature/description` | `feature/add-nmap-scanner` | |
| 120 | +| Bug Fix | `fix/description` | `fix/auth-token-expiry` | |
| 121 | +| Docs | `docs/description` | `docs/api-examples` | |
| 122 | +| Refactor | `refactor/description` | `refactor/scanner-module` | |
| 123 | + |
| 124 | +## Pull Request Process |
| 125 | + |
| 126 | +1. **Fork** the repository |
| 127 | +2. **Create** a feature branch from `main` |
| 128 | +3. **Make** your changes with clear commit messages |
| 129 | +4. **Add/Update** tests for your changes |
| 130 | +5. **Run** the full test suite locally |
| 131 | +6. **Update** documentation if needed |
| 132 | +7. **Submit** a pull request |
| 133 | + |
| 134 | +### PR Checklist |
| 135 | + |
| 136 | +- [ ] Code follows project style guidelines |
| 137 | +- [ ] Tests pass locally |
| 138 | +- [ ] New tests added for new features |
| 139 | +- [ ] Documentation updated |
| 140 | +- [ ] No security vulnerabilities introduced |
| 141 | +- [ ] Commits are signed (if required) |
| 142 | + |
| 143 | +## Testing Requirements |
| 144 | + |
| 145 | +### Minimum Coverage |
| 146 | + |
| 147 | +| Service | Required Coverage | |
| 148 | +|---------|-------------------| |
| 149 | +| Gateway (Go) | 70% | |
| 150 | +| Brain (Python) | 80% | |
| 151 | +| Core (Rust) | 70% | |
| 152 | +| Dashboard | 60% | |
| 153 | + |
| 154 | +### Test Types |
| 155 | + |
| 156 | +```bash |
| 157 | +# Unit tests |
| 158 | +go test ./... |
| 159 | +pytest tests/unit/ |
| 160 | +cargo test |
| 161 | + |
| 162 | +# Integration tests |
| 163 | +pytest tests/integration/ |
| 164 | + |
| 165 | +# E2E tests |
| 166 | +cd e2e_tests && npx playwright test |
| 167 | +``` |
| 168 | + |
| 169 | +## Code Style |
| 170 | + |
| 171 | +### Go |
| 172 | + |
| 173 | +- Follow [Effective Go](https://golang.org/doc/effective_go) |
| 174 | +- Use `gofmt` and `golangci-lint` |
| 175 | +- Maximum line length: 120 characters |
| 176 | + |
| 177 | +### Python |
| 178 | + |
| 179 | +- Follow PEP 8 |
| 180 | +- Use `ruff` for linting |
| 181 | +- Use `mypy` for type checking |
| 182 | +- Docstrings for public functions |
| 183 | + |
| 184 | +### Rust |
| 185 | + |
| 186 | +- Follow Rust idioms |
| 187 | +- Use `cargo fmt` and `cargo clippy` |
| 188 | +- Document public APIs |
| 189 | + |
| 190 | +### TypeScript |
| 191 | + |
| 192 | +- Follow project ESLint configuration |
| 193 | +- Use TypeScript strict mode |
| 194 | +- Prefer functional components with hooks |
| 195 | + |
| 196 | +## Questions? |
| 197 | + |
| 198 | +- Open a GitHub Discussion for questions |
| 199 | +- Check existing issues before creating new ones |
| 200 | +- Join our community chat (if available) |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +Thank you for contributing! |
0 commit comments