Thank you for considering contributing to VulnLab! This document provides guidelines and best practices for contributions.
- Code of Conduct
- How to Contribute
- Code Standards
- Project Structure
- Adding New Containers
- Testing
- Review Process
This project adheres to principles of mutual respect and constructive collaboration. We expect all contributors to:
- Be respectful and inclusive
- Accept constructive criticism
- Focus on what is best for the community
- Maintain professional communication
Before reporting a bug:
- Check if an open issue already exists.
- Try to reproduce the problem in a clean installation.
- Collect relevant information (Docker version, OS, logs).
When creating the issue, include:
- A clear description of the problem.
- Steps to reproduce.
- Expected vs. actual behavior.
- Relevant logs.
- Environment (OS, versions).
For enhancement suggestions:
- Check if a similar issue already exists.
- Clearly describe the proposed enhancement.
- Explain the benefit to the project.
- If possible, suggest an implementation.
- Fork the repository.
- Create a branch for your feature:
git checkout -b feature/new-feature - Make atomic and descriptive commits.
- Update the documentation if necessary.
- Test your changes.
- Open a Pull Request.
Use clear and descriptive commit messages:
type(scope): short description
Optional body with more details.
Refs: #123
Types:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Formatting (does not affect code)refactor: Code refactoringtest: Adding or correcting testschore: Maintenance tasks
Examples:
feat(scanner): add support for multiple report formats
fix(lab): correct IP parsing in the ips command
docs(readme): update installation section
- Use
#!/bin/bashas the shebang. - Include
set -eto fail on errors. - Use the common library
lib/common.sh. - Prefer uppercase variable names.
- Document functions with comments.
- Use
shellcheckfor validation.
#!/bin/bash
set -e
source "$(dirname "${BASH_SOURCE[0]}")/lib/common.sh"
# Description of the function
# Args:
# $1 - First argument
my_function() {
local arg1="$1"
# implementation
}- Follow PEP 8.
- Use type hints.
- Document functions with docstrings (Google style).
- Keep functions small and focused.
- Use logging instead of print.
def my_function(param: str) -> bool:
"""
Brief description of the function.
Args:
param: Description of the parameter.
Returns:
Description of the return value.
Raises:
ValueError: When param is invalid.
"""
pass- Use version 3.8 or higher.
- Keep binding to
127.0.0.1for all ports. - Use descriptive names for services.
- Document known CVEs in comments.
- Organize services by category.
trabalho/
├── lab.sh # Main orchestration script
├── docker-compose.yml # Container definitions
├── lib/
│ └── common.sh # Common functions library
├── scanner/
│ ├── openvas_scanner.py # Main scanner
│ ├── run.sh # Scanner wrapper
│ └── config.yaml # Configuration
├── scripts/
│ └── generate_compose.py # Utilities
├── docs/
│ └── ... # Additional documentation
└── README.md # Main documentation
Before adding a new vulnerable container:
- Verify it doesn't duplicate an existing one.
- Confirm the image is available on Docker Hub.
- Document the known vulnerabilities.
- Test locally.
- Update the documentation.
Add to docker-compose.yml:
# CATEGORY: Service Name
# Vulnerabilities: CVE-XXXX-YYYY, CVE-ZZZZ-WWWW
service-name:
image: image:version
container_name: service-name
networks:
vulnnet:
ipv4_address: 172.30.X.Y
ports:
- "127.0.0.1:HOST_PORT:CONTAINER_PORT"
environment:
- VARIABLE=valueAdd an entry in the appropriate section of the catalog:
| Service | Image | IP | Port | Vulnerabilities |
|---|---|---|---|---|
service-name |
image:version |
172.30.X.Y |
PORT:PORT |
CVE-XXXX-YYYY |
Before submitting a PR:
-
Compose Syntax:
docker-compose config
-
Initialization:
./lab.sh start service-name ./lab.sh status
-
Connectivity:
./lab.sh ips | grep service-name curl http://127.0.0.1:PORT -
Bash Scripts:
shellcheck lab.sh scanner/*.sh -
Python Scripts:
python -m py_compile scanner/openvas_scanner.py
- Functionality: Does the code do what it should?
- Security: Does it follow security best practices (localhost binding, etc.)?
- Quality: Is the code clean, documented, and without duplication?
- Tests: Was it tested locally?
- Documentation: Is the README updated if necessary?
- Simple PRs: 1-3 days
- Complex PRs: 3-7 days
If you have questions about contributing, open an issue with the question tag or contact the maintainers.
We appreciate your contribution!