Skip to content

Commit

Permalink
Sharing Groups
Browse files Browse the repository at this point in the history
- addresses parts of oasis-tcs#705
- add mandatory test to prevent usage of reserved names
- improve wording
- add invalid examples
- add valid examples
- adapt testcases list and schema
  • Loading branch information
tschmidtb51 committed Nov 18, 2024
1 parent 02ae5ba commit 71bbbd2
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ A CSAF document with `TLP:CLEAR` SHOULD NOT contain a sharing group value and SH
Sharing Group Name (`name`) of value type `string` with one or more characters contains a human-readable name for the sharing group.

The Sharing Group Name is optional and can be chosen freely by the entity establishing the sharing group.
For the Max UUID, the value of `name` SHALL exist and be `Public`.
For the Nil UUID, the value of `name` SHALL exist and be `No Sharing allowed`.
However, the following values are reserved for the conditions below:

- For the Max UUID, the value of `name` SHALL exist and be `Public`.
- For the Nil UUID, the value of `name` SHALL exist and be `No sharing allowed`.

##### Document Property - Distribution - Text

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### Invalid Sharing Group Name

It MUST be tested that the value of sharing group name does not equal the reserved values from section [#cite](document-property---distribution---sharing-group) if the precondition is not fulfilled.

The relevant path for this test is:

```
/document/distribution/sharing_group/name
```

*Example 1 (which fails the test):*

```
"distribution": {
"sharing_group": {
"id": "5868d6be-b28a-404e-a245-0b5093b31b8b",
"name": "Public"
},
// ...
},
```

> The sharing group name is `Public` but it does not use the Max UUID.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://docs.oasis-open.org/csaf/csaf/v2.1/csaf_json_schema.json",
"document": {
"category": "csaf_base",
"csaf_version": "2.1",
"distribution": {
"sharing_group": {
"id": "5868d6be-b28a-404e-a245-0b5093b31b8b",
"name": "Public"
},
"tlp": {
"label": "CLEAR"
}
},
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Mandatory test: Invalid Sharing Group Name (failing example 1)",
"tracking": {
"current_release_date": "2024-01-24T10:00:00.000Z",
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-1-40-01",
"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"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://docs.oasis-open.org/csaf/csaf/v2.1/csaf_json_schema.json",
"document": {
"category": "csaf_base",
"csaf_version": "2.1",
"distribution": {
"sharing_group": {
"id": "5868d6be-b28a-404e-a245-0b5093b31b8b",
"name": "No sharing allowed"
},
"tlp": {
"label": "RED"
}
},
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Mandatory test: Invalid Sharing Group Name (failing example 2)",
"tracking": {
"current_release_date": "2024-01-24T10:00:00.000Z",
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-1-40-02",
"initial_release_date": "2024-01-24T10:00:00.000Z",
"revision_history": [
{
"date": "2024-01-24T10:00:00.000Z",
"number": "1",
"summary": "Initial version."
}
],
"status": "draft",
"version": "1"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://docs.oasis-open.org/csaf/csaf/v2.1/csaf_json_schema.json",
"document": {
"category": "csaf_base",
"csaf_version": "2.1",
"distribution": {
"sharing_group": {
"id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
"name": "Public"
},
"tlp": {
"label": "CLEAR"
}
},
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Mandatory test: Invalid Sharing Group Name (valid example 1)",
"tracking": {
"current_release_date": "2024-01-24T10:00:00.000Z",
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-1-40-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"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://docs.oasis-open.org/csaf/csaf/v2.1/csaf_json_schema.json",
"document": {
"category": "csaf_base",
"csaf_version": "2.1",
"distribution": {
"sharing_group": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "No sharing allowed"
},
"tlp": {
"label": "RED"
}
},
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Mandatory test: Invalid Sharing Group Name (valid example 2)",
"tracking": {
"current_release_date": "2024-01-24T10:00:00.000Z",
"id": "OASIS_CSAF_TC-CSAF_2.1-2024-6-1-40-12",
"initial_release_date": "2024-01-24T10:00:00.000Z",
"revision_history": [
{
"date": "2024-01-24T10:00:00.000Z",
"number": "1",
"summary": "Initial version."
}
],
"status": "draft",
"version": "1"
}
}
}
24 changes: 24 additions & 0 deletions csaf_2.1/test/validator/data/testcases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,30 @@
}
]
},
{
"id": "6.1.40",
"group": "mandatory",
"failures": [
{
"name": "mandatory/oasis_csaf_tc-csaf_2_1-2024-6-1-40-01.json",
"valid": false
},
{
"name": "mandatory/oasis_csaf_tc-csaf_2_1-2024-6-1-40-02.json",
"valid": false
}
],
"valid": [
{
"name": "mandatory/oasis_csaf_tc-csaf_2_1-2024-6-1-40-11.json",
"valid": true
},
{
"name": "mandatory/oasis_csaf_tc-csaf_2_1-2024-6-1-40-12.json",
"valid": true
}
]
},
{
"id": "6.2.1",
"group": "optional",
Expand Down
2 changes: 1 addition & 1 deletion csaf_2.1/test/validator/testcases_json_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"title": "Number of the test",
"description": "Contains the section number of the test in the specification.",
"type": "string",
"pattern": "^6\\.(([1-3]\\.[1-9])|(1\\.10)|([12]\\.1[1-9])|(3\\.1[0-2])|([12]\\.2[0-6])|(2\\.27)|(1\\.2[8-9])|(1\\.27\\.([1-9]|10|11))|(1\\.3[0-69]))$"
"pattern": "^6\\.(([1-3]\\.[1-9])|(1\\.10)|([12]\\.1[1-9])|(3\\.1[0-2])|([12]\\.2[0-6])|(2\\.27)|(1\\.2[8-9])|(1\\.27\\.([1-9]|10|11))|(1\\.3[0-69])|(1\\.4[0]))$"
},
"valid": {
"title": "List of valid examples",
Expand Down

0 comments on commit 71bbbd2

Please sign in to comment.