Repository navigation
Conversation
Terraform state files store resource attributes such as passwords and private keys in plaintext, but contain none of the token prefixes the line scanner recognises. Refuse *.tfstate, *.tfstate.backup and paths under .terraform/ before upload, with the same exact-path --allow-path override as .env. The committed .terraform.lock.hcl stays reviewable.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Who it helps
Teams that keep Terraform in the same repository they review with
proofline reviewor the git hooks. That is most of Proofline's audience. Aterraform.tfstatestores every resource attribute in plaintext, including RDS master passwords, generated TLS private keys, IAM access keys and backend credentials. It ends up in a local patch more often than it should: a repo without a Terraform.gitignore, aterraform state pull > prod.tfstatewhile debugging, or--include-untracked. Today the preflight refuses.envpaths and known token shapes, but it lets state through. A state file usually contains noghp_/AKIAprefix the line scanner recognises, so the whole file goes to the review server.What changed
src/preflight.rs: a new path rule besideenvironment_paths. It refuses any old or new endpoint that is.tfstateor.tfstate.backup(this coversterraform.tfstate.d/<workspace>/terraform.tfstate), or.terraform/directory, which caches the backend state and configuration..terraform.lock.hcl,*.tf,*.tfvarsand paths such asdocs/tfstate.mdare not affected. The lock file is meant to be committed and reviewed.PreflightError::TerraformStatePathvariant and message. The message says why the file is refused and points to--allow-path. The same exact-path override works as it does for.env, and a rename needs both endpoints allowed.review --path.Decisions
.envis handled..envmessage, so the diagnostic tells the user why a Terraform file is sensitive..tfvarsstays out. It often holds secrets too, but many teams commit non-secret*.tfvarson purpose, and refusing them would break normal reviews. Happy to add it behind the same override if you'd like.How I verified it
preflight.rscover:.terraform-versionand look-alike names--allow-pathbehaviour and the message texttests/local_patch.rsruns the real binary against a temporary checkout. The checkout holdsinfra/terraform.tfstate(with a fake password),infra/.terraform.lock.hclandinfra/main.tf. The test checks that the review is refused before any HTTP request and that the password never appears in stderr. It then checks that--allow-path infra/terraform.tfstateuploads the original patch unchanged, lock file included.cargo fmt --check,cargo clippy --locked --all-targets -- -D warningsandcargo test --lockedall pass on the pinned 1.100.0 toolchain: 149 unit tests plus every integration suite.