Harden search against SQL injection #356
No reviewers
Labels
No labels
antville.org
bug
compatibility
dependency
duplicate
enhancement
help wanted
invalid
java
javascript
major
needs feedback
needs work
no-issue-activity
runtime
security
urgent
usability
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: antville/antville#356
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "355-harden-search-against-sql-injection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sql
library codeSql.prepare()
to managejava.sql.PreparedStatement
objectsSql.prepare()
to modifiy the search queryDatabaseObject.executePreparedRetrieval()
Example code.
The easy route actually was a dead-end: casting the
PreparedStatement
object as a string does not reliably return the desired result (i.e. the actual SQL query).This is due to different DB drivers behaving differently (some compiling the SQL beforehand, some others don’t) and in case of MariaDB we get something like this:
(Note the prefix, the quotes and
parameters
at the end.)Thus, I now introduced a new method to Helma’s
DatabaseObject
to allow retrieval using a prepared statement and getting the result in the desired structure, too.