Skip to content

0.2.0-beta

Latest
Compare
Choose a tag to compare
@hangga hangga released this 05 Jan 12:15
· 4 commits to main since this release
68b9ceb

What's new in 0.2.0-beta

New feature :

addCustomDetector() With this you can create your own custom detector.

Example

class ExampleCustomDetector : BaseDetector() {

    init {
        this.vulnerabilities = Vulnerabilities.UNSAFE_REFLECTION
    }

    override fun detect(line: String, lineNumber: Int) {
        // Implementation of line-based detection
        if (line.contains("examplePattern")) {
            val specificLocation = specificLocation(lineNumber)
            setValidVulnerability(
                specificLocation,
                "Example finding",
                "Detected example pattern in the code"
            )
        }
    }

    override fun detect(content: String) {
        // Implementation of full content-based detection
        if (content.contains("examplePattern")) {
            val specificLocation = specificLocation(-1) // -1 to denote whole content
            setValidVulnerability(
                specificLocation,
                "Example finding",
                "Detected example pattern in the full content"
            )
        }
    }
}

Using Custom Detector in Tests

@Test
fun `test using your own custom detector`() {
    Delvelin().setOutputFormat(OutputFileFormat.HTML)
        .addCustomDetector(ExampleCustomDetector())
        .scan()
}