How snyk-labs/github-actions-scanner works
Main Components
a) Core Scanner Engine:
• Represented by lib/scanner.mjs
• This is the main orchestrator of the scanning process
b) Rule Engine:
• This as a major component connected to the scanner
• Rule system (lib/rules/) with individual rule implementations
• Common utilities shared between rules (lib/rules/common/)
c) Input Processing:
• Different input methods:
• Single repository scanning
• Organization-wide scanning
• Action list scanning
• Clone functionality
d) Output Handling:
• Output processing system (lib/outputHandler.mjs)
• Different output formats (JSON and text)
Component Relationships
Input Sources → Scanner Engine → Rule Engine → Output Handler
• ↓
• Git Cloning
• (lib/clone.mjs)
Detailed Design Elements
• CMD_EXEC
• CODE_INJECTION
• PWN_REQUEST
• REPOJACKABLE
• UNPINNED_ACTION
• WORKFLOW_RUN
• UNSAFE_INPUT_ASSIGN
Flow Representation
Scanning process flow:
1. Input Reception → 2. Repository Cloning → 3. Action Analysis → 4. Rule Application → 5. Finding Generation → 6. Output Formatting
External Dependencies
• GitHub API integration
• Environment configuration handling
Top Layer: User Interface (CLI Commands)
↓
Middle Layer: Scanner Core + Rule Engine
↓
Bottom Layer: GitHub Integration + File System Operations
Additional Elements
• Different node types
• Connection types (data flow vs. control flow)
• Rule severity levels
Technical Details to Highlight
• Async operation flows
• Rule evaluation pipeline
• Finding generation process
• Output format transformation
Remember to:
• Keep the abstraction level appropriate for a security scanning tool
• Extensibility of the rule system
• Clear boundaries between scanning, rule processing, and output generation
• Error handling flows
• Nested components
• Directional flows
• Clear labeling
• Export to common formats