Thank you for your interest in contributing to SetupSentry.
git clone https://github.com/Pavithran-R-A/setupsentry.git
cd setupsentry
npm installnpm run build # Compile TypeScript
npm run typecheck # Type checking
npm run lint # Lint source code
npm test # Run testssrc/
├── cli.ts # CLI entry point
├── scan.ts # Main scan orchestration
├── engine.ts # Rule execution engine
├── discovery.ts # File discovery and filtering
├── markdown.ts # Markdown code block extraction
├── types.ts # Core type definitions
├── index.ts # Public API exports
├── rules/
│ ├── index.ts # Rule registry
│ ├── ss001.ts # SS001: Remote script piped to shell
│ ├── ss002.ts # SS002: Process substitution
│ ├── ss003.ts # SS003: Alternate Python index
│ ├── ss004.ts # SS004: Registry override
│ ├── ss005.ts # SS005: Git URL rewrite
│ ├── ss006.ts # SS006: Download and execute
│ ├── ss007.ts # SS007: Encoded content execution
│ ├── ss008.ts # SS008: Destructive commands
│ ├── ss009.ts # SS009: Insecure transport
│ └── ss010.ts # SS010: Remote command substitution
└── reporters/
├── pretty.ts # Terminal output formatter
└── json.ts # JSON output formatter
- Create
src/rules/ssXXX.ts - Implement the
Ruleinterface - Register the rule in
src/rules/index.ts - Create positive and negative tests in
tests/rules.test.ts
interface Rule {
id: string; // e.g., "SS011"
severity: Severity; // "critical" | "high" | "medium" | "low"
title: string;
description: string;
scan(context: ScanContext): Finding[];
}Every new security rule requires:
- Positive cases: Content that should trigger the rule
- Negative cases: Safe content that should NOT trigger the rule
- Deterministic: Same input always produces same output
- Local and offline: No network requests
- Conservative: Prefer missing a pattern over false positives
- Explainable: Every finding must have clear explanation and remediation
npm testTests cover:
- Individual rule behavior (positive and negative cases)
- Markdown code block extraction
- File discovery and exclusions
- Score calculation
- Output formatting (pretty and JSON)
- Integration with fixtures
- TypeScript strict mode
- ESM modules
- No runtime dependencies for core logic
- Prefer explicit types over
any
The scanner must never execute discovered commands. Tests must never execute commands found in fixtures.