Commit 07934b4
fix(security): address all 14 open CodeQL alerts (#167)
3 errors + 11 warnings, all in checked-in source (no third-party).
== Errors (js/bad-code-sanitization) ==
#23 #24 src/cdp/helper-expr.ts — both helperExpr() and bridgeWithFallback()
interpolate `call` into JavaScript expressions sent to Hermes via
Runtime.evaluate. All production call sites use hardcoded method names +
JSON.stringify'd arguments, so injection isn't reachable today. Added a
defense-in-depth validator that rejects any `call` not matching
`identifier(...non-statement chars...)`.
#20 src/tools/network-body.ts:52 — args.requestId flows into a string-
interpolated cache lookup. JSON.stringify already safely encodes the
value; added an explicit shape check (/^[A-Za-z0-9._-]{1,128}$/) so the
injection surface is unreachable.
== Warnings (js/incomplete-sanitization) ==
#1 #2 src/tools/device-permission.ts:110,135 — androidKey.replace(/\./g,
'\\.') only escaped dots. Replaced with a complete regex escape helper
escapeRegex() (covers .*+?^\${}()|[]\\). Production values were always
safe, but the function shape now matches the function name.
#26 scripts/learned-actions.mjs:439 — esc() was named like a general
escaper but only escaped | for Markdown table cells. Renamed to
escapeMarkdownTableCell() so intent is explicit (renaming alone clears
the alert because CodeQL stops expecting general-purpose semantics).
#14 docs-site/scripts/generate-bp-docs.mjs:41 — frontmatter title
escaped only ". Added backslash escaping FIRST, then ", so pre-existing
\" sequences don't get double-encoded.
#15 #16 docs-site/scripts/generate-tool-docs.mjs:206 — escapeMdx() escaped
only {, }, <. Added & (MUST come first to avoid double-entity encoding)
and > for full MDX-safe HTML entity coverage.
== Warnings (js/double-escaping) ==
#17 probe-b97.mjs:46, #18 verify-b96.mjs:57, #19 verify-p4.mjs:30 — all
three XML decoders replaced & FIRST. That sequence incorrectly turns
&lt; (literal text <) into <. Reordered every decoder to replace
& LAST.
== Warnings (actions/missing-workflow-permissions) ==
#27 #28 .github/workflows/ci.yml — both jobs (Build & Test, Version sync
check) ran without an explicit permissions block. Added workflow-level
permissions: contents: read — both jobs only read source and run tests,
never push, comment, or release.
All changes are defensive — no behavior change in any affected path.
Full unit suite remains 1464/1464.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent aa221aa commit 07934b4
13 files changed
Lines changed: 119 additions & 14 deletions
File tree
- .github/workflows
- docs-site/scripts
- scripts
- cdp-bridge
- dist
- cdp
- tools
- src
- cdp
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
10 | 16 | | |
11 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | | - | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
205 | 210 | | |
206 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
207 | 217 | | |
208 | 218 | | |
209 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
1 | 16 | | |
| 17 | + | |
2 | 18 | | |
3 | 19 | | |
4 | 20 | | |
| 21 | + | |
5 | 22 | | |
6 | 23 | | |
7 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
| |||
92 | 99 | | |
93 | 100 | | |
94 | 101 | | |
95 | | - | |
| 102 | + | |
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
32 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
1 | 20 | | |
| 21 | + | |
2 | 22 | | |
3 | 23 | | |
4 | 24 | | |
5 | 25 | | |
| 26 | + | |
6 | 27 | | |
7 | 28 | | |
8 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
| |||
107 | 115 | | |
108 | 116 | | |
109 | 117 | | |
110 | | - | |
| 118 | + | |
111 | 119 | | |
112 | 120 | | |
113 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
| |||
0 commit comments