forked from saveourtool/osv4k
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- renamed time_line to timeline - added serializers for timeline dates
- Loading branch information
Showing
4 changed files
with
194 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,50 @@ import kotlin.test.Test | |
class CosvTest { | ||
@Test | ||
fun cosvWithSeverity() { | ||
doEncodeDecodeAndCompare(cosvExample) | ||
} | ||
|
||
companion object { | ||
// language=JSON | ||
doEncodeDecodeAndCompare( | ||
""" | ||
val cosvExample = """ | ||
{ | ||
"schema_version": "1.0.0", | ||
"id": "DSA-3029-1", | ||
"modified": "2014-09-20T08:18:07Z", | ||
"published": "2014-09-20T00:00:01Z", | ||
"withdrawn": "2015-09-20T00:00:02Z", | ||
"aliases": [ | ||
"CVE-2014-3616" | ||
], | ||
"related": [ | ||
"TEST-2023-1" | ||
], | ||
"cwe_ids": [ | ||
"CWE-1", | ||
"CWE-2" | ||
], | ||
"cwe_names": [ | ||
"Stub 1", | ||
"Stub 2" | ||
], | ||
"timeline": [ | ||
{ | ||
"type": "introduced", | ||
"value": "2014-09-20T11:11:11Z" | ||
}, | ||
{ | ||
"type": "found", | ||
"value": "2014-09-20T12:22:22Z" | ||
}, | ||
{ | ||
"type": "fixed", | ||
"value": "2014-09-20T13:33:33Z" | ||
}, | ||
{ | ||
"type": "disclosed", | ||
"value": "2014-09-20T14:44:44Z" | ||
} | ||
], | ||
"summary": "nginx - security update", | ||
"details": "\nAntoine Delignat-Lavaud and Karthikeyan Bhargavan discovered that it was\npossible to reuse cached SSL sessions in unrelated contexts, allowing\nvirtual host confusion attacks in some configurations by an attacker in\na privileged network position.\n\n\nFor the stable distribution (wheezy), this problem has been fixed in\nversion 1.2.1-2.2+wheezy3.\n\n\nFor the testing distribution (jessie), this problem has been fixed in\nversion 1.6.2-1.\n\n\nFor the unstable distribution (sid), this problem has been fixed in\nversion 1.6.2-1.\n\n\nWe recommend that you upgrade your nginx packages.\n\n\n", | ||
"severity": [ | ||
|
@@ -36,6 +70,7 @@ class CosvTest { | |
"ranges": [ | ||
{ | ||
"type": "ECOSYSTEM", | ||
"repo": "https://github.com/company/repo", | ||
"events": [ | ||
{ | ||
"introduced": "0" | ||
|
@@ -45,6 +80,25 @@ class CosvTest { | |
} | ||
] | ||
} | ||
], | ||
"versions": [ | ||
"1.1", | ||
"1.2" | ||
], | ||
"patches_detail": [ | ||
{ | ||
"patch_url": "https://github.com/company/repo/pull/1", | ||
"issue_url": "https://github.com/company/repo/issue/2", | ||
"main_language": "Java", | ||
"author": "user1", | ||
"committer": "user1", | ||
"branches": [ | ||
"bugfix/fix-1#1" | ||
], | ||
"tags": [ | ||
"1.2.1" | ||
] | ||
} | ||
] | ||
} | ||
], | ||
|
@@ -54,9 +108,42 @@ class CosvTest { | |
"url": "https://www.debian.org/security/2014/dsa-3029" | ||
} | ||
], | ||
"credits": [ | ||
{ | ||
"name": "user1", | ||
"contact": [ | ||
"https://x.com/user1", | ||
"https://saveourtool.com/profile/user1", | ||
"https://github.com/user1" | ||
], | ||
"type": "COORDINATOR" | ||
}, | ||
{ | ||
"name": "user2", | ||
"contact": [ | ||
"https://x.com/user2", | ||
"https://saveourtool.com/profile/user2", | ||
"https://github.com/user2" | ||
], | ||
"type": "REPORTER" | ||
} | ||
], | ||
"contributors": [ | ||
{ | ||
"org": "H company", | ||
"name": "user1", | ||
"email": "[email protected]", | ||
"contributions": "Just a good guy" | ||
}, | ||
{ | ||
"org": "G company", | ||
"name": "user2", | ||
"email": "[email protected]", | ||
"contributions": "A much better guy" | ||
} | ||
], | ||
"confirm_type": "manual_confirmed" | ||
} | ||
""".trimIndent() | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/jvmTest/java/com/saveourtool/osv4k/CosvTestUsingJackson.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@file:Suppress("LONG_LINE", "TOO_LONG_FUNCTION") | ||
|
||
package com.saveourtool.osv4k | ||
|
||
import kotlin.test.Test | ||
|
||
/** | ||
* Test for COSV using Jackson | ||
*/ | ||
class CosvTestUsingJackson { | ||
/** | ||
* A simple test | ||
*/ | ||
@Test | ||
fun simpleTest() { | ||
OsvSchemaJacksonJavaTestUtil.doEncodeDecodeAndCompare( | ||
CosvTest.cosvExample | ||
) | ||
} | ||
} |