Static checking of dynamically generated queries in database applications
Gary Wassermann, Carl Gould, Zhendong Su et al. · ACM Transactions on Software Engineering and Methodology · 2007
Many data-intensive applications dynamically construct queries in response to client requests and execute them. Java servlets, for example, can create strings that represent SQL queries and then send the queries, using JDBC, to a database server for execution. The servlet programmer enjoys static checking via Java's strong type system. However, the Java type system does little to check for possible errors in the dynamically generated SQL query strings. Thus, a type error in a generated selection query (e.g., comparing a string attribute with an integer) can result in an SQL runtime exception. Currently, such defects must be rooted out through careful testing, or (worse) might be found by customers at runtime. In this article, we present a sound , static program analysis technique to verify that dynamically generated query strings do not contain type errors. We describe our analysis technique and provide soundness results for our static analysis algorithm. We also describe the details of a prototype tool based on the algorithm and present several illustrative defects found in senior software-engineering student-team projects, online tutorial examples, and a real-world purchase order system written by one of the authors.
Cited by 98 works. doi:10.1145/1276933.1276935
Authors
References
- Compilers: Principles, Techniques, and Tools
- J.E.Hopcroft, J.D. Ullman 著, "Introduction to Automata Theory, Languages, and Computation", Addison-Wesley, A5変形版, X+418, \6,670, 1979
- A unified approach to global program optimization
- Precise interprocedural dataflow analysis via graph reachability
- Global Data Flow Analysis and Iterative Algorithms
- Program Analysis and Specialization for the C Programming Language
- Building Secure Software: How to Avoid Security Problems the Right Way
- Precise analysis of string expressions
- Hygienic macro expansion
- Control flow analysis in scheme