Repository navigation
Commit 14c8a4e
fix(check): reject non-SQL files by extension — plug v0.9.6 sanity regression
The Verdaccio sanity suite's path-traversal security test
(test/sanity/phases/security.sh:96-103, present + passing since PR #844
in June 2026) regressed on v0.9.6. Not the test's fault: the altimate-
core 0.7.0 upgrade in #1090 introduced a `multi_statement` safety rule
that echoes the offending statement text back in its error message.
When `altimate check ../../../../etc/passwd` runs, the CLI reads the
file, parses each line as SQL, fails, and the engine emits:
ERROR ... [multi_statement]: Disallowed statement type:
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
The sanity test greps case-insensitive for `root:x:0` — matches — fails
the release workflow. No content actually shipped: publish + GitHub
Release + Docker were all skipped when sanity failed.
Fix: honor the "SQL file" claim in check.ts:479's own comment. The
prior filter only checked existence — non-`.sql` files were parsed
happily. Now rejects anything without a `.sql`/`.ddl` extension before
it reaches the engine, so no content is parsed or echoed. Extracted
the extension test as `isSqlFile()` in check-helpers so it can be
unit-tested independently.
Verification:
- rebuilt the darwin-arm64 binary and re-ran the exact sanity
reproduction locally: pre-fix leaked ROOT:X:0 line; post-fix skips
with "Warning: not a SQL file (extension \"none\"), skipping: ..."
- 82/82 tests in test/cli/check-e2e.test.ts pass (9 new isSqlFile
cases + 73 pre-existing)
- typecheck clean; marker guard clean
Follow-ups (not in this PR):
- The engine-side fix — altimate-core's multi_statement rule should
use statement TYPE NAMES, not raw content — file with core team
- Consider capping message length in check.ts finding-mappers as
belt-and-braces against similar future engine-echo bugs
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 07e3674 commit 14c8a4e
3 files changed
Lines changed: 92 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
50 | 64 | | |
51 | 65 | | |
52 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
476 | 477 | | |
477 | 478 | | |
478 | 479 | | |
479 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
480 | 490 | | |
481 | 491 | | |
482 | 492 | | |
483 | 493 | | |
484 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
485 | 500 | | |
486 | 501 | | |
487 | 502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
1401 | 1402 | | |
1402 | 1403 | | |
1403 | 1404 | | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
1404 | 1466 | | |
0 commit comments