Add dlp.outbound_on_match policy (block | redact | supervise)
Give each egress route a policy for what the proxy does when an outbound DLP detector matches a token, defaulting to the supervise flow added in the previous commit. The goal is cutting false-positive friction without weakening default-deny. - redact: scrub the matched value(s) from the body, non-host headers, and path/query via redact_tokens, then re-scan. Forward if clean; fail closed with a 403 if a match remains on a surface redaction can't rewrite (the hostname, or a unicode-evasion token). For routes where a token-shaped value is noise the upstream doesn't need. - block: the original hard 403, never overridable. - supervise (default, unset): hold the request for operator approval. Structural blocks (CRLF, no safelist-able value) stay hard 403s under every policy. Threads outbound_on_match from the bottle manifest (manifest_egress) through the resolved EgressRoute and rendered routes.yaml (egress.py) to the addon's Route (egress_addon_core), and round-trips it via the list-egress-routes introspection endpoint. The allow/egress-block tool descriptions document the new key. Tests: manifest parse/validation, core parse/validation, full manifest->render->addon round-trip for redact. README + PRD 0062 updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HnvBjPZC5V7qeQpFbQdDmS
This commit is contained in:
@@ -269,6 +269,25 @@ class TestParseDlp(unittest.TestCase):
|
||||
"dlp": {"wat": True},
|
||||
}]})
|
||||
|
||||
def test_outbound_on_match_default_empty(self):
|
||||
routes = parse_routes({"routes": [{"host": "x.example"}]})
|
||||
self.assertEqual("", routes[0].outbound_on_match)
|
||||
|
||||
def test_outbound_on_match_parsed(self):
|
||||
for policy in ("block", "redact", "supervise"):
|
||||
routes = parse_routes({"routes": [{
|
||||
"host": "x.example",
|
||||
"dlp": {"outbound_on_match": policy},
|
||||
}]})
|
||||
self.assertEqual(policy, routes[0].outbound_on_match)
|
||||
|
||||
def test_outbound_on_match_invalid_rejected(self):
|
||||
with self.assertRaises(ValueError):
|
||||
parse_routes({"routes": [{
|
||||
"host": "x.example",
|
||||
"dlp": {"outbound_on_match": "nope"},
|
||||
}]})
|
||||
|
||||
|
||||
# --- load_routes ---------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user