com.natpryce.snodge.reflect.TroublesomeClassesJvm.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snodge Show documentation
Show all versions of snodge Show documentation
A small, extensible Java library to randomly mutate JSON documents. Useful for fuzz testing.
The newest version!
package com.natpryce.snodge.reflect
import kotlin.reflect.jvm.jvmName
class CodeExecutionVulnerability(message: String) : Error(message)
class ClassCannotBeLoaded {
companion object {
init {
throw CodeExecutionVulnerability("tried to load an arbitrary class")
}
}
}
class ClassCannotBeInstantiated {
init {
throw CodeExecutionVulnerability("tried to instantiate an arbitrary class")
}
}
private class PrivateClass {
}
fun troublesomeClasses() =
listOf(ClassCannotBeLoaded::class, ClassCannotBeInstantiated::class, PrivateClass::class)
.map { it.jvmName }