@Transient @JsonView({ AllViews.TableRow.class, AllViews.UIVulnSearch.class, AllViews.RestVulnSearch.class }) public String getVulnId() { return getId().toString(); }
@Transient @JsonView({ AllViews.HistoryView.class}) public Integer getVulnerabilityId() { Vulnerability vulnerability = getVulnerability(); if (vulnerability != null) { return vulnerability.getId(); } return null; }
@Transient public String getUri() { return "/organizations/" + getTeamId() + "/applications/" + getAppId() + "/vulnerabilities/" + getId(); } /**
@Override public String toString() { return "[" + getId() + ", " + genericVulnerability + " " + surfaceLocation.getPath() + " " + surfaceLocation.getParameter() + "]"; }
public String toString() { return "{id=" + getId() + ", vuln=" + (vulnerability == null ? "null" : vulnerability.getId()) + ", scan=" + (scan == null ? "null" : scan.getId()); } }
private List<Event> retrieveUngrouped(List<String> eventActions, Vulnerability vulnerability) { Set<Integer> vulnIds = set(); vulnIds.add(vulnerability.getId()); Set<Integer> defectIds = null; if (vulnerability.getDefect() != null) { defectIds = set(); defectIds.add(vulnerability.getDefect().getId()); } return retrieveUngrouped(eventActions, null, null, null, null, null, vulnIds, defectIds); } private List<Event> retrieveUngrouped(List<String> eventActions, User user) {
@Override public void delete(VulnerabilityComment comment) { comment.setActive(false); comment.setModifiedDate(new Date()); if (comment.getVulnerability() != null) { comment.setDeletedVulnerabilityId(comment.getVulnerability().getId()); } comment.setVulnerability(null); saveOrUpdate(comment); }
@Override public WafRule retrieveByVulnerabilityAndWafAndDirective( Vulnerability vuln, Waf waf, WafRuleDirective directive) { return (WafRule) sessionFactory .getCurrentSession() .createQuery( "from WafRule wafRule where wafRule.vulnerability = :vulnId " + "and wafRule.waf = :wafId and wafRule.wafRuleDirective = :directiveId") .setInteger("vulnId", vuln.getId()) .setInteger("wafId", waf.getId()) .setInteger("directiveId", directive.getId()) .setMaxResults(1).uniqueResult(); }
@Transient @JsonView({ AllViews.RestViewTag.class, AllViews.VulnerabilityDetail.class }) public Map<String, Object> getCommentInfo(){ Map<String, Object> commentInfo = new HashMap<String, Object>(); commentInfo.put("commentId", getId()); commentInfo.put("comment", getComment()); if (getVulnerability() != null && getVulnerability().getApplication() != null && getVulnerability().getApplication().isActive()) { commentInfo.put("vulnerabilityId", getVulnerability().getId()); commentInfo.put("vulnerabilityName", getVulnerability().getGenericVulnerability().getName()); commentInfo.put("vulnerabilityDisplayId", getVulnerability().getGenericVulnerability().getDisplayId()); commentInfo.put("applicationId", getVulnerability().getApplication().getId()); commentInfo.put("applicationName", getVulnerability().getApplication().getName()); commentInfo.put("teamId", getVulnerability().getApplication().getOrganization().getId()); commentInfo.put("teamName", getVulnerability().getApplication().getOrganization().getName()); Map<String, Object> severityMap = new HashMap<String, Object>(); severityMap.put("name", getVulnerability().getGenericSeverity().getName()); severityMap.put("intValue", getVulnerability().getGenericSeverity().getIntValue()); severityMap.put("displayName", getVulnerability().getGenericSeverity().getDisplayName()); commentInfo.put("genericSeverity", severityMap); } commentInfo.put("tags", getTags()); commentInfo.put("username", getUsername()); commentInfo.put("time", getTime()); return commentInfo; } }
public DeletedReopenMap(ScanReopenVulnerabilityMap map) { if (map != null && map.getScan() != null && map.getVulnerability() != null) { setScanId(map.getScan().getId()); setVulnerabilityId(map.getVulnerability().getId()); setId(map.getId()); } }
public DeletedCloseMap(ScanCloseVulnerabilityMap map) { if (map != null && map.getScan() != null && map.getVulnerability() != null) { setScanId(map.getScan().getId()); setVulnerabilityId(map.getVulnerability().getId()); setId(map.getId()); } }
private String buildVulnerabilityLink(Vulnerability vulnerability, String linkText, Map<String, Object> urlMap) { if ((vulnerability == null) || (!vulnerability.isActive())) { return linkText; } Application application = getApplication(); if (application == null) { application = vulnerability.getApplication(); } if ((application == null) || (!application.isActive())) { return linkText; } Organization organization = application.getOrganization(); if ((organization == null) || (!organization.isActive())) { return linkText; } String urlString = "/organizations/" + organization.getId() + "/applications/" + application.getId() + "/vulnerabilities/" + vulnerability.getId(); return buildLink(urlString, linkText, urlMap); }
private String buildDefectLink(Vulnerability vulnerability, String linkText, Map<String, Object> urlMap) { if ((defect == null) || (!defect.isActive()) || (vulnerability == null) || (!vulnerability.isActive())) { return linkText; } Application application = getApplication(); if (application == null) { application = vulnerability.getApplication(); } if ((application == null) || (!application.isActive())) { return linkText; } Organization organization = application.getOrganization(); if ((organization == null) || (!organization.isActive())) { return linkText; } String urlString = "/organizations/" + vulnerability.getApplication().getOrganization().getId() + "/applications/" + vulnerability.getApplication().getId() + "/vulnerabilities/" + vulnerability.getId() + "/defect"; return buildLink(urlString, linkText, urlMap); }
public DeletedWafRule(WafRule wafRule) { if (wafRule != null) { setId(wafRule.getId()); setRule(wafRule.getRule()); setPath(wafRule.getPath()); setParameter(wafRule.getParameter()); setVulnerabilityDesc(wafRule.getVulnerabilityDesc()); setNativeId(wafRule.getNativeId()); if (wafRule.getWaf() != null){ setWafId(wafRule.getWaf().getId()); } if (wafRule.getVulnerability() != null) { setVulnerabilityId(wafRule.getVulnerability().getId()); } } }
public static StatisticsCounter getStatisticsCounter(Finding finding) { if (finding != null && finding.getVulnerability() != null && finding.getChannelSeverity() != null && finding.getChannelVulnerability() != null && finding.getScan() != null && finding.getVulnerability().getGenericSeverity() != null && finding.getVulnerability().getGenericVulnerability() != null) { StatisticsCounter counter = new StatisticsCounter(); counter.vulnerabilityId = finding.getVulnerability().getId(); counter.scanId = finding.getScan().getId(); counter.channelSeverityId = finding.getChannelSeverity().getId(); counter.channelVulnerabilityId = finding.getChannelVulnerability().getId(); counter.currentGenericSeverityId = finding.getVulnerability().getGenericSeverity().getId(); counter.genericVulnerabilityId = finding.getVulnerability().getGenericVulnerability().getId(); counter.originalGenericSeverityId = counter.currentGenericSeverityId; counter.finding = finding; return counter; } else { return null; } }
setExpired(vulnerability.isExpired()); setFoundByScanner(vulnerability.isFoundByScanner()); setId(vulnerability.getId());