| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- # Asset Validation Rules Configuration
- # This file defines validation rules and constraints for different asset types
- audio_validation:
- wav:
- max_size_mb: 50
- min_size_bytes: 1024
- allowed_sample_rates: [16000, 22050, 44100, 48000]
- allowed_channels: [1, 2]
- allowed_bit_depths: [16, 24, 32]
- max_duration_seconds: 300
- require_valid_header: true
-
- mp3:
- max_size_mb: 20
- min_size_bytes: 512
- allowed_bitrates: [128, 192, 256, 320]
- max_duration_seconds: 600
- require_id3_tag: false
-
- ogg:
- max_size_mb: 30
- min_size_bytes: 1024
- max_duration_seconds: 600
- require_vorbis_codec: true
- image_validation:
- png:
- max_size_mb: 10
- min_size_bytes: 100
- max_width: 4096
- max_height: 4096
- min_width: 16
- min_height: 16
- allow_transparency: true
- require_valid_signature: true
-
- jpeg:
- max_size_mb: 10
- min_size_bytes: 100
- max_width: 4096
- max_height: 4096
- min_width: 16
- min_height: 16
- max_quality: 95
- min_quality: 60
-
- gif:
- max_size_mb: 5
- min_size_bytes: 100
- max_width: 2048
- max_height: 2048
- max_frames: 100
- max_duration_seconds: 30
- text_validation:
- json:
- max_size_mb: 5
- min_size_bytes: 2
- required_encoding: "utf-8"
- validate_syntax: true
- max_nesting_depth: 20
- allow_comments: false
-
- yaml:
- max_size_mb: 2
- min_size_bytes: 1
- required_encoding: "utf-8"
- validate_syntax: true
- max_nesting_depth: 15
- allow_duplicate_keys: false
-
- plain:
- max_size_mb: 1
- min_size_bytes: 0
- allowed_encodings: ["utf-8", "ascii"]
- max_line_length: 1000
- check_binary_content: true
- config_validation:
- json_config:
- extends: "text.json"
- require_schema_validation: true
- required_fields: ["version", "name"]
- validate_references: true
-
- yaml_config:
- extends: "text.yaml"
- require_schema_validation: true
- required_fields: ["version", "name"]
- validate_references: true
- security_rules:
- scan_patterns:
- - name: "script_injection"
- severity: "high"
- patterns:
- - '<script[^>]*>.*?</script>'
- - 'javascript:'
- - 'on\w+\s*='
-
- - name: "file_inclusion"
- severity: "medium"
- patterns:
- - '\.\./.*\.\./'
- - 'file://'
- - '\\\\.*\\\\'
-
- - name: "command_injection"
- severity: "high"
- patterns:
- - '[;&|`$]'
- - 'eval\s*\('
- - 'exec\s*\('
- file_permissions:
- max_permissions: "644"
- warn_world_readable: true
- warn_world_writable: true
- scan_executables: true
- performance_rules:
- size_warnings:
- audio:
- large_file_mb: 25
- very_large_file_mb: 50
- image:
- large_file_mb: 5
- very_large_file_mb: 10
- text:
- large_file_kb: 500
- very_large_file_kb: 1000
-
- resolution_warnings:
- image:
- high_resolution_pixels: 4000000 # 4 megapixels
- very_high_resolution_pixels: 16000000 # 16 megapixels
-
- quality_suggestions:
- audio:
- recommend_sample_rate: 44100
- recommend_channels: 2
- recommend_bit_depth: 16
- image:
- recommend_compression: true
- recommend_format: "png"
- validation_profiles:
- strict:
- treat_warnings_as_errors: true
- enable_security_checks: true
- enable_performance_checks: true
- require_metadata_validation: true
-
- standard:
- treat_warnings_as_errors: false
- enable_security_checks: true
- enable_performance_checks: true
- require_metadata_validation: false
-
- permissive:
- treat_warnings_as_errors: false
- enable_security_checks: false
- enable_performance_checks: false
- require_metadata_validation: false
- metadata:
- version: "1.0.0"
- schema_version: "1.0"
- last_updated: "2024-01-01"
- description: "Comprehensive validation rules for Trixy asset management"
- applies_to: ["trixy_core.assets"]
|