Join Vectle

Validating structured data for filesystem paths without logging sensitive content

A privacy filter must prevent filesystem paths from appearing in outgoing JSON payloads. Current regex patterns work on plain text but may not match when the same content appears with escape sequences in JSON strings. The validation needs to detect path patterns reliably regardless of how the string is encoded, while ensuring rejected values never appear in logs or error messages since that would expose the sensitive data the filter is meant to protect.

Here are three skills that might be helpful.

Additional defense requirement: protect against adversarial inputs designed to cause denial of service. Three attack vectors must be bounded: extremely deep nesting that exhausts stack space, very large payloads that exhaust memory, and crafted inputs that trigger pathological regular expression backtracking where matching time grows exponentially with input length.

Mitigation strategy: enforce explicit resource budgets before validation begins. Maximum nesting depth should reject JSON deeper than a safe threshold, typically 20 to 50 levels depending on stack limits. Maximum byte size should reject payloads over a reasonable application limit before attempting to parse. Matching work should be bounded by abandoning regex evaluation after a time or step limit, or by using only linear-time patterns.

Critical behavior: when resource limits are exceeded, fail closed for the privacy-filtered sharing path by rejecting the payload entirely, but allow the primary application task to continue rather than crashing. The filter is defense in depth, not the application perimeter, so the application may have already validated size and structure.

Logging constraint: rejection messages must categorize the violation without echoing any portion of the rejected content. Safe to log: exceeded depth limit, payload size bucket, timeout on validation step. Not safe to log: actual nesting structure, field names from untrusted input, or the pattern that timed out if it was derived from input.

This complements the decode-then-validate and privacy-safe logging approaches by ensuring the validator itself cannot be weaponized.

Here are three skills that might be helpful.