@biffo/cli 0.193.0 → 0.193.1
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.
|
@@ -444,6 +444,58 @@ if [ -f scripts/practices-monotonic.mjs ]; then
|
|
|
444
444
|
ci_has "practices-monotonic" && run_check corpus-append-only node scripts/practices-monotonic.mjs
|
|
445
445
|
fi
|
|
446
446
|
|
|
447
|
+
# Terraform plan artefacts, refused by CONTENT (biffo-runners#1).
|
|
448
|
+
#
|
|
449
|
+
# A saved plan is a zip. `strings`/`grep` over it is a false-negative machine —
|
|
450
|
+
# a pre-commit check on `terraform/tfplan2` reported it clean and it carried a
|
|
451
|
+
# live private key. gitleaks cannot see inside it either, so the working-tree
|
|
452
|
+
# pass below is no protection: the bytes are compressed.
|
|
453
|
+
#
|
|
454
|
+
# So the answer is not a better scanner, it is refusing to track the artefact at
|
|
455
|
+
# all. Name-based ignoring already failed: `.gitignore` carried `tfplan`, and the
|
|
456
|
+
# file that nearly leaked was `tfplan2`.
|
|
457
|
+
#
|
|
458
|
+
# Detection is content-first: a zip magic (`PK\003\004`) whose central
|
|
459
|
+
# directory names a `tfplan` member. Filenames are stored uncompressed in a zip,
|
|
460
|
+
# so this needs no `unzip` and works on any machine.
|
|
461
|
+
# Skipped for --list, which must answer a question about the repo without doing
|
|
462
|
+
# work. Measured 4.2s over 907 tracked files before this gate existed, which
|
|
463
|
+
# timed out three parity tests that only wanted the check NAMES.
|
|
464
|
+
#
|
|
465
|
+
# Candidates are narrowed by extension FIRST, then detected by content. The
|
|
466
|
+
# narrowing is not a weakening: the files it skips are text, and text is exactly
|
|
467
|
+
# what gitleaks can already scan. The whole reason a plan needs its own guard is
|
|
468
|
+
# that its bytes are compressed and no scanner can read them.
|
|
469
|
+
#
|
|
470
|
+
# `read -r -d ""` is a bashism and this file runs under `sh`. Using it here made
|
|
471
|
+
# the loop error and the guard report nothing — a fail-open inside the guard
|
|
472
|
+
# written to close one. It passed `sh -n`, because the syntax is valid; only
|
|
473
|
+
# running it revealed the failure.
|
|
474
|
+
plan_artefacts=""
|
|
475
|
+
if [ -z "$LIST" ]; then
|
|
476
|
+
plan_artefacts=$(
|
|
477
|
+
git ls-files | while IFS= read -r f; do
|
|
478
|
+
case "$f" in
|
|
479
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.py|*.md|*.json|*.yml|*.yaml|*.tf|\
|
|
480
|
+
*.tfvars|*.sh|*.toml|*.txt|*.css|*.html|*.svg|*.lock|*.snap|*.sql) continue ;;
|
|
481
|
+
esac
|
|
482
|
+
[ -f "$f" ] || continue
|
|
483
|
+
case $(head -c 4 "$f" 2>/dev/null | od -An -c 2>/dev/null | tr -d " ") in
|
|
484
|
+
# -a because the file is binary and grep would otherwise decline to report.
|
|
485
|
+
PK003004) LC_ALL=C grep -aq tfplan "$f" 2>/dev/null && printf "%s\n" "$f" ;;
|
|
486
|
+
esac
|
|
487
|
+
done
|
|
488
|
+
)
|
|
489
|
+
fi
|
|
490
|
+
if [ -n "$plan_artefacts" ]; then
|
|
491
|
+
printf "\033[31mFAIL\033[0m terraform plan artefact is tracked:\n"
|
|
492
|
+
printf " %s\n" $plan_artefacts
|
|
493
|
+
printf "A saved plan is a zip and routinely contains credentials. It cannot be\n"
|
|
494
|
+
printf "scanned by gitleaks or by grep. Remove it from the index:\n"
|
|
495
|
+
printf " git rm --cached <file>\n\n"
|
|
496
|
+
exit 1
|
|
497
|
+
fi
|
|
498
|
+
|
|
447
499
|
# gitleaks, WORKING-TREE pass only (#897). `--no-git` is what CI's second pass
|
|
448
500
|
# runs, and it is the half a pre-push gate can meaningfully do.
|
|
449
501
|
#
|
|
@@ -444,6 +444,58 @@ if [ -f scripts/practices-monotonic.mjs ]; then
|
|
|
444
444
|
ci_has "practices-monotonic" && run_check corpus-append-only node scripts/practices-monotonic.mjs
|
|
445
445
|
fi
|
|
446
446
|
|
|
447
|
+
# Terraform plan artefacts, refused by CONTENT (biffo-runners#1).
|
|
448
|
+
#
|
|
449
|
+
# A saved plan is a zip. `strings`/`grep` over it is a false-negative machine —
|
|
450
|
+
# a pre-commit check on `terraform/tfplan2` reported it clean and it carried a
|
|
451
|
+
# live private key. gitleaks cannot see inside it either, so the working-tree
|
|
452
|
+
# pass below is no protection: the bytes are compressed.
|
|
453
|
+
#
|
|
454
|
+
# So the answer is not a better scanner, it is refusing to track the artefact at
|
|
455
|
+
# all. Name-based ignoring already failed: `.gitignore` carried `tfplan`, and the
|
|
456
|
+
# file that nearly leaked was `tfplan2`.
|
|
457
|
+
#
|
|
458
|
+
# Detection is content-first: a zip magic (`PK\003\004`) whose central
|
|
459
|
+
# directory names a `tfplan` member. Filenames are stored uncompressed in a zip,
|
|
460
|
+
# so this needs no `unzip` and works on any machine.
|
|
461
|
+
# Skipped for --list, which must answer a question about the repo without doing
|
|
462
|
+
# work. Measured 4.2s over 907 tracked files before this gate existed, which
|
|
463
|
+
# timed out three parity tests that only wanted the check NAMES.
|
|
464
|
+
#
|
|
465
|
+
# Candidates are narrowed by extension FIRST, then detected by content. The
|
|
466
|
+
# narrowing is not a weakening: the files it skips are text, and text is exactly
|
|
467
|
+
# what gitleaks can already scan. The whole reason a plan needs its own guard is
|
|
468
|
+
# that its bytes are compressed and no scanner can read them.
|
|
469
|
+
#
|
|
470
|
+
# `read -r -d ""` is a bashism and this file runs under `sh`. Using it here made
|
|
471
|
+
# the loop error and the guard report nothing — a fail-open inside the guard
|
|
472
|
+
# written to close one. It passed `sh -n`, because the syntax is valid; only
|
|
473
|
+
# running it revealed the failure.
|
|
474
|
+
plan_artefacts=""
|
|
475
|
+
if [ -z "$LIST" ]; then
|
|
476
|
+
plan_artefacts=$(
|
|
477
|
+
git ls-files | while IFS= read -r f; do
|
|
478
|
+
case "$f" in
|
|
479
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.py|*.md|*.json|*.yml|*.yaml|*.tf|\
|
|
480
|
+
*.tfvars|*.sh|*.toml|*.txt|*.css|*.html|*.svg|*.lock|*.snap|*.sql) continue ;;
|
|
481
|
+
esac
|
|
482
|
+
[ -f "$f" ] || continue
|
|
483
|
+
case $(head -c 4 "$f" 2>/dev/null | od -An -c 2>/dev/null | tr -d " ") in
|
|
484
|
+
# -a because the file is binary and grep would otherwise decline to report.
|
|
485
|
+
PK003004) LC_ALL=C grep -aq tfplan "$f" 2>/dev/null && printf "%s\n" "$f" ;;
|
|
486
|
+
esac
|
|
487
|
+
done
|
|
488
|
+
)
|
|
489
|
+
fi
|
|
490
|
+
if [ -n "$plan_artefacts" ]; then
|
|
491
|
+
printf "\033[31mFAIL\033[0m terraform plan artefact is tracked:\n"
|
|
492
|
+
printf " %s\n" $plan_artefacts
|
|
493
|
+
printf "A saved plan is a zip and routinely contains credentials. It cannot be\n"
|
|
494
|
+
printf "scanned by gitleaks or by grep. Remove it from the index:\n"
|
|
495
|
+
printf " git rm --cached <file>\n\n"
|
|
496
|
+
exit 1
|
|
497
|
+
fi
|
|
498
|
+
|
|
447
499
|
# gitleaks, WORKING-TREE pass only (#897). `--no-git` is what CI's second pass
|
|
448
500
|
# runs, and it is the half a pre-push gate can meaningfully do.
|
|
449
501
|
#
|