Skip to content

Commit d6b873a

Browse files
chore(container): remove tfsec, replace with trivy config, fix gitleaks version (#15)
tfsec is deprecated (merged into Trivy). Replace `tfsec .` with `trivy config --exit-code 1 .` in the security target. Remove tfsec from Dockerfile, install scripts, tests, docs, and version manifest. Pin gitleaks to v8.30.0 with -ldflags so `gitleaks version` reports the actual version instead of "version is set by build process". Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 77056ff commit d6b873a

File tree

7 files changed

+12
-24
lines changed

7 files changed

+12
-24
lines changed

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ These eight rules are non-negotiable. Every developer and every AI agent must fo
2424

2525
6. **Use the shared logging library.** No raw `echo` for status messages. Use `log_info`, `log_warn`, `log_error`, `log_debug`, and `die` from `lib/log.sh`.
2626

27-
7. **Never suppress failing checks.** When a lint, format, security, or test check fails, fix the underlying issue. Never comment out code, add suppression annotations (`# noqa`, `# nosec`, `#tfsec:ignore`, `// nolint`), disable rules, or mark CI jobs as allowed-to-fail to bypass a failing check. If a finding is a confirmed false positive, document the justification inline alongside the tool's designated suppression mechanism.
27+
7. **Never suppress failing checks.** When a lint, format, security, or test check fails, fix the underlying issue. Never comment out code, add suppression annotations (`# noqa`, `# nosec`, `// nolint`), disable rules, or mark CI jobs as allowed-to-fail to bypass a failing check. If a finding is a confirmed false positive, document the justification inline alongside the tool's designated suppression mechanism.
2828

2929
8. **Update documentation when changing behavior.** When a change affects public interfaces, configuration, CLI usage, or setup steps, update the relevant documentation (README, DEVELOPMENT.md, inline docs) in the same commit or PR. Do not leave documentation out of sync with code.
3030

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# === Builder stage: Go-based tools ===
2-
# Compiles Go-based tools (shfmt, tflint, tfsec, terraform-docs, trivy, gitleaks)
2+
# Compiles Go-based tools (shfmt, tflint, terraform-docs, trivy, gitleaks)
33
FROM golang:1.24-bookworm AS go-builder
44

55
ARG TARGETARCH
@@ -11,14 +11,13 @@ RUN go install mvdan.cc/sh/v3/cmd/shfmt@latest
1111
# Install tflint
1212
RUN go install github.com/terraform-linters/tflint@latest
1313

14-
# Install tfsec
15-
RUN go install github.com/aquasecurity/tfsec/cmd/tfsec@latest
16-
1714
# Install terraform-docs
1815
RUN go install github.com/terraform-docs/terraform-docs@latest
1916

20-
# Install gitleaks
21-
RUN go install github.com/zricethezav/gitleaks/v8@latest
17+
# Install gitleaks (pin version + inject via ldflags so `gitleaks version` reports correctly)
18+
ARG GITLEAKS_VERSION=v8.30.0
19+
RUN go install -ldflags "-X github.com/zricethezav/gitleaks/v8/version.Version=${GITLEAKS_VERSION}" \
20+
github.com/zricethezav/gitleaks/v8@${GITLEAKS_VERSION}
2221

2322
# Install golangci-lint v2
2423
RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
@@ -121,7 +120,6 @@ COPY --from=go-builder /usr/local/go /usr/local/go
121120
# Copy Go-built binaries from builder
122121
COPY --from=go-builder /go/bin/shfmt /usr/local/bin/shfmt
123122
COPY --from=go-builder /go/bin/tflint /usr/local/bin/tflint
124-
COPY --from=go-builder /go/bin/tfsec /usr/local/bin/tfsec
125123
COPY --from=go-builder /go/bin/terraform-docs /usr/local/bin/terraform-docs
126124
COPY --from=go-builder /go/bin/gitleaks /usr/local/bin/gitleaks
127125
COPY --from=go-builder /go/bin/golangci-lint /usr/local/bin/golangci-lint

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ _security: _check-config
697697
fi; \
698698
if [ -n "$(HAS_TERRAFORM)" ]; then \
699699
ran_languages="$${ran_languages}\"terraform\","; \
700-
tfsec . || { overall_exit=1; failed_languages="$${failed_languages}\"terraform:tfsec\","; }; \
700+
trivy config --exit-code 1 . || { overall_exit=1; failed_languages="$${failed_languages}\"terraform:trivy-config\","; }; \
701701
if [ "$(DEVRAIL_FAIL_FAST)" = "1" ] && [ $$overall_exit -ne 0 ]; then \
702702
end_time=$$(date +%s%3N); \
703703
duration=$$((end_time - start_time)); \
@@ -886,7 +886,7 @@ _docs: _check-config
886886
if [ -n "$(HAS_TERRAFORM)" ]; then \
887887
_tv terraform "terraform version"; \
888888
_tv tflint "tflint --version"; \
889-
_tv tfsec "tfsec --version"; \
889+
_tv trivy "trivy --version"; \
890890
_tv checkov "checkov --version"; \
891891
_tv terraform-docs "terraform-docs --version"; \
892892
_tv terragrunt "terragrunt --version"; \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test Run validation tests
5151
|----------------|---------------------------------------------------|
5252
| Python | ruff, bandit, semgrep, pytest, mypy |
5353
| Bash | shellcheck, shfmt, bats |
54-
| Terraform | tflint, tfsec, checkov, terraform-docs, terraform, terragrunt |
54+
| Terraform | tflint, trivy config, checkov, terraform-docs, terraform, terragrunt |
5555
| Ansible | ansible-lint, molecule |
5656
| Ruby | rubocop, reek, brakeman, bundler-audit, rspec, sorbet |
5757
| Go | golangci-lint, gofumpt, govulncheck, go test |

scripts/install-terraform.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
# Tools installed:
1010
# - tflint (Terraform linter — built in Go builder stage)
11-
# - tfsec (Terraform security scanner — built in Go builder stage)
1211
# - checkov (IaC security scanner — installed via pip)
1312
# - terraform-docs (Terraform documentation gen — built in Go builder stage)
1413
# - terraform (Terraform CLI — downloaded from HashiCorp)
@@ -33,7 +32,7 @@ source "${DEVRAIL_LIB}/platform.sh"
3332
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
3433
log_info "install-terraform.sh — Install Terraform tooling for DevRail"
3534
log_info "Usage: bash scripts/install-terraform.sh [--help]"
36-
log_info "Tools: tflint, tfsec, checkov, terraform-docs, terraform, terragrunt"
35+
log_info "Tools: tflint, checkov, terraform-docs, terraform, terragrunt"
3736
log_info "Note: terratest is a Go module dependency — not installed as a binary"
3837
exit 0
3938
fi
@@ -60,13 +59,6 @@ else
6059
log_warn "tflint not found — expected to be copied from Go builder stage"
6160
fi
6261

63-
# Verify tfsec is available (built in Go builder stage and copied)
64-
if command -v tfsec &>/dev/null; then
65-
log_info "tfsec is already installed"
66-
else
67-
log_warn "tfsec not found — expected to be copied from Go builder stage"
68-
fi
69-
7062
# Verify terraform-docs is available (built in Go builder stage and copied)
7163
if command -v terraform-docs &>/dev/null; then
7264
log_info "terraform-docs is already installed"

scripts/report-tool-versions.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# Tool ecosystems:
1313
# Python — ruff, bandit, mypy, pytest, semgrep
1414
# Bash — shellcheck, shfmt, bats
15-
# Terraform — terraform, tflint, tfsec, checkov, terraform-docs
15+
# Terraform — terraform, tflint, checkov, terraform-docs
1616
# Ansible — ansible-lint, molecule
1717
# Ruby — rubocop, reek, brakeman, bundler-audit, rspec, srb
1818
# Go — go, golangci-lint, gofumpt, govulncheck
@@ -101,7 +101,6 @@ _json() {
101101
# Terraform
102102
_tv terraform "terraform version"
103103
_tv tflint "tflint --version"
104-
_tv tfsec "tfsec --version"
105104
_tv checkov "checkov --version"
106105
_tv terraform-docs "terraform-docs --version"
107106

tests/test-terraform.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ source "${DEVRAIL_LIB}/log.sh"
1818
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
1919
log_info "test-terraform.sh — Validate Terraform tooling installation"
2020
log_info "Usage: bash tests/test-terraform.sh [--help]"
21-
log_info "Checks: tflint, tfsec, checkov, terraform-docs, terraform, terragrunt"
21+
log_info "Checks: tflint, checkov, terraform-docs, terraform, terragrunt"
2222
exit 0
2323
fi
2424

@@ -48,7 +48,6 @@ check_tool() {
4848
}
4949

5050
check_tool "tflint" "--version"
51-
check_tool "tfsec" "--version"
5251
check_tool "checkov" "--version"
5352
check_tool "terraform-docs" "--version"
5453
check_tool "terraform" "version"

0 commit comments

Comments
 (0)