Skip to content

test(security): record a tflint 0.65.0 run - #2729

Merged
dan-petty merged 4 commits into
mainfrom
test/2427-record-tflint-run
Oct 30, 2026
Merged

dan-petty merged 4 commits into
mainfrom
test/2427-record-tflint-run

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Record a run of the pinned tflint 0.65.0 with findings, so the tflint adapter is held to the real output of the tool.

What and why

  • tests/fixtures/scanner_runs/runs_with_findings.json gets the key tflint. It holds the exit code (2), the stdout and the empty stderr of tflint --format json --recursive, run with the pinned 0.65.0 binary over a tree with two .tf files, one in modules/network. The report has six warning issues of the bundled terraform ruleset 0.15.0. Each file name is relative to the tree, and --recursive gives the module file as modules/network/main.tf.
  • A test in tests/security/test_tflint.py reads the recording through script_run_with_findings and asserts the command, the status ran and all six findings with rule, message, severity (MEDIUM) and relative file name.
  • test_each_run_with_findings_is_of_the_version_the_tools_lock_pins now holds the recording to the locked tflint version.
  • The parser is correct against the real run, so no product code changes. It ignores fixable, fixed and callers on purpose: devops never runs tflint --fix, and the finding already names the file and the line.
  • This closes the last open acceptance criterion of fix(security): tflint and dive are pinned in tools.lock, or their adapters and the tflint fallback go #2427: the earlier change pinned tflint and deleted the fallback and dive, and it left the recording to a run that the owner had to approve.

Change: openspec/changes/archive/2026-10-30-2427-record-tflint-run/

Closes #2427

@dan-petty dan-petty added scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/security Type security: a vulnerability or a leak labels Oct 30, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Targeted tests (all passed, 58 tests): tests/security, tests/test_scanner_contract.py, tests/test_security_gitleaks.py, tests/test_security_kubeconform.py, tests/commands/test_k8s_audit.py, tests/test_tools_lock.py. uv run devops openspec check passed.

Fail-to-pass on origin/main (devops ci fail-to-pass --base origin/main), run on the test commit alone:

ℹ Quality gate root: <worktree>
  passed on base: tests.security.test_tflint::test_a_tflint_issue_becomes_a_finding_with_its_rule_and_message
  passed on base: tests.security.test_tflint::test_a_tflint_that_cannot_start_is_a_failed_scan_and_not_a_fallback
  passed on base: tests.security.test_tflint::test_a_scan_maps_each_tflint_severity
  passed on base: tests.security.test_tflint::test_a_scan_starts_tflint_recursive_with_json_output_and_the_config_file
  passed on base: tests.security.test_tflint::test_a_clean_report_is_a_scan_that_ran_with_no_finding
  passed on base: tests.security.test_tflint::test_a_tree_whose_tf_files_are_in_sub_directories_is_linted_there
  passed on base: tests.security.test_tflint::test_a_scan_without_tflint_is_unavailable_and_has_no_finding
  passed on base: tests.security.test_tflint::test_a_report_with_an_error_and_no_issue_is_a_failed_scan
  failed on base: tests.security.test_tflint::test_the_recorded_tflint_run_gives_one_finding_for_each_issue_with_its_relative_file (KeyError: 'tflint')
1 failed on base (1 failed and 8 passed in tests/security/test_tflint.py; 0 errored).
Elapsed: 20s

@dan-petty
dan-petty marked this pull request as ready for review October 30, 2026 01:14
@dan-petty
dan-petty merged commit 79ff8bd into main Oct 30, 2026
17 checks passed
@dan-petty
dan-petty deleted the test/2427-record-tflint-run branch October 30, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/security Type security: a vulnerability or a leak

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(security): tflint and dive are pinned in tools.lock, or their adapters and the tflint fallback go

1 participant