harden testing workflows (env-var policy + permissions + SHA-pin)#996
harden testing workflows (env-var policy + permissions + SHA-pin)#996
Conversation
- env-var-ize all ${{ }} expressions inside `run:` blocks across the
test-warehouse, test-all-warehouses, test-all-warehouses-dbt-pre-releases,
and cleanup-stale-schemas workflows
- validate inputs.max-age-hours (fail-closed on non-integer)
- SHA-pin pmeier/pytest-results-action@v0.8.0
- deny GITHUB_TOKEN by default, grant minimum per job
Made-with: Cursor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughWorkflows were tightened with least-privilege permissions, job-level env vars were added, and dbt install/execution logic was refactored and made more robust across multiple GitHub Actions workflows. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
👋 @GuyEshdat |
- revert ${{ github.workspace }} / ${{ env.TESTS_DIR }} inside run: blocks
(these are workflow-internal, not user input \u2014 no security value)
- drop the ELEMENTARY_EXTRA env var in favour of an inline case statement
- fix the drop-stale-schemas --args quoting (mixed-quote, no \\\" escapes)
Made-with: Cursor
Made-with: Cursor
Summary
Hardens the dbt warehouse-test and stale-schema-cleanup workflows.
${{ }}expression insiderun:blocks is now passed throughenv:. Applies to inputs, github context, matrix values, and ternary-style conditional values. None of these are externally exploitable today (matrix values are hardcoded; inputs are write-access-only viaworkflow_dispatch), but the env-var pattern is now consistent across the workflow surface area.inputs.max-age-hoursis fail-closed: validated against^[0-9]+$before reachingdbt run-operation.pmeier/pytest-results-action@v0.8.0(this action runs in the job that has cloud DWH credentials in env).GITHUB_TOKEN: top-levelpermissions: {}, jobs declare the minimum they need (everything in this PR iscontents: read).Test plan
pull_request(internal) andpull_request_target(fork) flows correctly.workflow_dispatchof cleanup with invalidmax-age-hours(e.g.24abc) fails at validation.Made with Cursor
Summary by CodeRabbit