# `ExMCP.Content.SecurityScanner`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/content/security_scanner.ex#L1)

Security scanning utilities for MCP content.

This module handles all security-related content analysis including
malware detection, sensitive data scanning, and threat analysis.
Extracted from the original Content.Validation module.

# `scan_result`

```elixir
@type scan_result() :: %{
  threat_level: threat_level(),
  threats: [threat()],
  metadata: map()
}
```

Security scan result

# `scan_type`

```elixir
@type scan_type() ::
  :malware
  | :sensitive_data
  | :injection_attacks
  | :suspicious_patterns
  | :file_signatures
  | atom()
```

Security scan type

# `threat`

```elixir
@type threat() :: %{
  type: atom(),
  severity: threat_level(),
  description: String.t(),
  location: String.t() | nil,
  confidence: float()
}
```

Detected threat

# `threat_level`

```elixir
@type threat_level() :: :safe | :low | :medium | :high | :critical
```

Security threat level

# `analyze_suspicious_patterns`

```elixir
@spec analyze_suspicious_patterns(ExMCP.Content.Protocol.content()) :: [threat()]
```

Analyzes content for suspicious patterns.

# `detect_sensitive_data`

```elixir
@spec detect_sensitive_data(ExMCP.Content.Protocol.content()) :: [threat()]
```

Detects sensitive data in content.

# `scan_injection_attacks`

```elixir
@spec scan_injection_attacks(ExMCP.Content.Protocol.content()) :: [threat()]
```

Scans for injection attack patterns.

# `scan_malware`

```elixir
@spec scan_malware(ExMCP.Content.Protocol.content()) :: [threat()]
```

Scans for malware signatures.

# `scan_security`

```elixir
@spec scan_security(ExMCP.Content.Protocol.content(), [scan_type()]) ::
  {:ok, scan_result()} | {:error, String.t()}
```

Scans content for security threats.

## Examples

    case SecurityScanner.scan_security(content, [:malware, :sensitive_data]) do
      {:ok, %{threat_level: :safe}} -> 
        process_content(content)
      {:ok, %{threat_level: level, threats: threats}} -> 
        handle_security_threats(level, threats)
      {:error, reason} -> 
        handle_scan_error(reason)
    end

---

*Consult [api-reference.md](api-reference.md) for complete listing*
