public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] docs: automarkup: linkify CVSS: strings
@ 2024-03-11 15:00 Vegard Nossum
  2024-03-11 15:00 ` [RFC PATCH 2/2] doc: distros: new document about assessing security vulnerabilities Vegard Nossum
  0 siblings, 1 reply; 7+ messages in thread
From: Vegard Nossum @ 2024-03-11 15:00 UTC (permalink / raw)
  To: Jonathan Corbet, cve; +Cc: linux-kernel, linux-doc, security, Vegard Nossum

CVSS vectors encode the results of a vulnerability analysis.

When encountered in the documentation, create links to first.org which
can be used to explain and explore the various vector components and
their values.

Example:

- https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L/E:U/MPR:L

FIRST is the Forum of Incident Response and Security Teams, founded
in 1990, and is partnered and supported by many well-known organizations.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 Documentation/sphinx/automarkup.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/automarkup.py
index a413f8dd5115..8cf95a404bc8 100644
--- a/Documentation/sphinx/automarkup.py
+++ b/Documentation/sphinx/automarkup.py
@@ -76,6 +76,11 @@ c_namespace = ''
 RE_git = re.compile(r'commit\s+(?P<rev>[0-9a-f]{12,40})(?:\s+\(".*?"\))?',
     flags=re.IGNORECASE | re.DOTALL)
 
+#
+# CVSS score vectors
+#
+RE_cvss = re.compile(r'CVSS:(?P<ver>[0-9\.]+)(/[A-Z-]{1,3}:[A-Z])+')
+
 def markup_refs(docname, app, node):
     t = node.astext()
     done = 0
@@ -93,7 +98,8 @@ def markup_refs(docname, app, node):
                            RE_union: markup_c_ref,
                            RE_enum: markup_c_ref,
                            RE_typedef: markup_c_ref,
-                           RE_git: markup_git}
+                           RE_git: markup_git,
+                           RE_cvss: markup_cvss}
 
     if sphinx.version_info[0] >= 3:
         markup_func = markup_func_sphinx3
@@ -290,6 +296,12 @@ def markup_git(docname, app, match):
     return nodes.reference('', nodes.Text(text),
         refuri=f'https://git.kernel.org/torvalds/c/{rev}')
 
+def markup_cvss(docname, app, match):
+    text = match.group(0)
+    ver = match.group('ver')
+    return nodes.reference('', nodes.Text(text),
+        refuri=f'https://www.first.org/cvss/calculator/{ver}#{text}')
+
 def auto_markup(app, doctree, name):
     global c_namespace
     c_namespace = get_c_namespace(app, name)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-13 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-11 15:00 [RFC PATCH 1/2] docs: automarkup: linkify CVSS: strings Vegard Nossum
2024-03-11 15:00 ` [RFC PATCH 2/2] doc: distros: new document about assessing security vulnerabilities Vegard Nossum
2024-03-11 17:59   ` Matt Wilson
2024-03-13 13:11     ` Vegard Nossum
2024-03-13 22:41       ` Matt Wilson
2024-03-12 22:58   ` Kees Cook
2024-03-13 13:15     ` Vegard Nossum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox