Skip to content

Commit 36a437e

Browse files
committed
avoid SQLi in white-box with no SQL
1 parent 151836f commit 36a437e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

core/src/main/kotlin/org/evomaster/core/problem/enterprise/service/EnterpriseSampler.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ abstract class EnterpriseSampler<T> : Sampler<T>() where T : Individual {
3636
protected set
3737

3838

39+
fun isSUTUsingASQLDatabase() : Boolean{
40+
return sqlInsertBuilder != null
41+
}
42+
3943
override fun applyDerivedParamModifications(ind: T) {
4044

4145
val levels = derivedParamHandler.getOrderLevels()

core/src/main/kotlin/org/evomaster/core/problem/rest/service/SecurityRest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@ class SecurityRest {
278278
if (!config.isEnabledFaultCategory(DefinedFaultCategory.SQL_INJECTION)) {
279279
log.debug("Skipping experimental security test for sql injection as disabled in configuration")
280280
} else {
281-
handleSqlICheck()
281+
if(config.blackBox || sampler.isSUTUsingASQLDatabase()) {
282+
// in white-box testing, if no that the SUT is not using any SQL database, then no point
283+
// in trying any kind of SQLi attack
284+
handleSqlICheck()
285+
}
282286
}
283287

284288
if (config.isEnabledFaultCategory(DefinedFaultCategory.SSRF)) {

0 commit comments

Comments
 (0)