@codyswann/lisa 4.57.3 → 4.57.5
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-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 +6 -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 +6 -4
- 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/.codex-plugin/skills/lisa-setup-remote-env/scripts/preflight-tools.mjs +44 -19
- package/plugins/lisa/hooks/block-no-verify.agy.sh +93 -4
- package/plugins/lisa/hooks/block-no-verify.sh +93 -4
- package/plugins/lisa/skills/lisa-setup-remote-env/scripts/preflight-tools.mjs +44 -19
- package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +93 -4
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-setup-remote-env/scripts/preflight-tools.mjs +44 -19
- 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-no-verify.sh +93 -4
- package/plugins/lisa-copilot/skills/lisa-setup-remote-env/scripts/preflight-tools.mjs +44 -19
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/block-no-verify.sh +93 -4
- package/plugins/lisa-cursor/skills/lisa-setup-remote-env/scripts/preflight-tools.mjs +44 -19
- 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-no-verify.agy.sh +93 -4
- package/plugins/src/base/hooks/block-no-verify.sh +93 -4
- package/plugins/src/base/skills/lisa-setup-remote-env/scripts/preflight-tools.mjs +44 -19
|
@@ -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
|
|
@@ -232,8 +232,22 @@ export function preflightTools(
|
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Format a count with the appropriate noun phrase.
|
|
237
|
+
* @param {number} n How many.
|
|
238
|
+
* @param {string} one Singular noun phrase.
|
|
239
|
+
* @param {string} many Plural noun phrase.
|
|
240
|
+
* @returns {string} A counted phrase such as "1 tool" or "3 tools".
|
|
241
|
+
*/
|
|
242
|
+
function count(n, one, many) {
|
|
243
|
+
return `${n} ${n === 1 ? one : many}`;
|
|
244
|
+
}
|
|
245
|
+
|
|
235
246
|
/**
|
|
236
247
|
* Render a verdict for whoever has to act on it.
|
|
248
|
+
*
|
|
249
|
+
* Put blockers first and scope the stop instruction to that section. The
|
|
250
|
+
* separate installable section must not send usable work to the blocked lane.
|
|
237
251
|
* @param {object} result A {@link preflightTools} result.
|
|
238
252
|
* @returns {string} Operator-readable report, empty when nothing needs saying.
|
|
239
253
|
*/
|
|
@@ -243,42 +257,53 @@ export function reportTools(result) {
|
|
|
243
257
|
// The header tracks the exit code. Only a blocked tool is a failure — one
|
|
244
258
|
// Lisa can install is an action with a command attached, and calling that
|
|
245
259
|
// "FAILED" while exiting zero teaches readers that the word means nothing.
|
|
260
|
+
const blocking = count(result.blocked.length, "tool blocks", "tools block");
|
|
261
|
+
const spare = result.installable.length
|
|
262
|
+
? ` ${result.installable.length} more Lisa can install for you.`
|
|
263
|
+
: ``;
|
|
246
264
|
const header = () => {
|
|
247
|
-
if (result.blocked.length)
|
|
265
|
+
if (result.blocked.length)
|
|
266
|
+
return `Tooling preflight FAILED — ${blocking}.${spare}`;
|
|
248
267
|
if (result.installable.length)
|
|
249
|
-
return
|
|
268
|
+
return (
|
|
269
|
+
`Tooling preflight — action available. Nothing blocks;` +
|
|
270
|
+
` ${count(result.installable.length, "tool", "tools")} Lisa can` +
|
|
271
|
+
` install for you.`
|
|
272
|
+
);
|
|
250
273
|
// Nothing to do and nothing to fix; the note below is the whole message.
|
|
251
|
-
return
|
|
274
|
+
return `Tooling preflight passed, with a note.`;
|
|
252
275
|
};
|
|
253
276
|
const lines = [header()];
|
|
254
|
-
if (result.installable.length) {
|
|
255
|
-
lines.push(
|
|
256
|
-
``,
|
|
257
|
-
`Lisa can install these itself — they are pinned and checksummed.`,
|
|
258
|
-
`Run /lisa:setup:local-env to place them:`,
|
|
259
|
-
``
|
|
260
|
-
);
|
|
261
|
-
for (const step of result.installable) {
|
|
262
|
-
lines.push(` ${step.name} — ${step.reason}`);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
277
|
if (result.blocked.length) {
|
|
266
278
|
lines.push(
|
|
267
279
|
``,
|
|
268
|
-
`
|
|
280
|
+
`STOP — these block the work. Lisa has no pinned artifact it can place,`,
|
|
281
|
+
`so it cannot fix them for you:`,
|
|
269
282
|
``
|
|
270
283
|
);
|
|
271
284
|
for (const step of result.blocked) {
|
|
272
285
|
const why = result.reasons[step.name];
|
|
273
|
-
lines.push(` ${step.name} — ${step.reason}`);
|
|
274
|
-
if (why) lines.push(`
|
|
286
|
+
lines.push(` [BLOCKED] ${step.name} — ${step.reason}`);
|
|
287
|
+
if (why) lines.push(` required because ${why}`);
|
|
275
288
|
}
|
|
276
289
|
lines.push(
|
|
277
290
|
``,
|
|
278
|
-
`Work needing one of
|
|
279
|
-
`blocked
|
|
291
|
+
` Work needing one of the tools above cannot be completed. Route that`,
|
|
292
|
+
` item to blocked citing that tool, rather than claiming it and`,
|
|
293
|
+
` stopping partway. Nothing else in this report is a reason to stop.`
|
|
280
294
|
);
|
|
281
295
|
}
|
|
296
|
+
if (result.installable.length) {
|
|
297
|
+
lines.push(
|
|
298
|
+
``,
|
|
299
|
+
`NOT A BLOCKER — Lisa can install these itself; they are pinned and`,
|
|
300
|
+
`checksummed. Run /lisa:setup:local-env to place them:`,
|
|
301
|
+
``
|
|
302
|
+
);
|
|
303
|
+
for (const step of result.installable) {
|
|
304
|
+
lines.push(` [INSTALLABLE] ${step.name} — ${step.reason}`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
282
307
|
if (result.unverified.length) {
|
|
283
308
|
lines.push(
|
|
284
309
|
``,
|