This guide provides everything you need to know to start developing and contributing to the MalwareMinimizer project.
- Project Architecture
- Development Environment Setup
- Project Structure
- Coding Standards
- Testing Approach
- Submitting Changes
MalwareMinimizer follows a modular architecture designed to separate concerns and allow for easy testing and extension:
┌────────────┐ ┌────────────┐ ┌────────────┐
│ CLI │─────▶│ Scanner │─────▶│ Database │
└────────────┘ └────────────┘ └────────────┘
│ │ │
│ │ │
▼ ▼ ▼
┌────────────┐ ┌────────────┐ ┌────────────┐
│ Quarantine │◀─────│ Detection │◀─────│ Signatures │
└────────────┘ └────────────┘ └────────────┘
- CLI (
src/cli/): Handles user interaction, parses commands and options. - Scanner (
src/scanner/): Manages file traversal and detection logic for both fast and deep scans. - Database (
src/database/): Manages local storage of malware signatures and updates. - Quarantine (
src/quarantine/): Handles isolation and management of detected threats. - Utils (
src/utils/): Common utilities used across components.
-
Scanning Workflow:
- CLI parses the scan command and options
- Scanner recursively traverses the target path
- For each file, compute hash and check against signature database
- If deep scan is enabled, perform additional heuristic analysis
- Return results to user
-
Quarantine Workflow:
- Identified threats are moved to a secure location
- Original metadata is preserved for potential restoration
- File permissions are modified to prevent execution
-
Database Update Workflow:
- Fetches latest signatures from trusted sources
- Validates and merges new signatures with local database
- Updates local database version information
- Rust (stable toolchain; see project setup script or rust-toolchain if present)
- Python 3.11
- Git
We provide a setup script for Linux and macOS:
# Clone the repository
git clone https://github.com/Jordan231111/MalwareMinimizer.git
cd MalwareMinimizer
# Run the setup script
./scripts/setup.shNote: scripts/setup.sh installs the stable toolchain by default.
For Windows, please see the manual setup instructions below.
-
Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup default stable
-
Install Python 3.11:
- macOS:
brew install python@3.11 - Linux: Use your distribution's package manager
- Windows: Download from python.org
- macOS:
-
Install Python dependencies (for helper scripts/tests):
python3.11 -m pip install requests pytest rich
-
Install system dependencies (only if required):
- If
reqwestuses native TLS, you may need OpenSSL:- macOS:
brew install openssl pkg-config - Linux:
sudo apt install pkg-config libssl-dev build-essential
- macOS:
- If
-
Build the project:
cargo build
MalwareMinimizer/
├── .github/ # GitHub-specific configs (workflows, etc.)
├── benches/ # Performance benchmarks
├── docs/ # Documentation
├── python_scripts/ # Python helper scripts
├── scripts/ # Development and installation scripts
├── src/ # Rust source code
│ ├── cli/ # Command-line interface
│ ├── database/ # Signature database
│ ├── quarantine/ # Threat isolation
│ ├── scanner/ # File scanning engine
│ └── utils/ # Common utilities
├── tests/ # Test suite
│ ├── integration/ # Integration tests
│ ├── security/ # Security-specific tests
│ └── README.md # Testing guide
├── Cargo.toml # Rust dependencies and config
├── Cargo.lock # Lock file for dependencies
├── deny.toml # Dependency vulnerability checking
└── README.md # Project overview
-
Formatting:
- We follow the Rust standard formatting guidelines
- Run
cargo fmtbefore committing code - CI will enforce formatting through GitHub Actions
-
Code Quality:
- Use
cargo clippyto catch common mistakes - Address all warnings or document why they're being suppressed
- Comment functions with rustdoc-style documentation
- Use
-
Error Handling:
- Use the
anyhowcrate for error context and propagation - Define custom errors with
thiserrorwhen appropriate - Avoid
.unwrap()or.expect()in production code paths (allowed in tests)
- Use the
-
Logging:
- Use the
logcrate for all logging - Appropriate log levels:
error!: For user-facing errorswarn!: For concerning but non-fatal issuesinfo!: For normal operation informationdebug!: For developer debugging informationtrace!: For detailed tracing
- Use the
We follow the Conventional Commits specification:
feat:: New featuresfix:: Bug fixesdocs:: Documentation changesstyle:: Formatting changesrefactor:: Code refactoring without functionality changesperf:: Performance improvementstest:: Adding or fixing testschore:: Maintenance tasks
Example: feat: implement deep scan heuristic detection
MalwareMinimizer employs a comprehensive testing strategy:
-
Unit Tests:
- Test individual components in isolation (within module files)
- Run with
cargo test --lib
-
Integration Tests:
- Test how components work together
- Located in
tests/integration/ - Run with
cargo test --test integration
-
Security Tests:
- Focus on security-specific aspects
- Located in
tests/security/ - Run with
cargo test --test security
-
Performance Benchmarks:
- Located in
benches/ - Run with
cargo bench
- Located in
-
Test Data:
- Never use real malware, even in tests
- Use the EICAR test string for simulating detections
# Run all tests
cargo test
# Run with detailed output
cargo test -- --nocapture
# Run specific test
cargo test test_name
# Run benchmarks
cargo bench-
Fork the repository:
- Create your own fork of the repository
-
Create a feature branch:
- Name it according to the feature or fix you're implementing
- Example:
feature/deep-scan-implementation
-
Make your changes:
- Follow coding standards
- Add tests for new functionality
- Update documentation as needed
-
Run tests locally:
- Ensure all tests pass with
cargo test - Run clippy with
cargo clippy - Format code with
cargo fmt
- Ensure all tests pass with
-
Submit a pull request:
- Provide a clear description of the changes
- Link to any related issues
- Include screenshots or examples if applicable
-
Code review:
- Address any feedback from maintainers
- Make necessary adjustments
- Once approved, your changes will be merged
-
Build Failures:
- Check that you're using the stable Rust toolchain
- Ensure all dependencies are installed
-
Test Failures:
- Check if tests are platform-specific
- Ensure your environment is properly configured
-
Permission Issues:
- Some tests may require elevated permissions on certain platforms
-
Antivirus False Positives on Windows:
- The test suite uses the EICAR test string, which Windows Defender and other antivirus software may flag as malware.
- If tests fail or compiled binaries are deleted, add an exclusion for the project folder:
- Windows Security > Virus & threat protection > Manage settings > Exclusions
- Add an exclusion for the project root directory.
For any other issues, please check the GitHub issues page or create a new issue.
This project expects contributors to be comfortable with Rust basics, error handling, and testing. The path below is designed to get a new contributor productive within a week.
Minimum (required for the week, ~60–90 minutes/day):
- The Rust Programming Language (The Book)
Read Chapters 1–4, then skim Chapters 6, 9, and 11 (enums, error handling, tests). - Rust by Example
Use it only as a quick reference when a concept is unclear.
Optional (if you have extra time):
3. Rustlings (hands-on exercises)
4. Exercism (Rust Track) (practice problems + feedback)
5. Rust API Guidelines (for idiomatic APIs)
6. Cargo Book + Rust Reference (tooling + language reference)
7. Rustonomicon (only if working with unsafe or FFI)
Goal: Ship a small, production-quality feature + tests + documentation in one week. This builds confidence in the codebase and establishes habits.
Suggested mini project (recommended): Add a hash subcommand
What it does:
- Computes file hashes (sha256/sha1/md5) for a path or list of paths
- Outputs a JSON summary and a human-readable summary
- Respects size limits and error handling conventions
Deliverables:
- Rust implementation + tests
- CLI documentation update (
CLI_USER_DOC.md) - Architecture note update (where the new command lives)
- Short write-up in the PR describing design decisions
Week plan (not overwhelming):
- Day 1 (60–90 min): Read The Book Chapters 1–4, run
cargo test, skim CLI commands. - Day 2 (60–90 min): Implement command skeleton + argument parsing.
- Day 3 (60–90 min): Add hashing logic + unit tests.
- Day 4 (60–90 min): Add integration tests + update CLI docs.
- Day 5 (30–60 min): Polish error handling, write a short design note, open PR.
What you can skip this week:
- Async Rust
- Unsafe Rust
- Macro-heavy patterns
- Performance tuning and benchmarks