@codyswann/lisa 4.57.4 → 4.57.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/copy-overwrite/scripts/lisa-hooks/block-direct-issue-create.sh +21 -1
- package/all/copy-overwrite/scripts/lisa-hooks/block-no-verify.sh +93 -4
- package/dist/codex/scripts/block-no-verify.sh +93 -4
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +10 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +7 -5
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/plugin-templates/block-no-verify.sh +93 -4
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/hooks/block-direct-issue-create.sh +21 -1
- package/plugins/lisa/hooks/block-no-verify.agy.sh +93 -4
- package/plugins/lisa/hooks/block-no-verify.sh +93 -4
- package/plugins/lisa-agy/hooks/block-direct-issue-create.sh +21 -1
- package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +93 -4
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/block-direct-issue-create.sh +21 -1
- package/plugins/lisa-copilot/hooks/block-no-verify.sh +93 -4
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/block-direct-issue-create.sh +21 -1
- package/plugins/lisa-cursor/hooks/block-no-verify.sh +93 -4
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/block-direct-issue-create.sh +21 -1
- package/plugins/src/base/hooks/block-no-verify.agy.sh +93 -4
- package/plugins/src/base/hooks/block-no-verify.sh +93 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.57.
|
|
3
|
+
"version": "4.57.6",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.57.
|
|
3
|
+
"version": "4.57.6",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, across Claude and Codex.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.57.
|
|
3
|
+
"version": "4.57.6",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.57.
|
|
3
|
+
"version": "4.57.6",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lisa-openclaw",
|
|
3
|
-
"version": "4.57.
|
|
3
|
+
"version": "4.57.6",
|
|
4
4
|
"description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cody Swann"
|
|
@@ -1002,6 +1002,25 @@ GLUED_OPERATORS = ("&&", "||", ";;", ";", "|", "&")
|
|
|
1002
1002
|
SEGMENT_BOUNDARIES = set(GLUED_OPERATORS) | {"(", ")", "{", "}"}
|
|
1003
1003
|
|
|
1004
1004
|
|
|
1005
|
+
def strip_full_line_comments(text):
|
|
1006
|
+
"""Blank lines beginning with `#` after optional whitespace.
|
|
1007
|
+
|
|
1008
|
+
This bounded fallback prevents ordinary prose comments from matching a
|
|
1009
|
+
creation token after an apostrophe defeats shlex (CodySwannGT/lisa#3551).
|
|
1010
|
+
It does not determine quote context: a leading `#` inside a multiline
|
|
1011
|
+
string is also removed. This is a textual guard, not shell interpretation.
|
|
1012
|
+
|
|
1013
|
+
Args:
|
|
1014
|
+
text: The raw command or file text.
|
|
1015
|
+
|
|
1016
|
+
Returns:
|
|
1017
|
+
The text with whole-line comments blanked, line count preserved.
|
|
1018
|
+
"""
|
|
1019
|
+
return "\n".join(
|
|
1020
|
+
"" if line.lstrip().startswith("#") else line for line in text.split("\n")
|
|
1021
|
+
)
|
|
1022
|
+
|
|
1023
|
+
|
|
1005
1024
|
def strip_heredocs(text):
|
|
1006
1025
|
"""Drop heredoc bodies so quoted prose cannot be read as argv.
|
|
1007
1026
|
|
|
@@ -2341,7 +2360,8 @@ def scan(text, depth, from_file=False):
|
|
|
2341
2360
|
# `unparseable_reads_only` for why this does not narrow the fallback.
|
|
2342
2361
|
if unparseable_reads_only(text):
|
|
2343
2362
|
return None
|
|
2344
|
-
|
|
2363
|
+
# Ignore whole-line prose comments when applying the fallback matcher.
|
|
2364
|
+
if UNPARSEABLE_CREATION.search(strip_full_line_comments(text)):
|
|
2345
2365
|
return (
|
|
2346
2366
|
"an unparseable command that reads as a tracker creation",
|
|
2347
2367
|
[ready_role],
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
# not JSON). Malformed/empty stdin → allow (fail open, never crash the tool).
|
|
29
29
|
#
|
|
30
30
|
# Capability names below are the canonical guard's, kept identical on every agent.
|
|
31
|
-
# lisa-guard-capabilities: no-verify-abbrev, husky-env, hookspath-allowlist, config-env, env-split-string, git-config-key, git-config-parameters, git-config-parameters-append, git-config-parameters-expansion, heredoc-shell-word, herestring-aware, no-verify-short, nested-shell-no-verify, nested-shell-long-options, env-split-string-abbrev, command-wrapper-normalization, executed-script-reach, source-builtin-reach, stdin-redirect-reach, wrapper-positional-operand, dispatcher-exec-position, tilde-script-reach, shell-option-stdin-reach
|
|
31
|
+
# lisa-guard-capabilities: no-verify-abbrev, husky-env, hookspath-allowlist, config-env, env-split-string, git-config-key, git-config-parameters, git-config-parameters-append, git-config-parameters-expansion, heredoc-shell-word, herestring-aware, no-verify-short, nested-shell-no-verify, nested-shell-long-options, env-split-string-abbrev, command-wrapper-normalization, executed-script-reach, source-builtin-reach, stdin-redirect-reach, wrapper-positional-operand, dispatcher-exec-position, tilde-script-reach, shell-option-stdin-reach, eval-payload
|
|
32
32
|
set -uo pipefail
|
|
33
33
|
|
|
34
34
|
allow() {
|
|
@@ -551,6 +551,15 @@ def shell_starts_command(tokens, index):
|
|
|
551
551
|
return status == "ok" and not remainder
|
|
552
552
|
|
|
553
553
|
|
|
554
|
+
def printed_argument(tokens, index):
|
|
555
|
+
"""Whether a token is data passed to an ordinary echo or printf command."""
|
|
556
|
+
start = index - 1
|
|
557
|
+
while start >= 0 and tokens[start] not in COMMAND_SEPARATORS:
|
|
558
|
+
start -= 1
|
|
559
|
+
program, _, opaque = command_word(tokens[start + 1:index])
|
|
560
|
+
return not opaque and program in {"echo", "printf"}
|
|
561
|
+
|
|
562
|
+
|
|
554
563
|
def env_uses_split_string(tokens, index):
|
|
555
564
|
"""Whether a command-position env invocation uses split-string parsing.
|
|
556
565
|
|
|
@@ -1148,6 +1157,8 @@ def git_skips_verification(text, depth=0):
|
|
|
1148
1157
|
# (`HUSKY=1 git commit -n`) simply sits in an earlier token.
|
|
1149
1158
|
if token != "git" and not token.endswith("/git"):
|
|
1150
1159
|
continue
|
|
1160
|
+
if printed_argument(scoped_tokens, index):
|
|
1161
|
+
continue
|
|
1151
1162
|
# The LONG flag, scoped to this invocation's argv rather than matched
|
|
1152
1163
|
# anywhere on the line. This replaces the unscoped token match that used
|
|
1153
1164
|
# to live in the flat loop below.
|
|
@@ -1175,8 +1186,8 @@ def git_skips_verification(text, depth=0):
|
|
|
1175
1186
|
def token_bypass(tokens):
|
|
1176
1187
|
"""Whether any token disables hooks by environment or by git config.
|
|
1177
1188
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1189
|
+
Printed echo/printf arguments are filtered before this scan. Assignments
|
|
1190
|
+
otherwise stay unscoped, unlike the `--no-verify` argv check. What matters is
|
|
1180
1191
|
where it appears: `HUSKY=0` and `core.hooksPath=` are assignments that
|
|
1181
1192
|
configure whatever git runs next, so they legitimately sit before the
|
|
1182
1193
|
invocation and often on a different line of a script. `--no-verify` is an
|
|
@@ -1286,11 +1297,47 @@ def flat_tokens(text):
|
|
|
1286
1297
|
The token list, or None.
|
|
1287
1298
|
"""
|
|
1288
1299
|
try:
|
|
1289
|
-
|
|
1300
|
+
tokens = shell_tokens(text)
|
|
1301
|
+
return [
|
|
1302
|
+
token.strip("();|&")
|
|
1303
|
+
for index, token in enumerate(tokens)
|
|
1304
|
+
if not printed_argument(tokens, index)
|
|
1305
|
+
]
|
|
1290
1306
|
except ValueError:
|
|
1291
1307
|
return None
|
|
1292
1308
|
|
|
1293
1309
|
|
|
1310
|
+
def eval_payloads(scoped_tokens):
|
|
1311
|
+
"""Command strings an `eval` in command position would execute.
|
|
1312
|
+
|
|
1313
|
+
`eval` takes no options: it concatenates its arguments and runs the result,
|
|
1314
|
+
so the payload is every token up to the next separator, joined by a space.
|
|
1315
|
+
Quoting is already gone by the time `shell_tokens` hands them over, which is
|
|
1316
|
+
exactly why the payload is invisible to every other scan here — the argv
|
|
1317
|
+
scan sees one opaque token and the git scan sees no `git` token at all.
|
|
1318
|
+
|
|
1319
|
+
Args:
|
|
1320
|
+
scoped_tokens: Tokens of one command line.
|
|
1321
|
+
|
|
1322
|
+
Returns:
|
|
1323
|
+
A list of payload strings, one per `eval` found in command position.
|
|
1324
|
+
"""
|
|
1325
|
+
payloads = []
|
|
1326
|
+
for index, token in enumerate(scoped_tokens):
|
|
1327
|
+
if token.rsplit("/", 1)[-1] != "eval":
|
|
1328
|
+
continue
|
|
1329
|
+
if not shell_starts_command(scoped_tokens, index):
|
|
1330
|
+
continue
|
|
1331
|
+
collected = []
|
|
1332
|
+
for follow in scoped_tokens[index + 1 :]:
|
|
1333
|
+
if follow in COMMAND_SEPARATORS:
|
|
1334
|
+
break
|
|
1335
|
+
collected.append(follow)
|
|
1336
|
+
if collected:
|
|
1337
|
+
payloads.append(" ".join(collected))
|
|
1338
|
+
return payloads
|
|
1339
|
+
|
|
1340
|
+
|
|
1294
1341
|
def verdict(text, depth=0, followed=None):
|
|
1295
1342
|
"""Whether this text, or a script it runs, bypasses verification.
|
|
1296
1343
|
|
|
@@ -1304,6 +1351,48 @@ def verdict(text, depth=0, followed=None):
|
|
|
1304
1351
|
"""
|
|
1305
1352
|
if git_skips_verification(text):
|
|
1306
1353
|
return True
|
|
1354
|
+
# RECURSION, NOT A TWELFTH SPELLING (#3531). `eval` is the builtin that takes
|
|
1355
|
+
# a command string, and it was absent from both recursion sets: it is not a
|
|
1356
|
+
# SHELL_PROGRAM (no `-c` payload) and, unlike `builtin`, not a prefix wrapper
|
|
1357
|
+
# whose argv carries through. So every vector this guard blocks was restored
|
|
1358
|
+
# by writing it inside `eval "..."` — measured on origin/main, nine of them,
|
|
1359
|
+
# including `git push --no-verify`, `core.hooksPath`, `HUSKY=0`, one behind a
|
|
1360
|
+
# separator and one behind a `command` wrapper.
|
|
1361
|
+
#
|
|
1362
|
+
# Enumerating spelling twelve is how spelling thirteen appears, and this
|
|
1363
|
+
# repository has twice declined an arms race of that shape. Recursing through
|
|
1364
|
+
# `verdict` instead gives the payload the IDENTICAL analysis, so anything
|
|
1365
|
+
# covered outside is covered inside — including checks the reporter's own
|
|
1366
|
+
# suggested patch would have missed, because it recursed into the git half
|
|
1367
|
+
# only and `HUSKY=0` and `core.hooksPath` live in `token_bypass`.
|
|
1368
|
+
#
|
|
1369
|
+
# Bounded by the same budget as a followed script: unbounded recursion on
|
|
1370
|
+
# adversarial input is itself a denial of the guard, and a Python traceback
|
|
1371
|
+
# exits non-zero, which the wrapper turns into a spurious block.
|
|
1372
|
+
if depth < FOLLOW_MAX_DEPTH:
|
|
1373
|
+
try:
|
|
1374
|
+
eval_scoped = shell_tokens(text)
|
|
1375
|
+
except ValueError:
|
|
1376
|
+
eval_scoped = []
|
|
1377
|
+
for payload in eval_payloads(eval_scoped):
|
|
1378
|
+
if verdict(payload, depth + 1, followed):
|
|
1379
|
+
return True
|
|
1380
|
+
# AND INSIDE A NESTED SHELL. `git_skips_verification` already recurses
|
|
1381
|
+
# into a `bash -c` payload, but only into ITSELF — so it carries the git
|
|
1382
|
+
# half down and leaves `eval`, `HUSKY=0` and `core.hooksPath` behind.
|
|
1383
|
+
# `bash -c 'eval "git commit --no-verify -m x"'` survived round one for
|
|
1384
|
+
# exactly that reason, and it was found by running the adversarial round
|
|
1385
|
+
# rather than by reasoning about it. Recursing the payload through
|
|
1386
|
+
# `verdict` gives every level the whole analysis.
|
|
1387
|
+
for index, token in enumerate(eval_scoped):
|
|
1388
|
+
if token.rsplit("/", 1)[-1] not in SHELL_PROGRAMS:
|
|
1389
|
+
continue
|
|
1390
|
+
if not shell_starts_command(eval_scoped, index):
|
|
1391
|
+
continue
|
|
1392
|
+
nested = nested_shell_payload(eval_scoped, index)
|
|
1393
|
+
if isinstance(nested, str) and verdict(nested, depth + 1, followed):
|
|
1394
|
+
return True
|
|
1395
|
+
|
|
1307
1396
|
tokens = flat_tokens(text)
|
|
1308
1397
|
if tokens is not None and token_bypass(tokens):
|
|
1309
1398
|
return True
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
# Add a name here in the same commit that closes a vector. A hardening that
|
|
41
41
|
# forgets to is invisible to refresh, and shows up as an unexplained diff at
|
|
42
42
|
# review time instead of a named capability.
|
|
43
|
-
# lisa-guard-capabilities: no-verify-abbrev, husky-env, hookspath-allowlist, config-env, env-split-string, git-config-key, git-config-parameters, git-config-parameters-append, git-config-parameters-expansion, heredoc-shell-word, herestring-aware, no-verify-short, nested-shell-no-verify, nested-shell-long-options, env-split-string-abbrev, command-wrapper-normalization, executed-script-reach, source-builtin-reach, stdin-redirect-reach, wrapper-positional-operand, dispatcher-exec-position, tilde-script-reach, shell-option-stdin-reach
|
|
43
|
+
# lisa-guard-capabilities: no-verify-abbrev, husky-env, hookspath-allowlist, config-env, env-split-string, git-config-key, git-config-parameters, git-config-parameters-append, git-config-parameters-expansion, heredoc-shell-word, herestring-aware, no-verify-short, nested-shell-no-verify, nested-shell-long-options, env-split-string-abbrev, command-wrapper-normalization, executed-script-reach, source-builtin-reach, stdin-redirect-reach, wrapper-positional-operand, dispatcher-exec-position, tilde-script-reach, shell-option-stdin-reach, eval-payload
|
|
44
44
|
#
|
|
45
45
|
# Shell-token matching avoids false positives from issue bodies, heredocs, and
|
|
46
46
|
# commit-message prose while still catching quoted real argv values such as
|
|
@@ -649,6 +649,15 @@ def shell_starts_command(tokens, index):
|
|
|
649
649
|
return status == "ok" and not remainder
|
|
650
650
|
|
|
651
651
|
|
|
652
|
+
def printed_argument(tokens, index):
|
|
653
|
+
"""Whether a token is data passed to an ordinary echo or printf command."""
|
|
654
|
+
start = index - 1
|
|
655
|
+
while start >= 0 and tokens[start] not in COMMAND_SEPARATORS:
|
|
656
|
+
start -= 1
|
|
657
|
+
program, _, opaque = command_word(tokens[start + 1:index])
|
|
658
|
+
return not opaque and program in {"echo", "printf"}
|
|
659
|
+
|
|
660
|
+
|
|
652
661
|
def env_uses_split_string(tokens, index):
|
|
653
662
|
"""Whether a command-position env invocation uses split-string parsing.
|
|
654
663
|
|
|
@@ -1246,6 +1255,8 @@ def git_skips_verification(text, depth=0):
|
|
|
1246
1255
|
# (`HUSKY=1 git commit -n`) simply sits in an earlier token.
|
|
1247
1256
|
if token != "git" and not token.endswith("/git"):
|
|
1248
1257
|
continue
|
|
1258
|
+
if printed_argument(scoped_tokens, index):
|
|
1259
|
+
continue
|
|
1249
1260
|
# The LONG flag, scoped to this invocation's argv rather than matched
|
|
1250
1261
|
# anywhere on the line. This replaces the unscoped token match that used
|
|
1251
1262
|
# to live in the flat loop below.
|
|
@@ -1273,8 +1284,8 @@ def git_skips_verification(text, depth=0):
|
|
|
1273
1284
|
def token_bypass(tokens):
|
|
1274
1285
|
"""Whether any token disables hooks by environment or by git config.
|
|
1275
1286
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1287
|
+
Printed echo/printf arguments are filtered before this scan. Assignments
|
|
1288
|
+
otherwise stay unscoped, unlike the `--no-verify` argv check. What matters is
|
|
1278
1289
|
where it appears: `HUSKY=0` and `core.hooksPath=` are assignments that
|
|
1279
1290
|
configure whatever git runs next, so they legitimately sit before the
|
|
1280
1291
|
invocation and often on a different line of a script. `--no-verify` is an
|
|
@@ -1384,11 +1395,47 @@ def flat_tokens(text):
|
|
|
1384
1395
|
The token list, or None.
|
|
1385
1396
|
"""
|
|
1386
1397
|
try:
|
|
1387
|
-
|
|
1398
|
+
tokens = shell_tokens(text)
|
|
1399
|
+
return [
|
|
1400
|
+
token.strip("();|&")
|
|
1401
|
+
for index, token in enumerate(tokens)
|
|
1402
|
+
if not printed_argument(tokens, index)
|
|
1403
|
+
]
|
|
1388
1404
|
except ValueError:
|
|
1389
1405
|
return None
|
|
1390
1406
|
|
|
1391
1407
|
|
|
1408
|
+
def eval_payloads(scoped_tokens):
|
|
1409
|
+
"""Command strings an `eval` in command position would execute.
|
|
1410
|
+
|
|
1411
|
+
`eval` takes no options: it concatenates its arguments and runs the result,
|
|
1412
|
+
so the payload is every token up to the next separator, joined by a space.
|
|
1413
|
+
Quoting is already gone by the time `shell_tokens` hands them over, which is
|
|
1414
|
+
exactly why the payload is invisible to every other scan here — the argv
|
|
1415
|
+
scan sees one opaque token and the git scan sees no `git` token at all.
|
|
1416
|
+
|
|
1417
|
+
Args:
|
|
1418
|
+
scoped_tokens: Tokens of one command line.
|
|
1419
|
+
|
|
1420
|
+
Returns:
|
|
1421
|
+
A list of payload strings, one per `eval` found in command position.
|
|
1422
|
+
"""
|
|
1423
|
+
payloads = []
|
|
1424
|
+
for index, token in enumerate(scoped_tokens):
|
|
1425
|
+
if token.rsplit("/", 1)[-1] != "eval":
|
|
1426
|
+
continue
|
|
1427
|
+
if not shell_starts_command(scoped_tokens, index):
|
|
1428
|
+
continue
|
|
1429
|
+
collected = []
|
|
1430
|
+
for follow in scoped_tokens[index + 1 :]:
|
|
1431
|
+
if follow in COMMAND_SEPARATORS:
|
|
1432
|
+
break
|
|
1433
|
+
collected.append(follow)
|
|
1434
|
+
if collected:
|
|
1435
|
+
payloads.append(" ".join(collected))
|
|
1436
|
+
return payloads
|
|
1437
|
+
|
|
1438
|
+
|
|
1392
1439
|
def verdict(text, depth=0, followed=None):
|
|
1393
1440
|
"""Whether this text, or a script it runs, bypasses verification.
|
|
1394
1441
|
|
|
@@ -1402,6 +1449,48 @@ def verdict(text, depth=0, followed=None):
|
|
|
1402
1449
|
"""
|
|
1403
1450
|
if git_skips_verification(text):
|
|
1404
1451
|
return True
|
|
1452
|
+
# RECURSION, NOT A TWELFTH SPELLING (#3531). `eval` is the builtin that takes
|
|
1453
|
+
# a command string, and it was absent from both recursion sets: it is not a
|
|
1454
|
+
# SHELL_PROGRAM (no `-c` payload) and, unlike `builtin`, not a prefix wrapper
|
|
1455
|
+
# whose argv carries through. So every vector this guard blocks was restored
|
|
1456
|
+
# by writing it inside `eval "..."` — measured on origin/main, nine of them,
|
|
1457
|
+
# including `git push --no-verify`, `core.hooksPath`, `HUSKY=0`, one behind a
|
|
1458
|
+
# separator and one behind a `command` wrapper.
|
|
1459
|
+
#
|
|
1460
|
+
# Enumerating spelling twelve is how spelling thirteen appears, and this
|
|
1461
|
+
# repository has twice declined an arms race of that shape. Recursing through
|
|
1462
|
+
# `verdict` instead gives the payload the IDENTICAL analysis, so anything
|
|
1463
|
+
# covered outside is covered inside — including checks the reporter's own
|
|
1464
|
+
# suggested patch would have missed, because it recursed into the git half
|
|
1465
|
+
# only and `HUSKY=0` and `core.hooksPath` live in `token_bypass`.
|
|
1466
|
+
#
|
|
1467
|
+
# Bounded by the same budget as a followed script: unbounded recursion on
|
|
1468
|
+
# adversarial input is itself a denial of the guard, and a Python traceback
|
|
1469
|
+
# exits non-zero, which the wrapper turns into a spurious block.
|
|
1470
|
+
if depth < FOLLOW_MAX_DEPTH:
|
|
1471
|
+
try:
|
|
1472
|
+
eval_scoped = shell_tokens(text)
|
|
1473
|
+
except ValueError:
|
|
1474
|
+
eval_scoped = []
|
|
1475
|
+
for payload in eval_payloads(eval_scoped):
|
|
1476
|
+
if verdict(payload, depth + 1, followed):
|
|
1477
|
+
return True
|
|
1478
|
+
# AND INSIDE A NESTED SHELL. `git_skips_verification` already recurses
|
|
1479
|
+
# into a `bash -c` payload, but only into ITSELF — so it carries the git
|
|
1480
|
+
# half down and leaves `eval`, `HUSKY=0` and `core.hooksPath` behind.
|
|
1481
|
+
# `bash -c 'eval "git commit --no-verify -m x"'` survived round one for
|
|
1482
|
+
# exactly that reason, and it was found by running the adversarial round
|
|
1483
|
+
# rather than by reasoning about it. Recursing the payload through
|
|
1484
|
+
# `verdict` gives every level the whole analysis.
|
|
1485
|
+
for index, token in enumerate(eval_scoped):
|
|
1486
|
+
if token.rsplit("/", 1)[-1] not in SHELL_PROGRAMS:
|
|
1487
|
+
continue
|
|
1488
|
+
if not shell_starts_command(eval_scoped, index):
|
|
1489
|
+
continue
|
|
1490
|
+
nested = nested_shell_payload(eval_scoped, index)
|
|
1491
|
+
if isinstance(nested, str) and verdict(nested, depth + 1, followed):
|
|
1492
|
+
return True
|
|
1493
|
+
|
|
1405
1494
|
tokens = flat_tokens(text)
|
|
1406
1495
|
if tokens is not None and token_bypass(tokens):
|
|
1407
1496
|
return True
|