@Override
 @SuppressWarnings("unchecked")
 public List<Vulnerability> retrieveAllByGenericVulnerabilityAndApp(Vulnerability vulnerability) {
   return sessionFactory
       .getCurrentSession()
       .createQuery(
           "from Vulnerability vuln where vuln.application = :appId "
               + "and vuln.genericVulnerability = :gvId and vuln.expired = :false")
       .setInteger("gvId", vulnerability.getGenericVulnerability().getId())
       .setInteger("appId", vulnerability.getApplication().getId())
       .setBoolean("false", false)
       .list();
 }
예제 #2
0
  public static Vulnerabilities.Vulnerability convertTFVulnToSSVLVuln(Vulnerability tfVuln) {
    Vulnerabilities.Vulnerability ssvlVuln = factory.createVulnerabilitiesVulnerability();
    ssvlVuln.setDescription(tfVuln.getGenericVulnName());
    if (tfVuln.getDefect() != null) ssvlVuln.setIssueID(tfVuln.getDefect().getNativeId());
    ssvlVuln.setCWE(tfVuln.getGenericVulnerability().getDisplayId());
    ssvlVuln.setSeverity(Severities.fromValue(tfVuln.getSeverityName()));
    ssvlVuln.setApplication(tfVuln.getAppName());
    if (tfVuln.getFindings() != null) {
      for (Finding tfFinding : tfVuln.getFindings()) {
        ssvlVuln.getFinding().add(convertTFFindingToSSVLFinding(tfFinding));
      }
    }

    return ssvlVuln;
  }