Skip to content

Initial steps to enhance the presentation of the CSAF model#1221

Merged
sthagen merged 46 commits intoeditor-revision-2026-02-25from
valid-outlines-as-object-overviews
Mar 9, 2026
Merged

Initial steps to enhance the presentation of the CSAF model#1221
sthagen merged 46 commits intoeditor-revision-2026-02-25from
valid-outlines-as-object-overviews

Conversation

@sthagen
Copy link
Copy Markdown
Contributor

@sthagen sthagen commented Nov 15, 2025

Please cf. with proposal "Initial steps to enhance the presentation of the CSAF model" (#1220) for examples and the rationale behind this change-set.

Material Changes

None.

Editorial Changes

  • Definitions
  • Document
  • Product Tree
  • Vulnerabilities
  • All "models" as separate files (outlines/*.yaml)
  • Validator for outlines (information model against CSAF JSON schema, WIP)

Maintenance Changes

  • Adapt the validator to changes in sources and other processing tools

Signed-off-by: Stefan Hagen <stefan@hagen.link>
@sthagen sthagen requested a review from tschmidtb51 November 15, 2025 16:39
@sthagen sthagen self-assigned this Nov 15, 2025
@sthagen sthagen added enhancement editorial mostly nits and consistency email To be sent via email to the TC tc-discussion-needed labels Nov 15, 2025
@sthagen sthagen linked an issue Nov 15, 2025 that may be closed by this pull request
…of items (WIP)

Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
…and fxed a bug

Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
- added all remaining vulnerabilities outlines
- fixed the forgotten additional elements indicators between advisory instance
  and vulnerabilities element (as document is required and product is pulled in by vulnerabilities
  and the other way around
- removed a few redundant ellipsis indicators when a sequence instance item is
  followed by the next ellipsis indicating further elements a level above
- fixed the mixed occurrences of ampersand and the English 'and' favoring the
  latter over the fashjionable former

Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
@sthagen sthagen marked this pull request as ready for review November 16, 2025 17:20
Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
- there is some robustness to aid callers and editors already
- the matching of schema snippets and outlines is quite forgiving
- in case there are nultiple paths per outline the script gracefully
  ignores any mismatches in the first path
- the identifcation of relevant leaf types is a romantic affair
- the output is very verbatim as an exploratory phase is best assisted with
- dependency on python-jsonpath is gently reminded when executing without install
- crude use of CSAF_JSON_SCHEMA environment variable for locating the schema alike
- one could use it in pipelines with grep on ERROR and expecting to not find the pattern

Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
- added some sub-processing for main-type string in underyling JSON schema
- added test for plain enum type

Signed-off-by: Stefan Hagen <stefan@hagen.link>
Signed-off-by: Stefan Hagen <stefan@hagen.link>
- works for single file, files, and globs alike
- provides summary passing grade per return code of 0 (pass),
  1(fail), or 2(usage error)
- can now be used in actions more easily

Signed-off-by: Stefan Hagen <stefan@hagen.link>
@tschmidtb51
Copy link
Copy Markdown
Contributor

@sthagen We don't need the files in src/outline, correct? Then, would suggest to remove them / add the folder to be ignored...

Signed-off-by: Stefan Hagen <stefan@hagen.link>
@sthagen
Copy link
Copy Markdown
Contributor Author

sthagen commented Feb 25, 2026

@sthagen We don't need the files in src/outline, correct? Then, would suggest to remove them / add the folder to be ignored...

done. Thanks for spotting.

Copy link
Copy Markdown
Contributor

@tschmidtb51 tschmidtb51 left a comment

Choose a reason for hiding this comment

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

I like how easy it is to check that as we have all the JSON Path at hand!

I'm sorry about the delayed review.
Some minor comments - mostly editorial - no blocker for that to be merged.

PS: I did not review the rendered files as they are derived from the sources.

Comment on lines +141 to +149
if sub_type := mapping.get('format', ''):
if sub_type == 'date-time':
return 'string.datetime'
if sub_type == 'uri':
return 'string.uri'
if 'enum' in mapping:
return 'string.enum'
if 'pattern' in mapping:
return 'string.pattern'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In #1165, we also have string with const and string with uri and pattern. We need to consider that if we merge #1165.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

String.Const I add now, not sure, how String with both URI and Pattern works here as human readable label though. That one I may have to see and would adapt when we are there (the schema has that combination).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pending #1165 😉 😄

except KeyError:
pass
try:
return mapping['$ref'].replace('#/$defs/', '$defs.')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't that be $.$defs (not sure whether that is allowed) or $['$defs'] (definitely allowed) or am I missing something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Depends on what we want to achieve. My goal was a nicely globally anchored "you are here and these are your surroundings" feature of a hiking map targeting humans on the right hand side. There I found that for example number: $defs.version_t is more clear than number: $['defs'].version_t (sigil noise) or the "stuttering" number: $.$defs.version_t. The $defs hints at the local definitions nature, and the .version_t exposes the type.

Not sure what the benefit of JSON Paths in the type labels would be. Thus, I went wioth what looked most simple to scann for readers (my way of reading).

But, I have no strong opinion on that one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If it is a valid JSON Path, we can keep it that way for now.

if 'type' in raw_finds:
return {jpath.split(DOT)[-1]: raw_finds['type']}
if '$ref' in raw_finds:
return {jpath.split(DOT)[-1]: raw_finds['$ref'].replace('#/$defs/', '$defs.')}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See comment about $defs above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

' does not match expected mapping type {vd}'
)
jp_status = FAIL
elif lt.startswith('$defs.'):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May need to be updated as well if we apply the changes above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. Cf. #1221 (comment)

// ...
}
}
```yaml <!--json-path($..vulnerabilities..metrics[*].properties)-->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like that as it restricts the path a bit more and removes (potential) ambiguity (which does not exist yet). I wonder whether we should do that in all places applicable ...

@tschmidtb51
Copy link
Copy Markdown
Contributor

tschmidtb51 commented Feb 25, 2026

@sthagen I might have found a bug...

If I patch:

diff --git a/csaf_2.1/prose/edit/src/schema-elements-01-defs-10-references.md b/csaf_2.1/prose/edit/src/schema-elements-01-defs-10-references.md
index 2d293ce8..36570cca 100644
--- a/csaf_2.1/prose/edit/src/schema-elements-01-defs-10-references.md
+++ b/csaf_2.1/prose/edit/src/schema-elements-01-defs-10-references.md
@@ -2,10 +2,10 @@
 
 List of references (`references_t`) of value type `array` with `1` or more items of type Reference holds a list of Reference objects.
 
-```yaml <!--json-path($['$defs'].references_t)-->
+```yaml <!--json-path($['$defs'].product_id_t)-->
 $defs:
   # ...
-  references_t: Sequence
+  references-ee_t: Mapping
   # ...
 ```
 
@@ -19,8 +19,8 @@ $defs:
   # ...
   references:
   - # <reference-instance>:
-    category: String
-    summary: String
+    critical: String
+    summary: Sequence
     url: String.URI
   # ...
 ```

The result is still:

$ ./bin/validate-outlines.py src/schema-elements-01-defs-10-references.md 
snip(src/schema-elements-01-defs-10-references.md)[5,10]: OK
snip(src/schema-elements-01-defs-10-references.md)[17,26]: OK
file(src/schema-elements-01-defs-10-references.md): OK ..

What am I missing? I was under the impression, the tool would check the outlines and report entries that are invalid / have the wrong type according to the schema.

Edit:
Your oopsied.md from #1221 (comment) still works.
The tool does that, it might have to do with that specific file as document and vulnerabilities work.

sthagen and others added 10 commits February 25, 2026 17:57
Signed-off-by: Stefan Hagen <stefan@hagen.link>
…locks confused the section numbering validator

Signed-off-by: Stefan Hagen <stefan@hagen.link>
…ons.md

Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
…ons.md

Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
…t-name.md

Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
…up-id.md

Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
…ups.md

Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
…ities.md

Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
@sthagen
Copy link
Copy Markdown
Contributor Author

sthagen commented Feb 25, 2026

@tschmidtb51 there have to be bugs. Severe bugs. This tool should be a helper for us and was created along my explorations of how to create something outlinish, still valid YAML and mapping to the simplified types of the JSON Path results from the schema. I would like to clean up the tool and then we can fix enhance the tool as maintenance / tool changes. The goal was to not first inject nice outlines in YAML look everywhere and then llater explore if we can assess these, but to do this in lockstep.

Some deviations that are obviously wrong it does not detect. Some rare places where we have the upstream sources for CVSS (I think) encoded in some made up "variables" like annotations in the outlines it may never do so.

But, compared to our made up JSON skeletons we had before, I think we are in a much more verifiable position now.

Signed-off-by: Stefan Hagen <stefan@hagen.link>
@sthagen sthagen added csaf 2.1 csaf 2.1 work and removed tc-discussion-needed email To be sent via email to the TC labels Mar 1, 2026
@sthagen
Copy link
Copy Markdown
Contributor Author

sthagen commented Mar 1, 2026

Motion set: https://groups.oasis-open.org/discussion/motion-for-the-presentation-enhancement-proposal-1221 on 2026-03-01 and seconded on 2026-03-04.
The motion will automatically carry if no objection is received per the TC list before one week has passed on 2026-03-08 02:00 UTC.

@sthagen
Copy link
Copy Markdown
Contributor Author

sthagen commented Mar 9, 2026

TODO: We will have to adjust to some changes from the product-path change-set in the editor-revision branch.
Done in commit dff83ed

@sthagen sthagen merged commit a55a380 into editor-revision-2026-02-25 Mar 9, 2026
14 checks passed
@sthagen sthagen deleted the valid-outlines-as-object-overviews branch March 9, 2026 19:56
@tschmidtb51 tschmidtb51 added motion_passed A motion has passed and removed motion This item has a motion pending labels Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

csaf 2.1 csaf 2.1 work editorial mostly nits and consistency enhancement motion_passed A motion has passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initial steps to enhance the presentation of the CSAF model

4 participants