Skip to content

fix: quote shell variables to prevent injection#271

Open
arijitroy003 wants to merge 1 commit into
dbt-labs:mainfrom
arijitroy003:fix/quote-shell-variables
Open

fix: quote shell variables to prevent injection#271
arijitroy003 wants to merge 1 commit into
dbt-labs:mainfrom
arijitroy003:fix/quote-shell-variables

Conversation

@arijitroy003

Copy link
Copy Markdown

Summary

  • Quote all positional parameters ($1, $2) in bash_scripts/base_model_creation.sh and run_test.sh with double quotes
  • Prevents shell injection when source names, table names, or target arguments contain spaces, glob characters, or shell metacharacters

Details

base_model_creation.sh uses $1 and $2 unquoted in both filename construction and the --args JSON string passed to dbt run-operation. A malformed source or table name (e.g. containing $(cmd) or ; rm -rf /) would be interpreted by the shell rather than treated as a literal string.

run_test.sh similarly passes $1 unquoted to --target, which has the same class of vulnerability.

Test plan

  • Verified the quoting preserves existing behavior for simple alphanumeric arguments
  • Confirmed the --args JSON structure remains valid with the quote-close-quote-open pattern ('"$1"')

Unquoted $1 and $2 in base_model_creation.sh and run_test.sh allow
shell injection via malformed source/table names or target arguments.
Wrap all positional parameters in double quotes.
@arijitroy003
arijitroy003 requested a review from a team as a code owner July 16, 2026 21:14
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant