sec/rasp
lib/sec/rasp.vklib/sec/rasp.vk
Pure-Veko Runtime Application Self-Protection (RASP) sink guards,
HTTP middleware (rate limiting, traversal/CRLF/SQLi/XSS/Host/Origin checks,
defensive security headers, error redaction), and JSONL / CEF:0 telemetry emitter.
Zero top-level mut heap globals (RT-GLOBALS safe).
RaspConfig = struct { mode enum = ..., app_name str = ..., allowed_hosts block[str] = ..., allowed_origins block[str] = ..., allowed_exec block[str] = ..., fs_root str = ..., max_body_bytes i64 = ..., rate_limit_rpm i64 = ..., block_private_net bool = ..., telemetry_format enum = ..., telemetry_file str = ..., add_sec_headers bool = ..., redact_errors bool = ... }
Configuration for RASP sink guards, HTTP middleware, and telemetry emission.
RaspEvent = struct { timestamp str = ..., app_name str = ..., mode str = ..., action str = ..., rule_id str = ..., severity str = ..., nist_control str = ..., cwe str = ..., request_id str = ..., client_ip str = ..., target str = ..., detail str = ... }
Structured RASP security telemetry event emitted on rule triggers.
format-jsonl = fn [ev RaspEvent] str
Scrubs secrets from target and detail and encodes ev as a JSONL string.
format-cef = fn [ev RaspEvent] str
Formats ev as an ArcSight CEF:0 syslog line with secret redaction and header/extension escaping.
emit-event = fn [cfg RaspConfig, ev RaspEvent] str
Formats ev according to cfg.telemetry_format (.jsonl or .cef) and appends to cfg.telemetry_file when configured.
guard-url = fn [cfg RaspConfig, raw_url str] any
Guards outbound URL fetches against SSRF (VKRASP004, NIST SC-7, CWE-918).
guard-path = fn [cfg RaspConfig, raw_path str] any
Guards filesystem paths against null-byte and .. traversal (VKRASP003, NIST SI-10, CWE-22).
guard-sql = fn [cfg RaspConfig, sql str] any
Guards SQL queries against stacked statements, UNION SELECT, and tautology payloads (VKRASP001, NIST SI-10, CWE-89).
guard-exec = fn [cfg RaspConfig, bin str, args block[str]] any
Guards process execution against shell metacharacters, shell interpreters, and unapproved binaries (VKRASP002, NIST SI-10, CWE-78).
middleware = fn [cfg RaspConfig] any
Returns a web RASP middleware enforcing rate limits, payload inspection, defensive security headers, and error redaction.