You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(tool/bigquery): prevent allowedDatasets bypass in forecast query (#3324)
Addressing vulnerabilities in `bigquery-analyze-contribution` and
`bigquery-forecast` tools.
- Updated the tool options (like column names and metrics) to
automatically wrap in single quotes, making it impossible for external
users to inject malicious SQL code.
- For query inputs, the tool now dry-runs the entire fully assembled
statement against BigQuery to inspect every dataset it will access,
guaranteeing that hidden accesses (like those inside SQL Views) are
caught and blocked.
Reported by: Matteo Panzeri
"An array of column names that uniquely identify each dimension.", false, parameters.NewStringParameter("dimension_id_col", "A dimension column name."))
121
+
"An array of column names that uniquely identify each dimension.", false, parameters.NewStringParameterWithEscape("dimension_id_col", "A dimension column name.", "single-quotes"))
returnnil, util.NewAgentError(fmt.Sprintf("the 'input_data' parameter only supports a table ID or a SELECT query. The provided query has statement type '%s'", statementType), nil)
returnnil, util.NewAgentError(fmt.Sprintf("query in input_data accesses dataset '%s.%s', which is not in the allowed list", tableRef.ProjectId, tableRef.DatasetId), nil)
254
-
}
255
-
}
256
-
} else {
257
-
returnnil, util.NewAgentError("could not analyze query in input_data to validate against allowed datasets", nil)
returnnil, util.NewAgentError(fmt.Sprintf("query accesses dataset '%s.%s', which is not in the allowed list", tableRef.ProjectID, tableRef.DatasetID), nil)
289
+
}
290
+
}
291
+
} else {
292
+
returnnil, util.NewAgentError("could not get query statistics details during dry run validation", nil)
293
+
}
294
+
} else {
295
+
returnnil, util.NewAgentError("could not dry run model creation query to validate allowed datasets", nil)
0 commit comments