Skip to content

Commit 38818e9

Browse files
authored
Merge branch 'master' into phg/enumGene
2 parents ea8a580 + 12da8a2 commit 38818e9

117 files changed

Lines changed: 2239 additions & 1772 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ Examples of Fortune 500 companies using _EvoMaster_ are:
198198

199199
![](docs/img/video-player-flaticon.png)
200200

201+
* A [45-minute talk given at TestCon'25](https://www.youtube.com/watch?v=uKKRo3LrNiw&list=PLqYhGsQ9iSEoXaRmW9WQjjXJK_1NbLlZ6&index=15) on Fuzz Testing Web APIs gives an overview of what can be expected from this kind of fuzzers.
202+
201203
* A [short video](https://youtu.be/3mYxjgnhLEo) (5 minutes)
202204
shows the use of _EvoMaster_ on one of the
203205
case studies in [EMB](https://github.com/WebFuzzing/EMB).

core/src/main/kotlin/org/evomaster/core/EMConfig.kt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ class EMConfig {
11621162

11631163
enum class Algorithm {
11641164
DEFAULT, SMARTS, MIO, RANDOM, WTS, MOSA, RW,
1165-
StandardGA, MonotonicGA, SteadyStateGA, BreederGA, CellularGA, OnePlusLambdaLambdaGA, MuLambdaEA, MuPlusLambdaEA // GA variants still work-in-progress.
1165+
StandardGA, MonotonicGA, SteadyStateGA, BreederGA, CellularGA, OnePlusLambdaLambdaGA, MuLambdaEA, MuPlusLambdaEA, LIPS, CRO // GA variants still work-in-progress.
11661166
}
11671167

11681168
@Cfg("The algorithm used to generate test cases. The default depends on whether black-box or white-box testing is done.")
@@ -1575,6 +1575,27 @@ class EMConfig {
15751575
@Min(1.0)
15761576
var tournamentSize = 10
15771577

1578+
// --- Chemical Reaction Optimization (CRO) parameters ---
1579+
@Cfg("CRO: Molecular collision rate c_r (probability of binary reactions)")
1580+
@Probability
1581+
var croMolecularCollisionRate: Double = 0.2
1582+
1583+
@Cfg("CRO: Kinetic energy loss rate k_r (lower bound of retained fraction after on-wall)")
1584+
@Probability
1585+
var croKineticEnergyLossRate: Double = 0.2
1586+
1587+
@Cfg("CRO: Initial kinetic energy assigned to each molecule")
1588+
@Min(0.0)
1589+
var croInitialKineticEnergy: Double = 1000.0
1590+
1591+
@Cfg("CRO: Decomposition threshold d_t (min number of collisions before decomposition)")
1592+
@Min(0.0)
1593+
var croDecompositionThreshold: Int = 500
1594+
1595+
@Cfg("CRO: Synthesis KE threshold s_t (molecule can synthesize if KE ≤ s_t)")
1596+
@Min(0.0)
1597+
var croSynthesisThreshold: Double = 10.0
1598+
15781599
@Cfg("When sampling new test cases to evaluate, probability of using some smart strategy instead of plain random")
15791600
@Probability
15801601
var probOfSmartSampling = 0.95

core/src/main/kotlin/org/evomaster/core/Main.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ class Main {
645645
EMConfig.Algorithm.StandardGA ->
646646
Key.get(object : TypeLiteral<StandardGeneticAlgorithm<GraphQLIndividual>>() {})
647647

648+
EMConfig.Algorithm.LIPS ->
649+
Key.get(object : TypeLiteral<org.evomaster.core.search.algorithms.LIPSAlgorithm<GraphQLIndividual>>() {})
648650
EMConfig.Algorithm.MuPlusLambdaEA ->
649651
Key.get(object : TypeLiteral<MuPlusLambdaEvolutionaryAlgorithm<GraphQLIndividual>>() {})
650652

@@ -684,6 +686,8 @@ class Main {
684686

685687
EMConfig.Algorithm.RW ->
686688
Key.get(object : TypeLiteral<RandomWalkAlgorithm<RPCIndividual>>() {})
689+
EMConfig.Algorithm.LIPS ->
690+
Key.get(object : TypeLiteral<org.evomaster.core.search.algorithms.LIPSAlgorithm<RPCIndividual>>() {})
687691

688692
EMConfig.Algorithm.MuPlusLambdaEA ->
689693
Key.get(object : TypeLiteral<MuPlusLambdaEvolutionaryAlgorithm<RPCIndividual>>() {})
@@ -722,6 +726,8 @@ class Main {
722726

723727
EMConfig.Algorithm.RW ->
724728
Key.get(object : TypeLiteral<RandomWalkAlgorithm<WebIndividual>>() {})
729+
EMConfig.Algorithm.LIPS ->
730+
Key.get(object : TypeLiteral<org.evomaster.core.search.algorithms.LIPSAlgorithm<WebIndividual>>() {})
725731

726732
EMConfig.Algorithm.MuPlusLambdaEA ->
727733
Key.get(object : TypeLiteral<MuPlusLambdaEvolutionaryAlgorithm<WebIndividual>>() {})
@@ -769,6 +775,8 @@ class Main {
769775

770776
EMConfig.Algorithm.RW ->
771777
Key.get(object : TypeLiteral<RandomWalkAlgorithm<RestIndividual>>() {})
778+
EMConfig.Algorithm.LIPS ->
779+
Key.get(object : TypeLiteral<org.evomaster.core.search.algorithms.LIPSAlgorithm<RestIndividual>>() {})
772780
EMConfig.Algorithm.MuPlusLambdaEA ->
773781
Key.get(object : TypeLiteral<MuPlusLambdaEvolutionaryAlgorithm<RestIndividual>>() {})
774782
EMConfig.Algorithm.MuLambdaEA ->
@@ -783,6 +791,9 @@ class Main {
783791
EMConfig.Algorithm.OnePlusLambdaLambdaGA ->
784792
Key.get(object : TypeLiteral<OnePlusLambdaLambdaGeneticAlgorithm<RestIndividual>>() {})
785793

794+
EMConfig.Algorithm.CRO ->
795+
Key.get(object : TypeLiteral<CroAlgorithm<RestIndividual>>() {})
796+
786797
else -> throw IllegalStateException("Unrecognized algorithm ${config.algorithm}")
787798
}
788799
}

core/src/main/kotlin/org/evomaster/core/problem/externalservice/httpws/service/HarvestActualHttpWsResponseHandler.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,11 @@ class HarvestActualHttpWsResponseHandler {
532532
try {
533533
val template = getACopyOfItsActualResponseIfExist(geneToMutate, probability)?.responseBody ?: return false
534534

535-
val v = ParamUtil.getValueGene(geneToMutate)
536-
val t = ParamUtil.getValueGene(template)
535+
val v = geneToMutate.getLeafGene()
536+
val t = template.getLeafGene()
537537
if (v::class.java == t::class.java) {
538538
v.copyValueFrom(t)
539+
v.forceNewTaints()
539540
return true
540541
} else if (v is StringGene) {
541542
// add template as part of specialization

core/src/main/kotlin/org/evomaster/core/problem/rest/data/RestCallAction.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ class RestCallAction(
191191
For example, they could be a ChoiceGene when dealing with "examples" or Regex when having patterns
192192
only defined on some endpoints
193193
*/
194-
parameters[i].primaryGene().copyValueFrom(k.primaryGene())
194+
val g = parameters[i].primaryGene()
195+
g.copyValueFrom(k.primaryGene())
196+
g.forceNewTaints()
195197
}
196198
}
197199
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ class RestIndividualBuilder {
102102
.forEach { it.revertToWeakReference() }
103103
other.resetLocalIdRecursively()
104104

105+
//avoid possible taint id conflicts
106+
other.seeAllActions().forEach { it.forceNewTaints() }
107+
105108
val duplicates = base.addInitializingActions(other.seeInitializingActions())
106109

107110
other.getFlattenMainEnterpriseActionGroup()!!.forEach { group ->

core/src/main/kotlin/org/evomaster/core/problem/util/BindingBuilder.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ object BindingBuilder {
109109
}
110110

111111
private fun bindValues(p: Pair<Gene,Gene>, doBuildBindingGene: Boolean){
112-
val ok = p.first.setFromDifferentGene(p.second)
112+
val ok = p.first.copyValueFrom(p.second)
113113
if (ok && doBuildBindingGene){
114114
p.first.addBindingGene(p.second)
115115
p.second.addBindingGene(p.first)
116116
}
117117

118-
val first = ParamUtil.getValueGene(p.first)
119-
val second = ParamUtil.getValueGene(p.second)
118+
val first = p.first.getLeafGene()
119+
val second = p.second.getLeafGene()
120120
if(ok && !doBuildBindingGene && first is StringGene && TaintInputName.isTaintInput(first.value)){
121121
//do not use same tainted value in non-bound genes
122122
if(second is StringGene){

core/src/main/kotlin/org/evomaster/core/problem/util/ParamUtil.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import org.evomaster.core.search.gene.numeric.LongGene
1616
import org.evomaster.core.search.gene.wrapper.CustomMutationRateGene
1717
import org.evomaster.core.search.gene.wrapper.OptionalGene
1818
import org.evomaster.core.search.gene.string.StringGene
19-
import org.evomaster.core.search.gene.utils.GeneUtils
2019

2120
/**
2221
* this class used to handle binding values among params
@@ -100,7 +99,7 @@ class ParamUtil {
10099
*/
101100
fun compareGenesWithValue(geneA: Gene, geneB: Gene): Boolean {
102101
val geneAWithGeneBType = geneB.copy()
103-
geneAWithGeneBType.setFromDifferentGene(geneA)
102+
geneAWithGeneBType.copyValueFrom(geneA)
104103
return when (geneB) {
105104
is StringGene -> geneB.value == (geneAWithGeneBType as StringGene).value
106105
is IntegerGene -> geneB.value == (geneAWithGeneBType as IntegerGene).value
@@ -275,7 +274,7 @@ class ParamUtil {
275274

276275
fun generateParamId(list: Array<String>): String = list.joinToString(separator)
277276

278-
@Deprecated(message = "Rather use GeneUtils.getWrappedValueGene(gene)",
277+
@Deprecated(message = "Rather use getLeafGene()",
279278
replaceWith = ReplaceWith("GeneUtils.getWrappedValueGene(gene)"))
280279
fun getValueGene(gene: Gene): Gene {
281280
return gene.getLeafGene()!!

core/src/main/kotlin/org/evomaster/core/search/Individual.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ abstract class Individual(
527527
y !=x && !y.hasAnyBindingRelationship(x)
528528
}
529529
}){
530-
errors.add("Taint id ${d.key} has duplicate genes that are not related}")
530+
errors.add("Taint id ${d.key} has duplicate genes that are not related")
531531
}
532532
}
533533
return errors

core/src/main/kotlin/org/evomaster/core/search/action/Action.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ abstract class Action(children: List<StructuralElement>) : ActionComponent(
7979

8080
fun forceNewTaints(){
8181
seeTopGenes().forEach { g ->
82-
g.flatView().forEach { r ->
83-
if(r is TaintableGene && !r.isDependentTaint()){
84-
r.forceNewTaintId()
85-
}
86-
}
82+
g.forceNewTaints()
8783
}
8884
}
8985

0 commit comments

Comments
 (0)