|
|
|
|
|
|
|
|
|
|
|
|
|
|
security: |
|
|
input_validation: |
|
|
enabled: true |
|
|
max_input_length: 10000 |
|
|
allowed_content_types: |
|
|
- "text/plain" |
|
|
- "application/json" |
|
|
- "text/markdown" |
|
|
blocked_patterns: |
|
|
- "<script" |
|
|
- "javascript:" |
|
|
- "data:" |
|
|
- "vbscript:" |
|
|
- "file://" |
|
|
- "eval(" |
|
|
- "exec(" |
|
|
- "__import__" |
|
|
- "subprocess" |
|
|
- "os.system" |
|
|
sanitization_rules: |
|
|
- remove_html_tags: true |
|
|
- escape_special_chars: true |
|
|
- normalize_unicode: true |
|
|
- strip_whitespace: true |
|
|
|
|
|
|
|
|
rate_limiting: |
|
|
enabled: true |
|
|
default_limit: 100 |
|
|
burst_limit: 20 |
|
|
per_ip_limit: 100 |
|
|
per_agent_limit: 200 |
|
|
window_size: 60 |
|
|
|
|
|
|
|
|
authentication: |
|
|
enabled: false |
|
|
methods: |
|
|
- "api_key" |
|
|
- "bearer_token" |
|
|
session_timeout: 3600 |
|
|
max_sessions: 1000 |
|
|
|
|
|
|
|
|
content_security_policy: |
|
|
enabled: true |
|
|
default_src: ["'self'"] |
|
|
script_src: ["'self'", "'unsafe-inline'"] |
|
|
style_src: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"] |
|
|
img_src: ["'self'", "data:", "https:"] |
|
|
font_src: ["'self'", "https://fonts.gstatic.com"] |
|
|
connect_src: ["'self'", "https:", "wss:"] |
|
|
object_src: ["'none'"] |
|
|
frame_src: ["'none'"] |
|
|
base_uri: ["'self'"] |
|
|
form_action: ["'self'"] |
|
|
|
|
|
|
|
|
security_headers: |
|
|
enabled: true |
|
|
headers: |
|
|
X-Content-Type-Options: "nosniff" |
|
|
X-Frame-Options: "DENY" |
|
|
X-XSS-Protection: "1; mode=block" |
|
|
Referrer-Policy: "strict-origin-when-cross-origin" |
|
|
Content-Security-Policy: "see_above" |
|
|
Strict-Transport-Security: "max-age=31536000; includeSubDomains; preload" |
|
|
Permissions-Policy: "camera=(), microphone=(), geolocation=()" |
|
|
|
|
|
|
|
|
data_privacy: |
|
|
enabled: true |
|
|
gdpr_compliance: true |
|
|
data_retention_days: 30 |
|
|
anonymize_logs: true |
|
|
encrypt_sensitive_data: true |
|
|
data_minimization: true |
|
|
|
|
|
|
|
|
data_handling: |
|
|
user_input: |
|
|
retention: "session_only" |
|
|
encryption: false |
|
|
anonymization: true |
|
|
context_data: |
|
|
retention: "session_only" |
|
|
encryption: true |
|
|
anonymization: false |
|
|
performance_metrics: |
|
|
retention: "7_days" |
|
|
encryption: true |
|
|
anonymization: true |
|
|
error_logs: |
|
|
retention: "30_days" |
|
|
encryption: false |
|
|
anonymization: true |
|
|
|
|
|
|
|
|
audit: |
|
|
enabled: true |
|
|
log_level: "INFO" |
|
|
log_sensitive_data: false |
|
|
log_user_agents: true |
|
|
log_ip_addresses: false |
|
|
|
|
|
|
|
|
events: |
|
|
- "user_request" |
|
|
- "authentication_failure" |
|
|
- "rate_limit_exceeded" |
|
|
- "input_validation_failure" |
|
|
- "agent_execution" |
|
|
- "system_error" |
|
|
|
|
|
|
|
|
content_filtering: |
|
|
enabled: true |
|
|
filter_categories: |
|
|
- "malware" |
|
|
- "phishing" |
|
|
- "adult_content" |
|
|
- "violence" |
|
|
- "illegal_content" |
|
|
custom_filters: |
|
|
- pattern: "bank.*account" |
|
|
action: "sanitize" |
|
|
- pattern: "credit.*card" |
|
|
action: "block" |
|
|
severity: "high" |
|
|
|
|
|
|
|
|
injection_prevention: |
|
|
enabled: true |
|
|
sql_injection: true |
|
|
xss_injection: true |
|
|
command_injection: true |
|
|
path_traversal: true |
|
|
ldap_injection: true |
|
|
|
|
|
|
|
|
file_handling: |
|
|
max_file_size: "10MB" |
|
|
allowed_extensions: |
|
|
- ".txt" |
|
|
- ".json" |
|
|
- ".csv" |
|
|
- ".md" |
|
|
scan_for_malware: true |
|
|
quarantine_suspicious: true |
|
|
|
|
|
|
|
|
network: |
|
|
allowed_domains: |
|
|
- "huggingface.co" |
|
|
- "*.huggingface.co" |
|
|
- "localhost" |
|
|
- "127.0.0.1" |
|
|
blocked_domains: |
|
|
- "*.onion" |
|
|
- "127.0.0.0/8" |
|
|
- "10.0.0.0/8" |
|
|
- "172.16.0.0/12" |
|
|
- "192.168.0.0/16" |
|
|
timeout_settings: |
|
|
connection_timeout: 30 |
|
|
read_timeout: 60 |
|
|
total_timeout: 300 |
|
|
|
|
|
|
|
|
threat_detection: |
|
|
enabled: true |
|
|
behavioral_analysis: true |
|
|
anomaly_detection: true |
|
|
ml_based_detection: false |
|
|
|
|
|
|
|
|
suspicious_patterns: |
|
|
- pattern: "大量请求" |
|
|
threshold: 50 |
|
|
timeframe: 300 |
|
|
action: "throttle" |
|
|
- pattern: "rapid_fire_requests" |
|
|
threshold: 20 |
|
|
timeframe: 60 |
|
|
action: "block" |
|
|
- pattern: "unusual_user_agent" |
|
|
threshold: 1 |
|
|
action: "flag" |
|
|
|
|
|
|
|
|
compliance: |
|
|
gdpr: true |
|
|
ccpa: true |
|
|
hipaa: false |
|
|
sox: false |
|
|
|
|
|
|
|
|
incident_response: |
|
|
enabled: true |
|
|
auto_block_malicious: true |
|
|
notify_admins: true |
|
|
log_incidents: true |
|
|
|
|
|
|
|
|
severity_levels: |
|
|
low: |
|
|
threshold: 1 |
|
|
action: "log" |
|
|
medium: |
|
|
threshold: 3 |
|
|
action: "throttle" |
|
|
high: |
|
|
threshold: 5 |
|
|
action: "block" |
|
|
critical: |
|
|
threshold: 10 |
|
|
action: "emergency_block" |
|
|
|
|
|
|
|
|
api_security: |
|
|
enabled: true |
|
|
require_api_key: false |
|
|
api_key_rotation_days: 90 |
|
|
allowed_api_methods: ["GET", "POST"] |
|
|
max_request_size: "1MB" |
|
|
|
|
|
|
|
|
session_management: |
|
|
enabled: true |
|
|
secure_cookies: true |
|
|
http_only: true |
|
|
same_site: "strict" |
|
|
session_fixation_protection: true |
|
|
|
|
|
|
|
|
vulnerability_management: |
|
|
enabled: true |
|
|
auto_update_dependencies: true |
|
|
security_scan_frequency: "daily" |
|
|
dependency_check: true |
|
|
|
|
|
|
|
|
backup_security: |
|
|
enabled: true |
|
|
encrypt_backups: true |
|
|
backup_retention: "30_days" |
|
|
secure_backup_location: true |
|
|
access_controls: "admin_only" |
|
|
|
|
|
|
|
|
monitoring: |
|
|
security_monitoring: true |
|
|
real_time_alerts: true |
|
|
alert_channels: |
|
|
- "log" |
|
|
- "email" |
|
|
alert_thresholds: |
|
|
failed_logins: 5 |
|
|
suspicious_requests: 100 |
|
|
error_rate: 10 |
|
|
|
|
|
|
|
|
environments: |
|
|
development: |
|
|
security_level: "low" |
|
|
audit_enabled: false |
|
|
rate_limiting: false |
|
|
content_filtering: false |
|
|
|
|
|
staging: |
|
|
security_level: "medium" |
|
|
audit_enabled: true |
|
|
rate_limiting: true |
|
|
content_filtering: true |
|
|
|
|
|
production: |
|
|
security_level: "high" |
|
|
audit_enabled: true |
|
|
rate_limiting: true |
|
|
content_filtering: true |
|
|
threat_detection: true |
|
|
incident_response: true |
|
|
|
|
|
|
|
|
spaces_integration: |
|
|
token_validation: true |
|
|
space_access_control: true |
|
|
hf_transfer_security: true |
|
|
model_hub_validation: true |
|
|
|
|
|
|
|
|
emergency_procedures: |
|
|
emergency_stop: |
|
|
enabled: true |
|
|
trigger_conditions: |
|
|
- "critical_security_threat" |
|
|
- "data_breach_detection" |
|
|
- "system_compromise" |
|
|
|
|
|
disaster_recovery: |
|
|
enabled: true |
|
|
backup_frequency: "daily" |
|
|
recovery_time_objective: 4 |
|
|
recovery_point_objective: 1 |