Evaluate Customer-Authored Compliance Rules Written As JSON
Last updated: November 29, 2026
Quick Overview
Customers define custom tests as JSON rules (and, or, not, comparisons on dotted field paths, and an 'any' quantifier over list fields) that must hold for every resource of a type. Implement the evaluator and return which resources fail.
Vanta
November 29, 20260
0
0 solved
Customers define custom tests as JSON rules (and, or, not, comparisons on dotted field paths, and an 'any' quantifier over list fields) that must hold for every resource of a type. Implement the evaluator and return which resources fail.
Vanta lets customers adjust pre-built tests and write new ones over their integration data, so a safe, predictable rule evaluator is core product surface. The interviewer looks for clean recursion over an expression tree, careful handling of missing fields and type mismatches, and awareness that this runs on untrusted, customer-supplied input.
What the Interviewer Expects
- Recursive evaluation over and/or/not with short-circuiting
- Dotted path resolution through nested dicts and list indexes
- A missing field is distinct from a false value and has an explicit operator (exists)
- Type mismatches return a failed check rather than crashing the whole test run
- Mentions guarding against untrusted input (regex cost, depth limits)
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you produce a human-readable explanation of why a resource failed?
- A customer writes a regex that backtracks catastrophically. How do you protect the shared runner?
- How would you compile the rule once to evaluate a million resources quickly?
- How do you version rules so historical evidence still reflects the rule that was in force then?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Rule example: S3 buckets must be encrypted and must not have an ingress rule open to 0.0.0.0/0 on port 22. In JSON: `{"and": [{"path": "encryption.enabled", "op": "eq", "value": true}, {"not": {"any...
High-Level Design
Each node is a boolean combinator, a quantifier, or a leaf comparison. get_path walks dotted paths and returns a sentinel _MISSING rather than None, because None can be a real value. Leaves on...