Contributing to Spider-Nix
Thank you for your interest in contributing to Spider-Nix! This document provides guidelines and instructions for contributing.
Development Setupβ
Prerequisitesβ
- NixOS or Nix package manager (2.4+)
- Git
- Basic Python knowledge
Getting Startedβ
-
Fork and Clone
git clone https://github.com/VoidNxSEC/spider-nix.gitcd spider-nix -
Enter Development Environment
nix developThis command:
- Installs Python 3.13 with all dependencies
- Sets up Playwright browsers
- Configures development tools (pytest, ruff, mypy, bandit)
- Adds
spider, uv, pre-commit, and compatibility tooling
-
Install Hooks
spider hooks-install -
Verify Setup
spider testspider check
Development Workflowβ
Branch Strategyβ
main- Production-ready codefeature/*- New featuresfix/*- Bug fixesdocs/*- Documentation updates
Making Changesβ
-
Create Feature Branch
git checkout -b feature/your-feature-name -
Make Changes
- Write code following our Code Style
- Add tests for new functionality
- Update documentation if needed
-
Run Quality Checks
spider ci-local # Runs full CI pipeline locally -
Commit Changes
git add .git commit -m "feat: add awesome feature"Pre-commit hooks will:
- Auto-format code with ruff
- Run type checking with mypy
- Check for secrets and large files
- Run quick test suite
-
Push and Create PR
git push origin feature/your-feature-nameOpen a Pull Request on GitHub.
Code Styleβ
Python Style Guideβ
We use Ruff for both linting and formatting:
# Format code
ruff format .
# Check linting
ruff check .
# Fix auto-fixable issues
ruff check --fix .
Key Conventions:
- Line length: 100 characters
- Python 3.11+ features encouraged
- Type hints preferred (but not required yet)
- Docstrings for public APIs
Async/Await Patternsβ
# Good: Use async/await throughout
async def fetch_data(url: str) -> dict:
async with httpx.AsyncClient() as client:
response = await client.get(url)
return response.json()
# Bad: Mixing sync and async
def fetch_data(url: str) -> dict:
loop = asyncio.get_event_loop()
return loop.run_until_complete(async_fetch(url))
Configuration Managementβ
Use Pydantic models for configuration:
from pydantic import BaseModel, Field
class FeatureConfig(BaseModel):
timeout: int = Field(default=30, gt=0)
retries: int = Field(default=3, ge=0)
Testingβ
Writing Testsβ
Tests live in tests/ and mirror the src/ structure:
tests/
βββ test_crawler.py
βββ test_browser.py
βββ osint/
β βββ test_reconnaissance.py
β βββ test_scanner.py
Test Requirements:
- All new features must have tests
- Aim for 80%+ coverage
- Use pytest fixtures for setup
- Use pytest-asyncio for async tests
Example Test:
import pytest
from spider_nix.crawler import SpiderNix
@pytest.mark.asyncio
async def test_crawler_basic():
"""Test basic crawling functionality."""
crawler = SpiderNix(max_pages=5)
results = await crawler.crawl("https://example.com")
assert len(results) > 0
assert results[0]["url"] == "https://example.com"
assert "title" in results[0]
Running Testsβ
# All tests
spider test
# With coverage
spider test-cov
# Specific file
pytest tests/test_crawler.py
# Specific test
pytest tests/test_crawler.py::test_crawler_basic
# Watch mode (re-run on changes)
pytest-watch
Coverage Goalsβ
- Minimum: 70% overall coverage
- Target: 80%+ coverage
- Critical paths: 90%+ (crawler, OSINT modules)
Securityβ
Security Guidelinesβ
-
Never commit secrets
- Use environment variables
- Add secrets to
.env(ignored by git) - Use pre-commit hooks to detect accidental commits
-
Input Validation
- Validate all user inputs
- Use Pydantic models for structured data
- Sanitize URLs and file paths
-
Dependency Management
- Review dependencies before adding
- Run
spider securityto scan for vulnerabilities - Update dependencies regularly
Reporting Security Issuesβ
See SECURITY.md for how to report vulnerabilities.
Pull Request Processβ
PR Checklistβ
Before submitting, ensure:
- Code follows style guidelines (ruff passes)
- Tests added for new functionality
- All tests pass (
spider test) - Type checking passes (
spider typecheck) - Security scans pass (
spider security) - Documentation updated if needed
- Commit messages follow Conventional Commits
PR Guidelinesβ
Good PR Title Examples:
feat: add subdomain enumeration via certificate transparencyfix: resolve race condition in proxy rotatordocs: add examples for job-hunt commandperf: optimize crawler request pooling
PR Description Should Include:
- Summary of changes
- Motivation/context
- Testing performed
- Screenshots (if UI changes)
- Breaking changes (if any)
Review Processβ
- Automated CI runs (lint, test, security)
- Code review by maintainer
- Requested changes addressed
- Final approval and merge
Development Commands Referenceβ
# Setup
spider hooks-install # Install pre-commit hooks
# Development
spider test # Run tests
spider test-cov # Tests with coverage
spider check # Run linters
spider typecheck # Run type checking
spider security # Run security scans
spider ci-local # Full CI simulation
# Utilities
spider crawl <url> # Quick crawler test
spider proxy-fetch # Fetch public proxies
spider clean # Clean artifacts
Questions?β
- Bug reports: Open an issue
- Feature requests: Start a discussion
- Security issues: See SECURITY.md
Thank you for contributing to Spider-Nix!