com.danielsomerfield.cvecheck.owaspdependencycheck.OWASPScanningEngine.groovy Maven / Gradle / Ivy
package com.danielsomerfield.cvecheck.owaspdependencycheck
import org.gradle.api.Project
import org.owasp.dependencycheck.Engine
import org.owasp.dependencycheck.dependency.Vulnerability
import static com.danielsomerfield.cvecheck.FileVulnerabilities.getVulnerabilitiesForFiles
import static com.danielsomerfield.cvecheck.gradle.GradleProjects.getFilesForProject
class OWASPScanningEngine implements ScanningEngine {
private final Engine engine
public OWASPScanningEngine(Engine engine) {
this.engine = engine
}
def OWASPScanResult createScanResult(final Project project) {
new OWASPScanResult(transform(project))
}
def List extends com.danielsomerfield.cvecheck.Vulnerability> transform(Project project) {
getVulnerabilitiesForFiles(engine, getFilesForProject(project)).collect {Vulnerability v -> new OWASPVulnerability(v.cvssScore)}
}
@Override
void updateSource() {
engine.doUpdates()
}
}