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

Audit: add JSON Schema for topics and enable it for yml files #57

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"lextudio.restructuredtext",
"trond-snekvik.simple-rst",
"editorconfig.editorconfig"
"editorconfig.editorconfig",
"redhat.vscode-yaml",
]
}
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"esbonio.sphinx.confDir": "${workspaceFolder}/cryptodoc/src"
}
"esbonio.sphinx.confDir": "${workspaceFolder}/cryptodoc/src",
"yaml.schemas": {
"audit_generator/topic-schema.json": [
"audit_report/*/changes/topics/*.yml",
],
},
}
2 changes: 1 addition & 1 deletion audit_generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ classification: relevant
patches:
# Support hash truncation in ECKCDSA (#2742) (@lieser)
- pr: 3393 # GitHub pull request number
classification: relevant # (or: 'unspecified', 'out_of_scope', 'info', 'critical')
classification: relevant # (or: 'unspecified', 'out of scope', 'info', 'critical')
comment: |
Ensures that hash truncation in ECKCDSA is performed as specified in ISO
14888-3:2016.
Expand Down
90 changes: 90 additions & 0 deletions audit_generator/topic-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/sehlen-bsi/botan-docs/audit/topics-schema.json",
"title": "Audit topic",
"description": "A single topic for the BSI audit document of Botan.",
"type": "object",
"additionalProperties": false,
"$defs": {
"classification": {
"type": "string",
"enum": [
"unspecified",
"out of scope",
"critical",
"relevant",
"info"
]
}
},
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"classification": {
"$ref": "#/$defs/classification"
},
"patches": {
"type": "array",
"items": {
"type": "object",
"oneOf": [
{
"additionalProperties": false,
"properties": {
"pr": {
"type": "number"
},
"merge_commit": {
"type": "string"
},
"classification": {
"$ref": "#/$defs/classification"
},
"auditer": {
"type": "string"
},
"comment": {
"type": "string"
}
},
"required": [
"pr",
"merge_commit"
]
},
{
"additionalProperties": false,
"properties": {
"commit": {
"type": "string"
},
"classification": {
"$ref": "#/$defs/classification"
},
"auditer": {
"type": "string"
},
"comment": {
"type": "string"
}
},
"required": [
"commit"
]
}
],
"required": [
"classification"
]
Comment on lines +80 to +82
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity: What's the advantage of requiring the classification here instead of inside the oneOf variant declarations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only advantage is not having to write it two times.

Best would be if we could define classification, auditer and comment here completly (not just the required). But that requires the unevaluatedProperties feature, which does not work for the extension redhat-developer/vscode-yaml#704.

}
}
},
"required": [
"title",
"patches"
]
}