Antivirus Scanning (AV)
Antivirus scanning provides real-time protection against malicious files by scanning uploaded content. This feature helps prevent malware from being uploaded to your application.
Architecture
flowchart TD
A[Client Request]
--> B{HTTP method == POST?}
B -->|No| C[Skip AV scanning]
B -->|Yes| D{Content-Type == multipart/form-data?}
D -->|No| C
D -->|Yes| E[Run antivirus scan]
E --> F{AV scan result}
F -->|Clean| G[Forward to upstream]
F -->|Infected| H[Block request / Return 403]
C --> G
Configuration Structure
Configuration Options
Name
- Type: String
- Required: Yes
- Description: Unique identifier for the antivirus scan rule
- Example:
name: "test_av_scan"
Rule
- Type: String
- Required: Yes
- Description: Wirefilter expression to match requests
- Example:
rule: (http.request.uri.path starts_with "/")
Enabled
- Type: Boolean
- Default:
true
- Description: Whether the rule is active
- Example:
enabled: true
Best Practices
- Scan all file uploads
- Use specific path matching in rules
- Monitor scan results
- Keep antivirus definitions updated
- Log scan results for analysis
Example Configurations
Basic Scanning
Targeted Scanning
av_scan:
- name: "scan-documents"
rule: (http.request.uri.path contains "/documents")
enabled: true
- name: "scan-images"
rule: (http.request.uri.path contains "/images")
enabled: true
Common Use Cases
- Document Uploads: Scan uploaded documents for malware
- Image Uploads: Check images for malicious content
- File Sharing: Protect file sharing functionality
- User Uploads: Secure user-generated content