Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class XSSReflectedEMTest : SpringTestBase() {
) { args: MutableList<String> ->

setOption(args, "security", "true")
setOption(args, "xss", "true")


val solution = initAndRun(args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class XSSReflectedJSONEMTest : SpringTestBase() {
) { args: MutableList<String> ->

setOption(args, "security", "true")
setOption(args, "xss", "true")


val solution = initAndRun(args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class XSSStoredEMTest : SpringTestBase() {
) { args: MutableList<String> ->

setOption(args, "security", "true")
setOption(args, "xss", "true")


val solution = initAndRun(args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class XSSStoredJSONEMTest : SpringTestBase() {
) { args: MutableList<String> ->

setOption(args, "security", "true")
setOption(args, "xss", "true")


val solution = initAndRun(args)
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/kotlin/org/evomaster/core/EMConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ class EMConfig {
throw ConfigProblemException("The use of 'ssrf' requires 'security'")
}

if(!security && xss) {
throw ConfigProblemException("The use of 'xss' requires 'security'")
}

if (ssrf &&
vulnerableInputClassificationStrategy == VulnerableInputClassificationStrategy.LLM &&
!languageModelConnector) {
Expand Down Expand Up @@ -2597,6 +2601,10 @@ class EMConfig {
@Cfg("To apply SSRF detection as part of security testing.")
var ssrf = false

@Experimental
@Cfg("To apply XSS detection as part of security testing.")
var xss = false

@Regex(faultCodeRegex)
@Cfg("Disable oracles. Provide a comma-separated list of codes to disable. " +
"By default, all oracles are enabled."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class SecurityRest {
handleNotRecognizedAuthenticated()
}

if (!config.isEnabledFaultCategory(DefinedFaultCategory.XSS)) {
if (!config.xss || !config.isEnabledFaultCategory(DefinedFaultCategory.XSS)) {
LoggingUtil.uniqueUserInfo("Skipping security test for XSS as disabled in configuration")
} else {
handleXSSCheck()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ abstract class AbstractRestFitness : HttpWsFitness<RestIndividual>() {
actionResults: List<ActionResult>,
fv: FitnessValue
) {
if (!config.isEnabledFaultCategory(DefinedFaultCategory.XSS)) {
if(!config.xss || !config.isEnabledFaultCategory(DefinedFaultCategory.XSS)){
return
}

Expand Down
1 change: 1 addition & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,4 @@ There are 3 types of options:
|`vulnerableInputClassificationStrategy`| __Enum__. Strategy to classify inputs for potential vulnerability classes related to an REST endpoint. *Valid values*: `MANUAL, LLM`. *Default value*: `MANUAL`.|
|`wbProbabilityUseDataPool`| __Double__. Specify the probability of using the data pool when sampling test cases. This is for white-box (wb) mode. *Constraints*: `probability 0.0-1.0`. *Default value*: `0.2`.|
|`writeSnapshotTestsIntervalInSeconds`| __Int__. The size (in seconds) of the interval that the snapshots will be printed, if enabled. *Default value*: `3600`.|
|`xss`| __Boolean__. To apply XSS detection as part of security testing. *Default value*: `false`.|