Security Test Harness for Rule-Based Filing APIs
Rule-heavy APIs fail in subtle ways: an input passes validation but maps to the wrong branch, or a safe payload leaks restricted fields in edge scenarios. A dedicated security harness prevents these misses.
Step 1: Define adversarial scenario fixtures
{
"case": "mixed-income-edge",
"input": {"income_w2": 45000, "crypto_gain": 1200},
"expect": {"requires_schedule_d": true}
}
Step 2: Add output-field leak checks
def assert_no_sensitive_fields(payload):
blocked = {"ssn", "bank_account", "full_address"}
assert blocked.isdisjoint(payload.keys())