Thank you for your interest in contributing to react2shell-guard! This document provides guidelines and information for contributors.
Please read and follow our Code of Conduct.
- Check existing issues - Search the issue tracker to see if the bug has already been reported.
- Create a new issue - If not found, create a new issue using the bug report template.
- Provide details - Include:
- Version of react2shell-guard
- Node.js version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
- Relevant log output
- Check existing requests - Search issues for similar feature requests.
- Create a feature request - Use the feature request template.
- Describe the use case - Explain why this feature would be valuable.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes
- Run tests:
npm test - Run type checking:
npx tsc --noEmit - Commit your changes with a descriptive message
- Push to your fork:
git push origin feature/your-feature-name - Create a Pull Request
# Clone the repository
git clone https://github.com/gensecaihq/react2shell-scanner.git
cd react2shell-guard
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run in development mode
npm run devsrc/
cli/ # CLI entry point and commands
core/ # Core scanner logic
parsers/ # Lockfile parsers (npm, pnpm, yarn)
formatters/ # Output formatters (text, JSON, SARIF, HTML)
middleware/ # Runtime protection middleware
mcp/ # MCP server implementation
rules/ # CVE rule definitions
test/
unit/ # Unit tests
integration/ # Integration tests
examples/ # Example projects for testing
To add a new CVE rule:
- Create a new JSON file in
rules/directory - Follow the existing schema from
rules/cve-2025-55182.json - Include:
- CVE ID and title
- Severity and CVSS score
- Vulnerable package versions (semver ranges)
- Fixed versions
- Advisory URLs and references
Example:
{
"id": "CVE-YYYY-XXXXX",
"title": "Description of the vulnerability",
"severity": "critical",
"cvss": 9.8,
"packages": [
{
"name": "package-name",
"vulnerable": ">=1.0.0 <1.0.5",
"fixed": ["1.0.5"],
"notes": "Additional context"
}
]
}To add support for a new lockfile format:
- Create a new parser in
src/core/parsers/ - Implement the
ParsedLockfileinterface - Add detection logic in
src/core/scanner.ts - Add unit tests in
test/unit/parsers.test.ts
- Write tests for all new functionality
- Maintain existing test coverage
- Use descriptive test names
- Test edge cases and error conditions
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run specific test file
npm test -- test/unit/matcher.test.tsUse clear, descriptive commit messages:
feat: add support for Bun lockfilesfix: handle malformed pnpm-lock.yamldocs: update CLI options in READMEtest: add edge case tests for semver matchingrefactor: simplify rule loading logic
- Ensure all tests pass
- Update documentation if needed
- Add tests for new functionality
- Fill out the PR template completely
- Request review from maintainers
Feel free to open an issue for questions or join discussions in existing issues.
By contributing, you agree that your contributions will be licensed under the MIT License.