-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #834 from tschmidtb51/date-time
Mandatory test to check `date-time` format
- Loading branch information
Showing
7 changed files
with
111 additions
and
4 deletions.
There are no files selected for viewing
5 changes: 3 additions & 2 deletions
5
csaf_2.1/prose/edit/src/design-considerations-02-date-time.md
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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
## Date and Time | ||
|
||
This standard uses the `date-time` format as defined in JSON Schema Draft 2020-12 Section 7.3.1. | ||
In accordance with RFC 3339 and ISO 8601, the following rules apply: | ||
In accordance with [cite]{#RFC3339} and [cite]{#ISO8601}, the following rules apply: | ||
|
||
* The letter `T` separating the date and time SHALL be upper case. | ||
* The separator between date and time MUST be the letter `T`. | ||
* The letter `Z` indicating the timezone UTC SHALL be upper case. | ||
* Fractions of seconds are allowed as specified in the standards mention above with the full stop (`.`) as separator. | ||
* Leap seconds are supported. However, they SHOULD be avoided if possible. | ||
* Empty timezones are prohibited. | ||
* Empty timezones MUST NOT be used. | ||
* The ABNF of RFC 3339, section 5.6 applies. | ||
|
||
------- |
26 changes: 26 additions & 0 deletions
26
csaf_2.1/prose/edit/src/tests-01-mndtr-37-date-and-time.md
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,26 @@ | ||
### Date and Time{#mandatory-tests--date-and-time} | ||
|
||
For each item of type `string` and format `date-time` it MUST be tested that it conforms to the rules given in section [sec]{#date-and-time}. | ||
|
||
The relevant path for this test is: | ||
|
||
``` | ||
/document/tracking/current_release_date | ||
/document/tracking/generator/date | ||
/document/tracking/initial_release_date | ||
/document/tracking/revision_history[]/date | ||
/vulnerabilities[]/discovery_date | ||
/vulnerabilities[]/flags[]/date | ||
/vulnerabilities[]/release_date | ||
/vulnerabilities[]/involvements[]/date | ||
/vulnerabilities[]/remediations[]/date | ||
/vulnerabilities[]/threats[]/date | ||
``` | ||
|
||
*Example 1 (which fails the test):* | ||
|
||
``` | ||
"current_release_date": "2024-01-24 10:00:00.000Z", | ||
``` | ||
|
||
> The `current_release_date` uses a whitespace as separator instead the letter `T`. |
32 changes: 32 additions & 0 deletions
32
csaf_2.1/test/validator/data/mandatory/oasis_csaf_tc-csaf_2_1-2024-6-1-37-01.json
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,32 @@ | ||
{ | ||
"$schema": "https://docs.oasis-open.org/csaf/csaf/v2.1/csaf_json_schema.json", | ||
"document": { | ||
"category": "csaf_base", | ||
"csaf_version": "2.1", | ||
"distribution": { | ||
"tlp": { | ||
"label": "CLEAR" | ||
} | ||
}, | ||
"publisher": { | ||
"category": "other", | ||
"name": "OASIS CSAF TC", | ||
"namespace": "https://csaf.io" | ||
}, | ||
"title": "Mandatory test: Date and Time (failing example 1)", | ||
"tracking": { | ||
"current_release_date": "2024-01-24 10:00:00.000Z", | ||
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-1-37-01", | ||
"initial_release_date": "2024-01-24 10:00:00.000Z", | ||
"revision_history": [ | ||
{ | ||
"date": "2024-01-24 10:00:00.000Z", | ||
"number": "1", | ||
"summary": "Initial version." | ||
} | ||
], | ||
"status": "final", | ||
"version": "1" | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
csaf_2.1/test/validator/data/mandatory/oasis_csaf_tc-csaf_2_1-2024-6-1-37-11.json
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,32 @@ | ||
{ | ||
"$schema": "https://docs.oasis-open.org/csaf/csaf/v2.1/csaf_json_schema.json", | ||
"document": { | ||
"category": "csaf_base", | ||
"csaf_version": "2.1", | ||
"distribution": { | ||
"tlp": { | ||
"label": "CLEAR" | ||
} | ||
}, | ||
"publisher": { | ||
"category": "other", | ||
"name": "OASIS CSAF TC", | ||
"namespace": "https://csaf.io" | ||
}, | ||
"title": "Mandatory test: Date and Time (valid example 1)", | ||
"tracking": { | ||
"current_release_date": "2024-01-24T10:00:00.000Z", | ||
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-1-37-11", | ||
"initial_release_date": "2024-01-24T10:00:00.000Z", | ||
"revision_history": [ | ||
{ | ||
"date": "2024-01-24T10:00:00.000Z", | ||
"number": "1", | ||
"summary": "Initial version." | ||
} | ||
], | ||
"status": "final", | ||
"version": "1" | ||
} | ||
} | ||
} |
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
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