Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve SQL injection for Athena?

I am working on writing a Spring Java program accessing data from Athena, but I found that Athena JDBC driver does not support PreparedStatement, does anyone have idea about how to avoid SQL injection on Athena?

like image 690
Tsing Avatar asked Jun 12 '18 18:06

Tsing


1 Answers

Athena now has support for prepared statements (this was not the case when the question was asked).

That being said, prepared statements aren't the only way to guard against SQL injection attacks in Athena, and SQL injection attacks aren't as serious as they are in a database.

  • Athena is just a query engine, not a database. While dropping a table can be disruptive, tables are just metadata, and the data is not dropped along with it.
  • Athena's API does not allow multiple statements in the same execution, so you can't sneak a DROP TABLE foo into a statement without completely replacing the query.
  • Athena does not, by design, have any capability of deleting data. Athena has features that can create new data, such as CTAS, but it will refuse to write into an existing location and cannot overwrite existing data.
like image 71
Theo Avatar answered Oct 21 '22 20:10

Theo