9e8f1bbeed
Dashboard / frontend (push) Failing after 0s
Dashboard / api (push) Failing after 0s
Lint PowerShell / powershell-lint (ubuntu-latest) (push) Failing after 1s
Python Lint / Lint Python with Ruff (push) Failing after 1s
ShellCheck / Lint shell scripts (push) Failing after 1s
Matrix Smoke / linux-smoke (push) Failing after 1s
Matrix Smoke / distro: cachyos (push) Failing after 15s
Matrix Smoke / distro: linux-mint-21.3 (push) Failing after 15s
Matrix Smoke / distro: debian-12 (push) Failing after 5m21s
Matrix Smoke / distro: fedora-41 (push) Failing after 4m56s
Matrix Smoke / distro: ubuntu-24.04 (push) Failing after 2m13s
Matrix Smoke / distro: rocky-9 (push) Failing after 10m39s
Matrix Smoke / distro: manjaro (push) Failing after 12m11s
Matrix Smoke / distro: opensuse-tw (push) Failing after 11m53s
Matrix Smoke / distro: archlinux (push) Failing after 20m3s
Matrix Smoke / distro: ubuntu-22.04 (push) Failing after 13m49s
Validate .env Schema / tier-1-env-validation (push) Successful in 52s
Validate .env Schema / tier-2-env-validation (push) Successful in 44s
Validate .env Schema / tier-3-env-validation (push) Successful in 52s
Validate .env Schema / tier-4-env-validation (push) Successful in 51s
Validate Extensions Catalog / Check catalog is up-to-date (push) Failing after 9m47s
Secret Scan / Scan for secrets (push) Failing after 21m4s
Validate Docker Compose / Validate Docker Compose files (push) Has been cancelled
Python Type Check / Type check with mypy (push) Has been cancelled
Validate .env Schema / tier-0-env-validation (push) Has been cancelled
Test Linux / integration-smoke (push) Has been cancelled
Lint PowerShell / powershell-lint (windows-latest) (push) Has been cancelled
Matrix Smoke / macos-smoke (push) Has been cancelled
53 lines
2.2 KiB
Awk
53 lines
2.2 KiB
Awk
# ============================================================================
|
|
# Detect legacy backticks (`cmd`) inside the body of UNQUOTED here-documents.
|
|
# ============================================================================
|
|
# Issue #509. Quoted here-documents (<<'EOF' / <<"EOF") suppress shell
|
|
# expansion, so backticks there are literal characters and harmless. Unquoted
|
|
# here-documents (<<EOF / <<-EOF) DO expand backticks as command substitutions
|
|
# — and unlike normal `$(...)`, those expansions can't be nested cleanly and
|
|
# are easy to misread as plain text. Forbid the pattern outright in installer
|
|
# scripts where the value of the heredoc body is what gets shipped to users
|
|
# (systemd unit files, generated config snippets, README fragments, …).
|
|
#
|
|
# Run via: awk -f scripts/check-heredoc-backticks.awk <files>
|
|
# Exit codes:
|
|
# 0 — no offending heredocs found
|
|
# 1 — at least one offending line; details on stderr
|
|
#
|
|
# This is awk (POSIX) on purpose: the pre-commit hook runs on every developer
|
|
# workstation including macOS BSD awk, so we avoid GNU-only features.
|
|
# ============================================================================
|
|
|
|
BEGIN { in_heredoc = 0; found = 0 }
|
|
|
|
{
|
|
if (in_heredoc) {
|
|
# End of heredoc: line whose only content is the marker (optionally
|
|
# indented when the opener used `<<-`). Body lines may themselves
|
|
# equal the marker if they are indented differently — the closing
|
|
# rule matches the *trimmed* line.
|
|
if ($0 ~ ("^[ \t]*" heredoc_marker "[ \t]*$")) {
|
|
in_heredoc = 0
|
|
next
|
|
}
|
|
if (index($0, "`") > 0) {
|
|
print FILENAME ":" FNR ": backtick in unquoted heredoc body: " $0 > "/dev/stderr"
|
|
found = 1
|
|
}
|
|
next
|
|
}
|
|
|
|
# Detect an UNQUOTED heredoc opener of the form `<<MARKER` or `<<-MARKER`
|
|
# where MARKER starts with [A-Za-z_]. This regex deliberately rejects
|
|
# `<<'EOF'` and `<<"EOF"` because the quote character appears between
|
|
# `<<-?` and the alphanumeric marker, breaking the match.
|
|
if (match($0, /<<-?[A-Za-z_][A-Za-z0-9_]*/)) {
|
|
marker = substr($0, RSTART, RLENGTH)
|
|
sub(/^<<-?/, "", marker)
|
|
in_heredoc = 1
|
|
heredoc_marker = marker
|
|
}
|
|
}
|
|
|
|
END { exit found ? 1 : 0 }
|