public final String toString(boolean _deep) { final StringBuilder builder = new StringBuilder(); if(_deep) { builder.append("Bug ").append(this.toString(false)).append(System.getProperty("line.separator")); for(ConstructChange cc: this.getConstructChanges()) { builder.append(" construct change ").append(cc); builder.append(", construct ID ").append(cc.getConstructId()).append(System.getProperty("line.separator")); } } else { builder.append("[").append(this.getId()).append(":").append(this.getBugId()).append("]"); } return builder.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AggregatedVuln other = (AggregatedVuln) obj; // if (aboveThreshold != other.aboveThreshold) // return false; if (archiveid == null) { if (other.archiveid != null) return false; } else if (!archiveid.equals(other.archiveid)) return false; if (bug == null) { if (other.bug != null) return false; } else if (!bug.equals(other.bug)) return false; return true; }
@Override public int compareTo(Object _o) { AggregatedVuln other = null; if(_o instanceof AggregatedVuln) other = (AggregatedVuln)_o; else throw new IllegalArgumentException(); final int filename_comparison = this.filename==null || other.filename==null ? 0 : this.filename.compareTo(other.filename); final int bugid_comparison = this.bug.compareTo(other.getBug()); if(filename_comparison!=0) return filename_comparison; else return bugid_comparison; } }
changes_set = changes.get(b.getBugId()); if(changes_set==null) { changes_set = new HashSet<ConstructId>(); changes.put(b.getBugId(), changes_set); for(ConstructChange cc: b.getConstructChanges()) { json_cid = cc.getConstructId(); if(json_cid.getLang().equals(ProgrammingLanguage.JAVA) && !cc.getConstructChangeType().equals(ConstructChangeType.ADD)) {
@JsonProperty(value = "countConstructChanges") public int countConstructChanges() { return (this.getConstructChanges()==null ? -1 : this.getConstructChanges().size()); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((bugId == null) ? 0 : bugId.hashCode()); result = prime * result + ((libraryId == null) ? 0 : libraryId.hashCode()); return result; }
@Override public final String toString() { return this.toString(false); }
public Long getBugId() { return bug.getId(); } public Bug getBug() { return bug; }
public void evalAffectedVersion() { Boolean pre_commit_pom=null, line_add = null, check_version=null, manual_libId=null, equal=null; AffectedVersionSource source=null; if(bug.getAffectedVersions()!=null) { for( AffectedLibrary a : bug.getAffectedVersions()) {
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (aboveThreshold ? 1231 : 1237); result = prime * result + ((archiveid == null) ? 0 : archiveid.hashCode()); result = prime * result + ((bug.getBugId() == null) ? 0 : bug.getBugId().hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((app == null) ? 0 : app.hashCode()); result = prime * result + ((bug == null) ? 0 : bug.hashCode()); result = prime * result + ((dep == null) ? 0 : dep.hashCode()); return result; }
public String toString() { return "[" + this.filename + ", " + this.bug.getBugId() + ", #analyses=" + this.analyses.size() + "]"; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AffectedLibrary other = (AffectedLibrary) obj; if (bugId == null) { if (other.bugId != null) return false; } else if (!bugId.equals(other.bugId)) return false; if (libraryId == null) { if (other.libraryId != null) return false; } else if (!libraryId.equals(other.libraryId)) return false; return true; }
@Override public int compareTo(Object _o) { VulnerableDependency other = null; if(_o instanceof VulnerableDependency) other = (VulnerableDependency)_o; else throw new IllegalArgumentException(); final int filename_comparison = this.getDep().getFilename().compareTo(other.getDep().getFilename()); final int bugid_comparison = this.getBug().getBugId().compareTo(other.getBug().getBugId()); if(filename_comparison!=0) return filename_comparison; else return bugid_comparison; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; VulnerableDependency other = (VulnerableDependency) obj; if (app == null) { if (other.app != null) return false; } else if (!app.equals(other.app)) return false; if (bug == null) { if (other.bug != null) return false; } else if (!bug.equals(other.bug)) return false; if (dep == null) { if (other.dep != null) return false; } else if (!dep.equals(other.dep)) return false; return true; } }
public String getResultAsString() { final StringBuilder builder = new StringBuilder(); // Explanatory text if(exceptionThreshold.equalsIgnoreCase(THRESHOLD_DEP_ON)) builder.append("The application depends on the following vulnerable archives: "); else if(exceptionThreshold.equalsIgnoreCase(THRESHOLD_POT_EXE)) builder.append("The application potentially executes vulnerable code of the following vulnerable archives (or reachability was not checked): "); else if(exceptionThreshold.equalsIgnoreCase(THRESHOLD_ACT_EXE)) builder.append("The application actually executes vulnerable code of the following vulnerable archives (or no tests were run): "); // Will it result in a build exception? int i = 0; for(AggregatedVuln v: this.vulnsAboveThreshold) { for(VulnerableDependency analysis: v.getAnalyses()) { if(analysis.isThrowsException()) { builder.append(System.getProperty("line.separator")).append(" ").append(++i).append(": "); builder.append("[filename=").append(v.filename); builder.append(", scope=").append(analysis.getDep().getScope()); builder.append(", transitive=").append(analysis.getDep().getTransitive()); builder.append(", wellknownSha1=").append(analysis.getDep().getLib().isWellknownDigest()); builder.append(", isAffectedVersionConfirmed=").append(analysis.isAffectedVersionConfirmed()); builder.append(", bug=").append(v.bug.getBugId()).append("]"); } } } return builder.toString(); }
analysis.setBlacklisted(this.isIgnoredForBuildException(analysis, v.getBug().getBugId())); if(analysis.isBlacklisted()) scope_out++; else scope_in++;
this.historicalVulns.add(v.getBug().getBugId()); this.relevantVulns.add(v.getBug().getBugId()); log.warn("Skipping [" + v.getBug().getBugId() + "] for dependency of " + prj + " on " + v.getDep().getLib().getLibraryId() + ", the latter is one of the aggregated modules"); else added_av.addAnalysis(v);