# rohit0265/scanvice architecture

> Architecture diagram of the GitHub repository rohit0265/scanvice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohit0265/scanvice
- Repository: https://github.com/rohit0265/scanvice

## Overview

Secure Code Scanner is a VS Code extension for finding JavaScript/TypeScript security issues. Users scan an open file or workspace, or have documents rescanned on editor events; findings become editor diagnostics and hover details, with optional AI verification. The internal scan path preprocesses and parses source, extracts scope, then runs configurable security rules and deduplicates findings. The graph includes the six rule implementations, taint analysis, and editor-facing features. The README contains no additional capability detail; unsampled subsystems are included only where the source index establishes them.

Main entry points: [`src/analyzers/fast/ruleEngine.ts`](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/ruleEngine.ts) (Rule Engine), [`src/extension.ts`](https://github.com/rohit0265/scanvice/blob/main/src/extension.ts) (Extension Orchestrator), [`src/scanner/scanner.ts`](https://github.com/rohit0265/scanvice/blob/main/src/scanner/scanner.ts) (Source Scanner), [`src/ast/parser.ts`](https://github.com/rohit0265/scanvice/blob/main/src/ast/parser.ts) (JS/TS Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["VS Code Extension"]
  node_extension["Extension Orchestrator<br/>[extension.ts]"]
end

subgraph group_pipeline["Scan Pipeline"]
  node_scanner["Source Scanner<br/>[scanner.ts]"]
  node_preprocessor["Source Preprocessor<br/>[preprocessor.ts]"]
  node_parser["JS/TS Parser<br/>[parser.ts]"]
  node_scope["Scope Extractor<br/>[scopeExtractor.ts]"]
end

subgraph group_analysis["Security Analysis"]
  node_ruleengine["Rule Engine<br/>[ruleEngine.ts]"]
  node_taint["Taint Utilities<br/>[taintUtils.ts]"]
  node_sql["SQL Injection Rule<br/>[sqlInjection.ts]"]
  node_xss["XSS Rule<br/>[xss.ts]"]
  node_command["Command Injection Rule"]
  node_traversal["Path Traversal Rule<br/>[pathTraversal.ts]"]
  node_secrets["Secrets Rule<br/>[secrets.ts]"]
  node_authentication["Authentication Rule<br/>[authentication.ts]"]
  node_securityrule["Rule Contracts<br/>[securityRule.ts]"]
  node_vulnerability["Finding Model<br/>[vulnerability.ts]"]
end

subgraph group_editor["Finding Experience"]
  node_diagnostics["Diagnostics Manager"]
  node_hover["Finding Hover<br/>[hoverProvider.ts]"]
  node_actions["Quick Fix Actions"]
end

subgraph group_verification["AI Verification"]
  node_llm["AI Verifier<br/>[llmClient.ts]"]
end

node_user(("Developer"))
node_aiproviders{{"LLM Services"}}

node_user -->|"uses commands"| node_extension
node_extension -->|"scans documents"| node_scanner
node_scanner -->|"preprocesses source"| node_preprocessor
node_scanner -->|"parses source"| node_parser
node_scanner -->|"extracts scope"| node_scope
node_scanner -->|"analyzes context"| node_ruleengine
node_ruleengine -->|"runs rule"| node_sql
node_ruleengine -->|"runs rule"| node_xss
node_ruleengine -->|"runs rule"| node_command
node_ruleengine -->|"runs rule"| node_traversal
node_ruleengine -->|"runs rule"| node_secrets
node_ruleengine -->|"runs rule"| node_authentication
node_ruleengine -->|"uses taint analysis"| node_taint
node_xss -->|"checks untrusted data"| node_taint
node_command -->|"uses taint analysis"| node_taint
node_traversal -->|"uses taint analysis"| node_taint
node_sql -->|"gets node ranges"| node_parser
node_xss -->|"gets node ranges"| node_parser
node_authentication -->|"gets node ranges"| node_parser
node_ruleengine -->|"uses rule contracts"| node_securityrule
node_ruleengine -->|"returns findings"| node_vulnerability
node_extension -->|"applies findings"| node_diagnostics
node_extension -->|"sets findings"| node_hover
node_extension -->|"registers provider"| node_actions
node_diagnostics -->|"renders findings"| node_vulnerability
node_hover -->|"displays findings"| node_vulnerability
node_extension -->|"verifies findings"| node_llm
node_llm -->|"sends verification request"| node_aiproviders

click node_extension "https://github.com/rohit0265/scanvice/blob/main/src/extension.ts"
click node_scanner "https://github.com/rohit0265/scanvice/blob/main/src/scanner/scanner.ts"
click node_preprocessor "https://github.com/rohit0265/scanvice/blob/main/src/scanner/preprocessor.ts"
click node_parser "https://github.com/rohit0265/scanvice/blob/main/src/ast/parser.ts"
click node_scope "https://github.com/rohit0265/scanvice/blob/main/src/scanner/scopeExtractor.ts"
click node_ruleengine "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/ruleEngine.ts"
click node_taint "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/taintUtils.ts"
click node_sql "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/sqlInjection.ts"
click node_xss "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/xss.ts"
click node_command "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/commandInjection.ts"
click node_traversal "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/pathTraversal.ts"
click node_secrets "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/secrets.ts"
click node_authentication "https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/authentication.ts"
click node_securityrule "https://github.com/rohit0265/scanvice/blob/main/src/models/securityRule.ts"
click node_vulnerability "https://github.com/rohit0265/scanvice/blob/main/src/models/vulnerability.ts"
click node_diagnostics "https://github.com/rohit0265/scanvice/blob/main/src/diagnostics/diagnosticManager.ts"
click node_hover "https://github.com/rohit0265/scanvice/blob/main/src/providers/hoverProvider.ts"
click node_actions "https://github.com/rohit0265/scanvice/blob/main/src/providers/codeActionProvider.ts"
click node_llm "https://github.com/rohit0265/scanvice/blob/main/src/ai/llmClient.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_extension toneBlue
class node_scanner,node_preprocessor,node_parser,node_scope toneAmber
class node_ruleengine,node_taint,node_sql,node_xss,node_command,node_traversal,node_secrets,node_authentication,node_securityrule,node_vulnerability toneMint
class node_diagnostics,node_hover,node_actions toneRose
class node_llm,node_user,node_aiproviders toneIndigo
```

## Components

### VS Code Extension

- [Extension Orchestrator](https://github.com/rohit0265/scanvice/blob/main/src/extension.ts): `src/extension.ts`

### Scan Pipeline

- [Source Scanner](https://github.com/rohit0265/scanvice/blob/main/src/scanner/scanner.ts): `src/scanner/scanner.ts`
- [Source Preprocessor](https://github.com/rohit0265/scanvice/blob/main/src/scanner/preprocessor.ts): `src/scanner/preprocessor.ts`
- [JS/TS Parser](https://github.com/rohit0265/scanvice/blob/main/src/ast/parser.ts): `src/ast/parser.ts`
- [Scope Extractor](https://github.com/rohit0265/scanvice/blob/main/src/scanner/scopeExtractor.ts): `src/scanner/scopeExtractor.ts`

### Security Analysis

- [Rule Engine](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/ruleEngine.ts): `src/analyzers/fast/ruleEngine.ts`
- [Taint Utilities](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/taintUtils.ts): `src/analyzers/fast/taintUtils.ts`
- [SQL Injection Rule](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/sqlInjection.ts): `src/analyzers/fast/sqlInjection.ts`
- [XSS Rule](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/xss.ts): `src/analyzers/fast/xss.ts`
- [Command Injection Rule](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/commandInjection.ts): `src/analyzers/fast/commandInjection.ts`
- [Path Traversal Rule](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/pathTraversal.ts): `src/analyzers/fast/pathTraversal.ts`
- [Secrets Rule](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/secrets.ts): `src/analyzers/fast/secrets.ts`
- [Authentication Rule](https://github.com/rohit0265/scanvice/blob/main/src/analyzers/fast/authentication.ts): `src/analyzers/fast/authentication.ts`
- [Rule Contracts](https://github.com/rohit0265/scanvice/blob/main/src/models/securityRule.ts): `src/models/securityRule.ts`
- [Finding Model](https://github.com/rohit0265/scanvice/blob/main/src/models/vulnerability.ts): `src/models/vulnerability.ts`

### Finding Experience

- [Diagnostics Manager](https://github.com/rohit0265/scanvice/blob/main/src/diagnostics/diagnosticManager.ts): `src/diagnostics/diagnosticManager.ts`
- [Finding Hover](https://github.com/rohit0265/scanvice/blob/main/src/providers/hoverProvider.ts): `src/providers/hoverProvider.ts`
- [Quick Fix Actions](https://github.com/rohit0265/scanvice/blob/main/src/providers/codeActionProvider.ts): `src/providers/codeActionProvider.ts`

### AI Verification

- [AI Verifier](https://github.com/rohit0265/scanvice/blob/main/src/ai/llmClient.ts): `src/ai/llmClient.ts`

### Other components

- **Developer**
- **LLM Services**

## Connections

- Developer → Extension Orchestrator: uses commands (evidence: `src/extension.ts`)
- Extension Orchestrator → Source Scanner: scans documents (evidence: `src/extension.ts`)
- Source Scanner → Source Preprocessor: preprocesses source (evidence: `src/scanner/scanner.ts`)
- Source Scanner → JS/TS Parser: parses source (evidence: `src/scanner/scanner.ts`)
- Source Scanner → Scope Extractor: extracts scope (evidence: `src/scanner/scanner.ts`)
- Source Scanner → Rule Engine: analyzes context (evidence: `src/scanner/scanner.ts`)
- Rule Engine → SQL Injection Rule: runs rule (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Rule Engine → XSS Rule: runs rule (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Rule Engine → Command Injection Rule: runs rule (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Rule Engine → Path Traversal Rule: runs rule (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Rule Engine → Secrets Rule: runs rule (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Rule Engine → Authentication Rule: runs rule (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Rule Engine → Taint Utilities: uses taint analysis (evidence: `src/analyzers/fast/ruleEngine.ts`)
- XSS Rule → Taint Utilities: checks untrusted data (evidence: `src/analyzers/fast/xss.ts`)
- Command Injection Rule → Taint Utilities: uses taint analysis (evidence: `src/analyzers/fast/commandInjection.ts`)
- Path Traversal Rule → Taint Utilities: uses taint analysis (evidence: `src/analyzers/fast/pathTraversal.ts`)
- SQL Injection Rule → JS/TS Parser: gets node ranges (evidence: `src/analyzers/fast/sqlInjection.ts`)
- XSS Rule → JS/TS Parser: gets node ranges (evidence: `src/analyzers/fast/xss.ts`)
- Authentication Rule → JS/TS Parser: gets node ranges (evidence: `src/analyzers/fast/authentication.ts`)
- Rule Engine → Rule Contracts: uses rule contracts (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Rule Engine → Finding Model: returns findings (evidence: `src/analyzers/fast/ruleEngine.ts`)
- Extension Orchestrator → Diagnostics Manager: applies findings (evidence: `src/extension.ts`)
- Extension Orchestrator → Finding Hover: sets findings (evidence: `src/extension.ts`)
- Extension Orchestrator → Quick Fix Actions: registers provider (evidence: `src/extension.ts`)
- Diagnostics Manager → Finding Model: renders findings (evidence: `src/diagnostics/diagnosticManager.ts`)
- Finding Hover → Finding Model: displays findings (evidence: `src/providers/hoverProvider.ts`)
- Extension Orchestrator → AI Verifier: verifies findings (evidence: `src/extension.ts`)
- AI Verifier → LLM Services: sends verification request (evidence: `src/ai/llmClient.ts`)
