Conversation
…y_cached steps Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add dynamic table name support in step.db_query and step.db_exec
feat: dynamic table name support in db_query, db_exec, db_query_cached steps
Mar 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an explicit, opt-in mechanism for templating SQL identifiers at runtime in the pipeline DB steps to support multi-tenant/partition-per-tenant table naming while attempting to guard against SQL injection.
Changes:
- Introduces
allow_dynamic_sqltostep.db_query,step.db_exec, andstep.db_query_cached, enabling runtime template resolution inquery. - Adds shared dynamic SQL resolution + identifier validation utilities (
resolveDynamicSQL,validateSQLIdentifier). - Expands unit tests to cover dynamic table names and injection rejection for
db_query,db_exec, anddb_query_cached.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
schema/module_schema.go |
Documents and registers allow_dynamic_sql for the three DB steps. |
module/pipeline_step_db_dynamic.go |
New helper for resolving {{ }} in SQL and validating interpolated identifiers. |
module/pipeline_step_db_query.go |
Adds allowDynamicSQL handling; resolves dynamic SQL before DB/app access. |
module/pipeline_step_db_exec.go |
Adds allowDynamicSQL handling; resolves dynamic SQL before DB/app access. |
module/pipeline_step_db_query_cached.go |
Adds allowDynamicSQL handling; resolves dynamic SQL early and threads resolved query into execution path. |
module/pipeline_step_db_query_test.go |
Adds tests for dynamic table name, injection rejection, and empty identifier rejection. |
module/pipeline_step_db_exec_test.go |
Adds tests for dynamic table name and injection rejection. |
module/pipeline_step_db_query_cached_test.go |
Adds tests for dynamic table name and injection rejection. |
Contributor
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Contributor
Author
Applied in e6d10a4:
|
This was referenced Mar 3, 2026
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.
validateSQLIdentifierandresolveDynamicSQLhelper functions (alphanumeric/underscore/hyphen allowlist)allowDynamicSQL boolfield toDBQueryStep,DBExecStep,DBQueryCachedStepallow_dynamic_sqlconfig; skip template rejection whentrueExecutefunctions: useresolveDynamicSQLbefore app-nil check so injection fails fastallow_dynamic_sqlconfig field in all three step typesvalidateSQLIdentifierto ASCII-only (was Unicode-wide){{template action instead of silently returning unchanged query{{ }}occurrence independently (no de-dup) so non-deterministic funcs like{{uuid}}work correctly per occurrenceOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.