Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioning enhancements job streaming merge #202

Merged
merged 41 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
799f1a4
changesets to create vulnerabilityversion, cpeset, and vdoset tables.…
memeeerit Sep 28, 2023
0dfcc4d
reconciler uses new schema for vuln/vulnversion table, vdo/cvss db ca…
memeeerit Oct 4, 2023
b4c1941
vdo/cvss db calls updated to new schema
memeeerit Oct 4, 2023
0a09634
update vuln version vdo set fk
memeeerit Oct 4, 2023
ccddd1d
PNE uses new arch and input message format
memeeerit Oct 11, 2023
8d1b621
reconciler uses new PNE message format
memeeerit Oct 11, 2023
a3a5958
pne->pf comms updated with annotators
memeeerit Oct 17, 2023
9ed812d
patchfinder comms and db updated
memeeerit Oct 19, 2023
3606179
pne test fixes
memeeerit Oct 19, 2023
e9d0ed0
pf test fix
memeeerit Oct 19, 2023
e22e5f2
removed inputjob reference from pf db
memeeerit Oct 19, 2023
ba1959b
sql fixes
memeeerit Nov 6, 2023
68d3ecd
start on rawvulnerability merge
memeeerit Nov 10, 2023
c280000
vuln db methods
memeeerit Nov 10, 2023
b45e5b9
moved comp method from raw repo to vuln repo
memeeerit Nov 17, 2023
11677d9
repo for nvd/mitre data and timegaps
memeeerit Nov 17, 2023
e368604
characterizer models and db
memeeerit Nov 17, 2023
d1a8912
repo test fixes
memeeerit Nov 17, 2023
95999c7
changed references to db models
memeeerit Nov 20, 2023
7010d11
removed old models and old db. also deleted the sandbox
memeeerit Nov 20, 2023
4077370
migrated PNE models and db
memeeerit Nov 20, 2023
fa74dd9
migrated PF models and db
memeeerit Nov 20, 2023
8118a6c
moved cpegroup and cpeentry references to use db module in PNE
memeeerit Nov 21, 2023
b8a9a57
removed PNE-only models from db module
memeeerit Nov 21, 2023
f5f279d
updated vuln repo tests
memeeerit Nov 21, 2023
7f379c0
updated characterization repo tests
memeeerit Nov 21, 2023
6076639
updated cvejobtrack repo tests
memeeerit Nov 21, 2023
3e4d063
updated nvdmitre repo tests
memeeerit Nov 21, 2023
1837fb9
updated patchfix repo tests
memeeerit Nov 21, 2023
ec4cffe
updated product repo tests. in the original PNE tests most had the @T…
memeeerit Nov 21, 2023
25110af
updated rawdescription repo tests.
memeeerit Nov 21, 2023
ccdb7a6
updated runhistory repo tests.
memeeerit Nov 21, 2023
fc5d607
misc sql fixes and nullpointer avoidance
memeeerit Nov 21, 2023
8d5bdb3
Merge remote-tracking branch 'origin/main' into versioning-enhancements
memeeerit Nov 27, 2023
d003381
merge fixes
memeeerit Nov 27, 2023
704e7bd
db test fix
memeeerit Nov 28, 2023
7d7c92f
crawler test fixes
memeeerit Nov 28, 2023
3f44809
removed other timestamp.tostring()
memeeerit Nov 28, 2023
565f75c
pypa yaml date reversion
memeeerit Nov 28, 2023
aa14f5e
don't assert log contents for messenger main test
memeeerit Nov 28, 2023
2f13a83
remove vestigial message classes
memeeerit Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crawler/src/main/java/edu/rit/se/nvip/CrawlerMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void run(){
log.info("CVE: {}:\n", cveId);
for (RawVulnerability vuln: crawledCVEs.get(cveId)) {
String description = vuln.getDescription().length() > 100 ? vuln.getDescription().substring(0, 100) + "...": vuln.getDescription();
log.info("[{} | {}]\n", vuln.getSourceURL(), description);
log.info("[{} | {}]\n", vuln.getSourceUrl(), description);
}
}
} else {
Expand Down Expand Up @@ -474,8 +474,8 @@ private int cvesToCsv(HashMap<String, ArrayList<RawVulnerability>> crawledCVEs){
for (ArrayList<RawVulnerability> vulnList : crawledCVEs.values()) {
for (RawVulnerability vuln : vulnList) {
String desc = vuln.getDescription().replace("\r\n", ". ").replace("\n", ". ").replace("\r", ". ").replace("\t", " ");
String[] data = {vuln.getCveId(), desc, vuln.getCreateDate(), vuln.getPublishDate(),
vuln.getLastModifiedDate(), vuln.getSourceURL(), vuln.getSourceType()};
String[] data = {vuln.getCveId(), desc, vuln.getCreateDateString(), vuln.getPublishDateString(),
vuln.getLastModifiedDateString(), vuln.getSourceUrl(), vuln.getSourceType().type};
writer.writeNext(data, false);
lineCount++;
}
Expand Down Expand Up @@ -530,19 +530,19 @@ private void updateSourceTypes(HashMap<String, ArrayList<RawVulnerability>> craw
// For each raw CVE,
for (String cveId: crawledCves.keySet()) {
for (RawVulnerability vuln: crawledCves.get(cveId)) {
if(vuln.getSourceURL() == null || vuln.getSourceURL().equals("")){
if(vuln.getSourceUrl() == null || vuln.getSourceUrl().equals("")){
vuln.setSourceType("other");
continue;
}

// Set source type if the URL is listed in the types file
// Otherwise, just set the source type to 'other'
try{
URL sourceURL = new URL(vuln.getSourceURL());
URL sourceURL = new URL(vuln.getSourceUrl());
vuln.setSourceType(sourceTypes.get(sourceURL.getHost()));
}
catch(MalformedURLException e){
log.warn("Bad sourceURL {}: {}", vuln.getSourceURL(), e.toString());
log.warn("Bad sourceURL {}: {}", vuln.getSourceUrl(), e.toString());
}

if(vuln.getSourceType() == null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
import edu.rit.se.nvip.db.model.RawVulnerability;

import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.File;
import java.io.FileWriter;
Expand Down Expand Up @@ -147,7 +145,7 @@ public void visit(Page page) {
} else {
for (RawVulnerability vulnerability : vulnerabilityList) {
if (vulnerability.getCveId().isEmpty()) {
log.info("A cve found by the {} parser at the URL {} has an empty cve_id and will not be inserted", vulnerability.getParserType(), vulnerability.getSourceURL());
log.info("A cve found by the {} parser at the URL {} has an empty cve_id and will not be inserted", vulnerability.getParserType(), vulnerability.getSourceUrl());
continue;
}
if (foundCVEs.get(vulnerability.getCveId()) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void testPyPA() {

assertEquals(vuln.getCveId(), "CVE-2017-16763");
assertTrue(vuln.getDescription().contains("An exploitable vulnerability exists in the YAML parsing functionality in config.py in Confire 0.2.0"));
assertEquals(vuln.getPublishDate(), "2017-11-10 09:29:00");
assertEquals(vuln.getLastModifiedDate(), "2021-08-25 04:29:57");
assertEquals("2017-11-10 09:29:00", vuln.getPublishDateString());
assertEquals("2021-08-25 04:29:57", vuln.getLastModifiedDateString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void testABBDownloadAndParse() {
RawVulnerability vuln = list.get(0);
assertEquals("CVE-2023-0580", vuln.getCveId());
assertTrue(vuln.getDescription().contains("An attacker who successfully exploited this vulnerability could gain access to the protected application"));
assertEquals("2023-03-27 00:00:00", vuln.getPublishDate());
assertEquals("2023-03-27 00:00:00", vuln.getLastModifiedDate());
assertEquals("2023-03-27 00:00:00", vuln.getPublishDateString());
assertEquals("2023-03-27 00:00:00", vuln.getLastModifiedDateString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void testAcronisSingle() {
RawVulnerability vuln = list.get(0);
assertEquals("CVE-2022-3405", vuln.getCveId());
assertTrue(vuln.getDescription().contains("Code execution and sensitive information disclosure due"));
assertEquals("2022-11-17 00:00:00", vuln.getPublishDate());
assertEquals("2023-03-09 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-11-17 00:00:00", vuln.getPublishDateString());
assertEquals("2023-03-09 00:00:00", vuln.getLastModifiedDateString());
}

// Multiple CVE, nothing above title, located in description
Expand All @@ -63,8 +63,8 @@ public void testAcronisMultiple() {
RawVulnerability vuln = getVulnerability(list, "CVE-2022-3602");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("OpenSSL project team released a security advisory"));
assertEquals("2022-11-01 00:00:00", vuln.getPublishDate());
assertEquals("2022-11-01 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-11-01 00:00:00", vuln.getPublishDateString());
assertEquals("2022-11-01 00:00:00", vuln.getLastModifiedDateString());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void testAdobe() {
RawVulnerability vuln = getVulnerability(list, "CVE-2023-22247");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("Adobe has released a security update for Adobe Commerce and Magento Open Source."));
assertEquals("2023-03-14 00:00:00", vuln.getPublishDate());
assertEquals("2023-03-14 00:00:00", vuln.getLastModifiedDate());
assertEquals("2023-03-14 00:00:00", vuln.getPublishDateString());
assertEquals("2023-03-14 00:00:00", vuln.getLastModifiedDateString());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void testAliasObj() {
RawVulnerability vuln = getVulnerability(list, "CVE-2023-24012");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("Attacker can arbitrarily craft malicious DDS Participants"));
assertEquals("2023-02-25 04:55:00", vuln.getPublishDate());
assertEquals("2023-02-25 04:55:00", vuln.getLastModifiedDate());
assertEquals("2023-02-25 04:55:00", vuln.getPublishDateString());
assertEquals("2023-02-25 04:55:00", vuln.getLastModifiedDateString());

}

Expand All @@ -65,8 +65,8 @@ public void testAlias() {
RawVulnerability vuln = getVulnerability(list, "CVE-2020-10292");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("Visual Components (owned by KUKA) is a robotic simulator that allows"));
assertEquals("2020-11-06 04:26:00", vuln.getPublishDate());
assertEquals("2020-11-06 04:26:00", vuln.getLastModifiedDate());
assertEquals("2020-11-06 04:26:00", vuln.getPublishDateString());
assertEquals("2020-11-06 04:26:00", vuln.getLastModifiedDateString());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void testAmpere() {
assertEquals(6, list.size());
RawVulnerability vuln = getVulnerability(list, "CVE-2022-46892");
assertTrue(vuln.getDescription().contains("A Root complex is typically disabled during boot via the BIOS"));
assertEquals("2023-02-14 00:00:00", vuln.getPublishDate());
assertEquals("2023-02-14 00:00:00", vuln.getLastModifiedDate());
assertEquals("2023-02-14 00:00:00", vuln.getPublishDateString());
assertEquals("2023-02-14 00:00:00", vuln.getLastModifiedDateString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public void testAndroidBulletin() {
assertEquals("CVE-2023-20933", vuln.getCveId());
assertTrue(vuln.getDescription().contains("local escalation of privilege with no additional execution privileges needed"));
assertFalse(vuln.getDescription().contains("lead to remote code execution with no additional"));
assertEquals("2023-02-06 00:00:00", vuln.getPublishDate());
assertEquals("2023-02-08 00:00:00", vuln.getLastModifiedDate());
assertEquals("2023-02-06 00:00:00", vuln.getPublishDateString());
assertEquals("2023-02-08 00:00:00", vuln.getLastModifiedDateString());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void testAnquankeParser() {
RawVulnerability vuln = getVulnerability(list, "CVE-2020-5764");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("安卓MX Player播放器路径穿越和代码执行漏洞"));
assertEquals("2020-07-10 16:30:16", vuln.getPublishDate());
assertEquals("2020-07-10 16:30:16", vuln.getLastModifiedDate());
assertEquals("2020-07-10 16:30:16", vuln.getPublishDateString());
assertEquals("2020-07-10 16:30:16", vuln.getLastModifiedDateString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public void testAristaSingle() {
RawVulnerability vuln = getVulnerability(list, "CVE-2023-24546");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("This advisory impacts the Arista CloudVision Portal products when run on-premise"));
assertEquals("2023-03-07 00:00:00", vuln.getPublishDate());
assertEquals("2023-03-07 00:00:00", vuln.getLastModifiedDate());
assertEquals("2023-03-07 00:00:00", vuln.getPublishDateString());
assertEquals("2023-03-07 00:00:00", vuln.getLastModifiedDateString());
}


Expand All @@ -40,7 +40,7 @@ public void testAristaMultiple() {
RawVulnerability vuln = getVulnerability(list, "CVE-2021-28509");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("This advisory documents the impact of an internally found vulnerability in Arista EOS state streaming telemetry agent TerminAttr and OpenConfig transport protocols."));
assertEquals("2022-05-25 00:00:00", vuln.getPublishDate());
assertEquals("2022-05-27 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-05-25 00:00:00", vuln.getPublishDateString());
assertEquals("2022-05-27 00:00:00", vuln.getLastModifiedDateString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void testArubaSingle() {
RawVulnerability vuln = getVulnerability(list, "CVE-2022-23678");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("A vulnerability exists in the Aruba VIA client for Microsoft"));
assertEquals("2022-07-26 00:00:00", vuln.getPublishDate());
assertEquals("2022-08-19 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-07-26 00:00:00", vuln.getPublishDateString());
assertEquals("2022-08-19 00:00:00", vuln.getLastModifiedDateString());
}


Expand All @@ -63,8 +63,8 @@ public void testArubaMultiple() {
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("further privileges on the ClearPass instance"));
assertFalse(vuln.getDescription().contains("execute arbitrary script code in a victim's"));
assertEquals("2023-03-14 00:00:00", vuln.getPublishDate());
assertEquals("2023-03-14 00:00:00", vuln.getLastModifiedDate());
assertEquals("2023-03-14 00:00:00", vuln.getPublishDateString());
assertEquals("2023-03-14 00:00:00", vuln.getLastModifiedDateString());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void testAsustorParserSingle() {
RawVulnerability vuln = getVulnerability(list, "CVE-2022-0847");
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("A flaw was found in the way the \"flags\" member of the new pipe buffer structure was lacking prope"));
assertEquals("2022-03-11 00:00:00", vuln.getPublishDate());
assertEquals("2022-07-07 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-03-11 00:00:00", vuln.getPublishDateString());
assertEquals("2022-07-07 00:00:00", vuln.getLastModifiedDateString());
}

@Test
Expand All @@ -49,8 +49,8 @@ public void testAsustorParserMultiple() {
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("The vulnerability affects all RSA padding modes: PKCS#1 v1.5, RSA-OEAP and RSASVE."));
assertFalse(vuln.getDescription().contains("This could be exploited by an attacker who has the ability to supply malicious PEM files for parsing to achieve a denial of service attack."));
assertEquals("2023-03-31 00:00:00", vuln.getPublishDate());
assertEquals("2023-03-31 00:00:00", vuln.getLastModifiedDate());
assertEquals("2023-03-31 00:00:00", vuln.getPublishDateString());
assertEquals("2023-03-31 00:00:00", vuln.getLastModifiedDateString());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void testAtlassianSingleNoDesc() {
assertEquals("CVE-2022-36804", vuln.getCveId());
assertTrue(vuln.getDescription().contains("command injection vulnerability in multiple API endpoints"));
assertFalse(vuln.getDescription().contains("evaluate its applicability to your own IT environment"));
assertEquals("2022-08-24 10:00:00", vuln.getPublishDate());
assertEquals("2022-08-24 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-08-24 10:00:00", vuln.getPublishDateString());
assertEquals("2022-08-24 00:00:00", vuln.getLastModifiedDateString());

}

Expand All @@ -69,8 +69,8 @@ public void testAtlassianMultipleNoDesc() {
assertFalse(vuln1.getDescription().contains(desc2));
assertTrue(vuln2.getDescription().contains(desc2));
assertFalse(vuln2.getDescription().contains(desc1));
assertEquals("2023-02-15 10:00:00", vuln1.getPublishDate());
assertEquals("2023-02-17 00:00:00", vuln2.getLastModifiedDate());
assertEquals("2023-02-15 10:00:00", vuln1.getPublishDateString());
assertEquals("2023-02-17 00:00:00", vuln2.getLastModifiedDateString());
}

@Test
Expand All @@ -84,8 +84,8 @@ public void testAtlassianSingleWithDesc() {
RawVulnerability vuln = list.get(0);
assertEquals("CVE-2019-15006", vuln.getCveId());
assertTrue(vuln.getDescription().contains("An attacker could perform the described attack by denying their victim access"));
assertEquals("2019-12-18 10:00:00", vuln.getPublishDate());
assertEquals("2020-01-08 00:00:00", vuln.getLastModifiedDate());
assertEquals("2019-12-18 10:00:00", vuln.getPublishDateString());
assertEquals("2020-01-08 00:00:00", vuln.getLastModifiedDateString());
}

@Test
Expand Down Expand Up @@ -115,7 +115,7 @@ public void testAtlassianMultipleWithDesc() {
assertTrue(vuln3.getDescription().contains(desc3));
assertFalse(vuln3.getDescription().contains(desc1));
assertFalse(vuln3.getDescription().contains(desc2));
assertEquals("2020-01-15 10:00:00", vuln1.getPublishDate());
assertEquals("2020-01-28 00:00:00", vuln2.getLastModifiedDate());
assertEquals("2020-01-15 10:00:00", vuln1.getPublishDateString());
assertEquals("2020-01-28 00:00:00", vuln2.getLastModifiedDateString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void testAutodesk() {
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("Expat"));
assertTrue(vuln.getDescription().contains("Autodesk products leveraging internal components"));
assertEquals("2022-07-28 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-10-12 00:00:00", vuln.getPublishDate());
assertEquals("2022-07-28 00:00:00", vuln.getLastModifiedDateString());
assertEquals("2022-10-12 00:00:00", vuln.getPublishDateString());

vuln = getVulnerability(list, "CVE-2021-22947");
assertNotNull(vuln);
Expand All @@ -69,7 +69,7 @@ public void testAutodeskMulti() {
assertNotNull(vuln);
assertTrue(vuln.getDescription().contains("A maliciously crafted PCT"));
assertFalse(vuln.getDescription().contains("Applications and services that utilize"));
assertEquals("2022-12-14 00:00:00", vuln.getPublishDate());
assertEquals("2022-12-14 00:00:00", vuln.getLastModifiedDate());
assertEquals("2022-12-14 00:00:00", vuln.getPublishDateString());
assertEquals("2022-12-14 00:00:00", vuln.getLastModifiedDateString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public void testBoschSecurityParser() throws IOException {
vuln1.getDescription());
assertEquals("Race condition in the __find_get_block_slow function in the ISO9660 filesystem in Linux 2.6.18 and possibly other versions allows local users to cause a denial of service (infinite loop) by mounting a crafted ISO9660 filesystem containing malformed data structures.",
vuln2.getDescription());
assertEquals("2022-11-23 00:00:00", vuln1.getPublishDate());
assertEquals("2022-11-23 00:00:00", vuln1.getLastModifiedDate());
assertEquals("2022-11-23 00:00:00", vuln1.getPublishDateString());
assertEquals("2022-11-23 00:00:00", vuln1.getLastModifiedDateString());

}
}
Loading
Loading