# CVE Sentinel Integration

This project uses CVE Sentinel for automated vulnerability detection. When a session starts, the scanner runs in the background checking dependencies for known CVEs.

## Monitoring Scan Status

Check the scan status by reading `.cve-sentinel/status.json`:

```json
{
  "status": "scanning|completed|error",
  "started_at": "ISO 8601 timestamp"
}
```

### Status Values
- `scanning`: Scan is in progress
- `completed`: Scan finished successfully
- `error`: Scan encountered an error

## Viewing Results

When scan completes, results are available in `.cve-sentinel/results.json`:

```json
{
  "scan_time": "ISO 8601 timestamp",
  "project_path": "/path/to/project",
  "packages_scanned": 42,
  "vulnerabilities_found": 3,
  "vulnerabilities": [
    {
      "cve_id": "CVE-2021-XXXXX",
      "package": {
        "name": "package-name",
        "version": "1.0.0",
        "ecosystem": "npm|pypi|go|..."
      },
      "severity": "CRITICAL|HIGH|MEDIUM|LOW",
      "cvss_score": 9.8,
      "description": "...",
      "fix_version": "1.0.1",
      "fix_command": "npm install package-name@1.0.1",
      "affected_files": [
        {"file": "package.json", "line": 15}
      ]
    }
  ],
  "summary": {
    "critical": 1,
    "high": 2,
    "medium": 0,
    "low": 0
  }
}
```

## Recommended Actions

When vulnerabilities are found:

1. **Review Results**: Check `.cve-sentinel/results.json` for details
2. **Prioritize**: Address CRITICAL and HIGH severity issues first
3. **Apply Fixes**: Use the provided `fix_command` to update packages
4. **Verify**: Re-run the scan to confirm fixes

## Reporting to User

When the user asks about security or when the scan completes, provide a summary:

```
CVE Sentinel Scan Results:
- Packages scanned: 42
- Vulnerabilities found: 3 (1 Critical, 2 High)

Critical Issues:
1. CVE-2021-XXXXX in package-name@1.0.0
   Fix: npm install package-name@1.0.1
```

## Configuration

The scanner can be configured via `.cve-sentinel.yaml`:

```yaml
# Scan target directory (default: current directory)
target_path: .

# Paths to exclude from scanning
exclude:
  - node_modules/
  - vendor/
  - .git/

# Analysis depth (1=manifest, 2=lockfiles, 3=imports)
analysis_level: 2

# Auto-scan when session starts
auto_scan_on_startup: true

# Cache duration in hours
cache_ttl_hours: 24
```

## Commands

- Run scan manually: `python -m cve_sentinel --path .`
- Check status: `cat .cve-sentinel/status.json`
- View results: `cat .cve-sentinel/results.json`
- View logs: `cat .cve-sentinel/scanner.log`
