SQL Expressions: Add setting to limit length of query (#110165)
sql_expression_query_length_limit Set the maximum length of a SQL query that can be used in a SQL expression. Default is 10000 characters. A setting of 0 means no limit.
This commit is contained in:
@@ -199,4 +199,15 @@ func TestSQLServiceErrors(t *testing.T) {
|
||||
_, err := s.BuildPipeline(t.Context(), req)
|
||||
require.Error(t, err, "whole pipeline fails when selecting a dependency that does not exist")
|
||||
})
|
||||
|
||||
t.Run("pipeline will fail if query is longer than the configured limit", func(t *testing.T) {
|
||||
s, req := newMockQueryService(resp,
|
||||
newABSQLQueries(`SELECT This is too long and does not need to be valid SQL`),
|
||||
)
|
||||
s.cfg.SQLExpressionQueryLengthLimit = 5
|
||||
s.features = featuremgmt.WithFeatures(featuremgmt.FlagSqlExpressions)
|
||||
|
||||
_, err := s.BuildPipeline(t.Context(), req)
|
||||
require.ErrorContains(t, err, "exceeded the configured limit of 5 characters")
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user