Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,16 @@ public IPrestoSparkQueryExecution create(
Optional<QueryType> queryType = StatementUtils.getQueryType(preparedQuery.getStatement().getClass());
if (queryType.isPresent() && (queryType.get() == QueryType.DATA_DEFINITION || queryType.get() == QueryType.CONTROL)) {
queryStateTimer.endAnalysis();
accessControl.checkQueryIntegrity(session.getIdentity(), session.getAccessControlContext(), sql, ImmutableMap.of(), ImmutableMap.of());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 question (security): Consider whether query integrity checks should also apply to EXPLAIN VALIDATE and other non-DDL/non-DML statement types for consistency.

Currently checkQueryIntegrity is invoked for DDL/CONTROL and the general query path, but not in the isExplainTypeValidate branch. If this check is intended to protect against malformed or tampered SQL, please confirm whether EXPLAIN VALIDATE (and any other specialized branches) should also invoke it so they cannot bypass these protections.

DDLDefinitionTask<?> task = (DDLDefinitionTask<?>) ddlTasks.get(preparedQuery.getStatement().getClass());
return new PrestoSparkDataDefinitionExecution(task, preparedQuery.getStatement(), transactionManager, accessControl, metadata, session, queryStateTimer, warningCollector, sql);
}
else if (preparedQuery.isExplainTypeValidate()) {
return accessControlChecker.createExecution(session, preparedQuery, queryStateTimer, warningCollector, sql);
}
else {
accessControl.checkQueryIntegrity(session.getIdentity(), session.getAccessControlContext(), sql, ImmutableMap.of(), ImmutableMap.of());

VariableAllocator variableAllocator = new VariableAllocator();
PlanNodeIdAllocator planNodeIdAllocator = new PlanNodeIdAllocator();
planAndMore = queryPlanner.createQueryPlan(session, preparedQuery, warningCollector, variableAllocator, planNodeIdAllocator, sparkContext, sql);
Expand Down
Loading