Files
OmniRoute/tests/unit
Diego Rodrigues de Sa e Souza b710f1a7e3 fix(mitm): mask bare "Bearer <token>" header values in the inspector (#4358)
sanitizeHeaders() masks header *values* — it calls maskSecret("Bearer
<token>") with the "authorization:" key already stripped. The BEARER regex
was anchored to a literal "authorization:" prefix, so it never fired on those
values; tokens shorter than the sk-(16+)/opaque-(40+) thresholds then leaked
verbatim into the Traffic Inspector buffer (Hard Rule #12).

Found by the AgentBridge live capture: a 'Bearer sk-secret-TESTE' request
header showed up unmasked in /api/tools/traffic-inspector/requests. Real Google
OAuth tokens are long enough to be caught by LONG_TOKEN, but the Bearer pattern
must mask regardless of length.

Re-anchor BEARER to a standalone \bBearer\s+<token> (still ReDoS-safe:
bounded char class, no nested quantifiers). Masks both bare 'Bearer <token>'
header values and 'authorization: Bearer <token>' raw lines; existing cases
(sk-/ak-/pk- keys, short keys, no-secret strings) unchanged.

Tests: bare Bearer value, short opaque Bearer, realistic Google OAuth Bearer,
plus an authorization:-prefixed regression.
2026-06-20 05:51:30 -03:00
..
2026-05-23 01:46:59 -03:00
2026-06-17 19:26:32 -03:00
2026-06-17 19:26:32 -03:00
2026-06-12 23:49:22 -03:00
2026-06-11 18:52:29 -03:00
2026-06-17 19:26:32 -03:00
2026-05-21 01:29:12 -03:00
2026-06-09 22:57:12 -03:00
2026-06-11 04:01:24 -03:00
2026-06-17 02:43:21 -03:00
2026-06-17 19:26:32 -03:00
2026-06-15 03:32:11 -03:00
2026-05-29 12:44:29 -03:00
2026-06-15 03:32:11 -03:00
2026-05-23 01:46:59 -03:00
2026-05-26 23:51:47 -03:00
2026-06-19 06:49:01 -03:00
2026-04-19 19:50:30 -03:00
2026-05-29 12:44:29 -03:00
2026-06-12 23:49:22 -03:00
2026-06-11 04:01:24 -03:00
2026-06-06 19:13:11 -03:00
2026-06-13 17:27:40 -03:00
2026-06-19 06:49:01 -03:00
2026-05-26 23:51:47 -03:00
2026-05-29 12:44:29 -03:00
2026-05-26 23:51:47 -03:00
2026-05-26 23:51:47 -03:00
2026-05-29 12:44:29 -03:00
2026-05-21 01:29:12 -03:00
2026-05-24 18:05:58 -03:00
2026-06-17 19:26:32 -03:00
2026-05-26 23:51:47 -03:00
2026-06-12 23:49:22 -03:00
2026-06-17 19:26:32 -03:00
2026-06-12 23:49:22 -03:00
2026-06-17 19:26:32 -03:00
2026-06-13 17:27:40 -03:00
2026-06-16 01:00:40 -03:00
2026-05-26 23:51:47 -03:00
2026-05-29 12:44:29 -03:00
2026-05-29 12:44:29 -03:00
2026-06-12 23:49:22 -03:00
2026-05-26 23:51:47 -03:00
2026-05-24 18:05:58 -03:00
2026-05-26 23:51:47 -03:00
2026-05-29 12:44:29 -03:00
2026-05-26 23:51:47 -03:00
2026-05-10 00:55:06 -03:00
2026-06-12 23:49:22 -03:00
2026-05-26 23:51:47 -03:00
2026-06-13 17:27:40 -03:00
2026-06-12 23:49:22 -03:00
2026-05-29 12:44:29 -03:00
2026-06-12 23:49:22 -03:00
2026-05-21 01:29:12 -03:00
2026-04-30 01:27:03 -03:00
2026-04-30 01:27:03 -03:00
2026-05-26 23:51:47 -03:00
2026-05-10 00:55:06 -03:00
2026-05-26 23:51:47 -03:00
2026-04-30 14:08:50 -03:00
2026-06-11 04:01:24 -03:00
2026-06-17 02:43:21 -03:00
2026-06-12 23:49:22 -03:00
2026-05-26 23:51:47 -03:00
2026-06-15 03:32:11 -03:00
2026-06-19 06:49:01 -03:00
2026-05-26 23:51:47 -03:00
2026-05-26 23:51:47 -03:00
2026-06-10 13:49:08 -03:00
2026-06-19 06:49:01 -03:00
2026-05-23 01:46:59 -03:00
2026-06-19 06:49:01 -03:00
2026-05-26 23:51:47 -03:00
2026-04-30 01:27:03 -03:00
2026-06-19 06:49:01 -03:00
2026-06-12 23:49:22 -03:00
2026-06-12 23:49:22 -03:00
2026-06-11 18:52:29 -03:00
2026-04-30 01:27:03 -03:00
2026-05-26 23:51:47 -03:00
2026-06-17 02:43:21 -03:00
2026-05-23 01:46:59 -03:00
2026-05-23 01:46:59 -03:00
2026-06-09 15:56:24 -03:00
2026-06-10 13:49:08 -03:00
2026-05-29 19:54:00 -03:00
2026-06-19 06:49:01 -03:00
2026-06-17 19:26:32 -03:00
2026-06-13 17:27:40 -03:00
2026-06-17 02:43:21 -03:00
2026-05-24 18:05:58 -03:00
2026-05-24 18:05:58 -03:00
2026-06-07 07:20:02 -03:00
2026-04-28 20:46:25 -03:00
2026-05-29 12:44:29 -03:00
2026-05-29 12:44:29 -03:00
2026-06-19 06:49:01 -03:00
2026-06-12 23:49:22 -03:00
2026-06-17 02:43:21 -03:00
2026-05-26 23:51:47 -03:00
2026-06-12 23:49:22 -03:00
2026-06-13 17:27:40 -03:00
2026-06-16 01:00:40 -03:00
2026-06-16 01:00:40 -03:00
2026-05-26 23:51:47 -03:00
2026-06-16 01:00:40 -03:00
2026-05-26 23:51:47 -03:00
2026-06-04 20:05:38 -03:00
2026-06-12 23:49:22 -03:00
2026-05-29 12:44:29 -03:00
2026-06-19 06:49:01 -03:00
2026-06-07 07:20:02 -03:00
2026-06-11 04:01:24 -03:00
2026-05-24 18:05:58 -03:00
2026-05-26 23:51:47 -03:00
2026-06-12 23:49:22 -03:00
2026-06-16 01:00:40 -03:00
2026-06-12 23:49:22 -03:00
2026-06-12 23:49:22 -03:00
2026-06-16 01:00:40 -03:00