Commit 88a90a7
committed
SchemaController: User PreparedStatements where possible
Use PreparedStatements where possible in the SchemaController in order
to avoid SQL Injections.
Note that PreparedSatements can only dynamically bind values and not
object names, so this technique could only be applied to the queries,
and not the DDL statements. The security around these statement can
probably be improved by sanitizing the schema values, but it's out of
the scope of this PR.
As a side bonus, this PR also uses the try-with-resource idiom when
creating these PreparedStatements and ResultSets so they will be
properly closed instead of the current implementation that may leak
resources.
Closes #1201 parent 90459ed commit 88a90a7
File tree
1 file changed
+14
-8
lines changed- samples/mysql-schema/src/main/java/com/github/containersolutions/operator/sample
1 file changed
+14
-8
lines changedLines changed: 14 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
0 commit comments