Unauthorized sql request should return 403 (#6279)

This commit is contained in:
Dayue Gao 2018-09-02 00:17:18 +08:00 committed by Fangjin Yang
parent d0fb83760e
commit 743547fc3b
1 changed files with 4 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import org.apache.druid.java.util.common.guava.Yielder;
import org.apache.druid.java.util.common.guava.Yielders; import org.apache.druid.java.util.common.guava.Yielders;
import org.apache.druid.java.util.common.logger.Logger; import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.query.QueryInterruptedException; import org.apache.druid.query.QueryInterruptedException;
import org.apache.druid.server.security.ForbiddenException;
import org.apache.druid.sql.calcite.planner.Calcites; import org.apache.druid.sql.calcite.planner.Calcites;
import org.apache.druid.sql.calcite.planner.DruidPlanner; import org.apache.druid.sql.calcite.planner.DruidPlanner;
import org.apache.druid.sql.calcite.planner.PlannerFactory; import org.apache.druid.sql.calcite.planner.PlannerFactory;
@ -160,6 +161,9 @@ public class SqlResource
throw Throwables.propagate(e); throw Throwables.propagate(e);
} }
} }
catch (ForbiddenException e) {
throw e; // let ForbiddenExceptionMapper handle this
}
catch (Exception e) { catch (Exception e) {
log.warn(e, "Failed to handle query: %s", sqlQuery); log.warn(e, "Failed to handle query: %s", sqlQuery);