Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
60e27d9b
Commit
60e27d9b
authored
12 years ago
by
brinn
Browse files
Options
Downloads
Patches
Plain Diff
[BIS-260] Fix SQL injections for custom queries
Add some defensive checks for parameter resolution. SVN: 27624
parent
309ed4cd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/DAO.java
+9
-1
9 additions, 1 deletion
...ava/ch/systemsx/cisd/openbis/plugin/query/server/DAO.java
with
9 additions
and
1 deletion
openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/DAO.java
+
9
−
1
View file @
60e27d9b
...
@@ -223,7 +223,11 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO
...
@@ -223,7 +223,11 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO
for
(
Entry
<
String
,
String
>
entry
:
bindingsOrNull
.
getBindings
().
entrySet
())
for
(
Entry
<
String
,
String
>
entry
:
bindingsOrNull
.
getBindings
().
entrySet
())
{
{
template
.
bind
(
entry
.
getKey
(),
"?"
);
template
.
bind
(
entry
.
getKey
(),
"?"
);
indexMap
.
put
(
template
.
tryGetIndex
(
entry
.
getKey
()),
entry
);
final
int
index
=
template
.
tryGetIndex
(
entry
.
getKey
());
if
(
index
>=
0
)
{
indexMap
.
put
(
index
,
entry
);
}
}
}
}
}
final
PreparedStatement
psm
=
con
.
prepareStatement
(
template
.
createText
());
final
PreparedStatement
psm
=
con
.
prepareStatement
(
template
.
createText
());
...
@@ -231,6 +235,10 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO
...
@@ -231,6 +235,10 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO
for
(
int
i
=
1
;
i
<=
pmd
.
getParameterCount
();
++
i
)
for
(
int
i
=
1
;
i
<=
pmd
.
getParameterCount
();
++
i
)
{
{
final
Entry
<
String
,
String
>
entry
=
indexMap
.
get
(
i
-
1
);
final
Entry
<
String
,
String
>
entry
=
indexMap
.
get
(
i
-
1
);
if
(
entry
==
null
)
{
throw
new
SQLDataException
(
"No variable found for for parameter "
+
i
);
}
final
String
strValue
=
entry
.
getValue
();
final
String
strValue
=
entry
.
getValue
();
try
try
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment