Skip to content

The agent that grows with you

fix(debug): stop encoded URL param keys at encoded separators

kshitijk4poorf5a9361dcc66
diff --git a/hermes_cli/debug_redaction.py b/hermes_cli/debug_redaction.py
index 67b965fc645..fe787afd20b 100644
--- a/hermes_cli/debug_redaction.py
+++ b/hermes_cli/debug_redaction.py
@@ -31,7 +31,7 @@ _RAW_URL_PARAM_RE = re.compile(
)
_ENCODED_URL_PARAM_RE = re.compile(
r"(?P<sep>%3[fF]|%23|%26|%3[bB])"
- r"(?P<key>(?:(?!%3[dD])[^\s\"'<>]){1,160}?)"
+ r"(?P<key>(?:(?!%3[dD]|%3[fF]|%23|%26|%3[bB])[^\s\"'<>]){1,160}?)"
r"(?P<eq>%3[dD]|=)"
r"(?P<value>.*?)"
r"(?=(?:%3[fF]|%26|%23|%3[bB])|[\s\"'<>]|$)",
diff --git a/tests/tui_gateway/test_diagnostics_share_nous.py b/tests/tui_gateway/test_diagnostics_share_nous.py
index 2c88d2ecc93..07d28d030bd 100644
--- a/tests/tui_gateway/test_diagnostics_share_nous.py
+++ b/tests/tui_gateway/test_diagnostics_share_nous.py
@@ -128,7 +128,8 @@ def test_redacted_support_egress_scrubs_structured_values_and_errors(
structured = (
f"headers={{'Proxy-Authorization': 'Basic {canaries['header']}'}} "
f"Command ['provider', '--api-key', '{canaries['argv']}'] "
- f"Bearer {canaries['bearer']}"
+ f"Bearer {canaries['bearer']} "
+ f"https://a.invalid/?next=%2Fx%3Ffoo%26token%3D{canaries['url']}"
)
result = _handler()(