summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/python/python3-pygments/CVE-2022-40896.patch124
-rw-r--r--meta/recipes-devtools/python/python3-pygments_2.11.2.bb2
2 files changed, 126 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-pygments/CVE-2022-40896.patch b/meta/recipes-devtools/python/python3-pygments/CVE-2022-40896.patch
new file mode 100644
index 0000000000..9848072a94
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-pygments/CVE-2022-40896.patch
@@ -0,0 +1,124 @@
1From ed61747f328ff6aa343881b269600308ab8eac93 Mon Sep 17 00:00:00 2001
2From: Narpat Mali <narpat.mali@windriver.com>
3Date: Wed, 6 Sep 2023 10:32:38 +0000
4Subject: [PATCH] Improve the Smithy metadata matcher.
5
6Previously, metadata foo bar baz = 23 was accepted, but according to
7the definition https://smithy.io/2.0/spec/idl.html#grammar-token-smithy-MetadataSection
8it should be "metadata"<whitespace>Identifier/String<optional whitespace>.
9
10CVE: CVE-2022-40896
11
12Upstream-Status: Backport [https://github.com/pygments/pygments/commit/dd52102c38ebe78cd57748e09f38929fd283ad04]
13
14Signed-off-by: Narpat Mali <narpat.mali@windriver.com>
15---
16 pygments/lexers/smithy.py | 5 +-
17 tests/examplefiles/smithy/test.smithy | 12 +++++
18 tests/examplefiles/smithy/test.smithy.output | 52 ++++++++++++++++++++
19 3 files changed, 67 insertions(+), 2 deletions(-)
20
21diff --git a/pygments/lexers/smithy.py b/pygments/lexers/smithy.py
22index 0f0a912..c5e25cd 100644
23--- a/pygments/lexers/smithy.py
24+++ b/pygments/lexers/smithy.py
25@@ -58,8 +58,9 @@ class SmithyLexer(RegexLexer):
26 (words(aggregate_shapes,
27 prefix=r'^', suffix=r'(\s+' + identifier + r')'),
28 bygroups(Keyword.Declaration, Name.Class)),
29- (r'^(metadata)(\s+.+)(\s*)(=)',
30- bygroups(Keyword.Declaration, Name.Class, Whitespace, Name.Decorator)),
31+ (r'^(metadata)(\s+)((?:\S+)|(?:\"[^"]+\"))(\s*)(=)',
32+ bygroups(Keyword.Declaration, Whitespace, Name.Class,
33+ Whitespace, Name.Decorator)),
34 (r"(true|false|null)", Keyword.Constant),
35 (r"(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)", Number),
36 (identifier + ":", Name.Label),
37diff --git a/tests/examplefiles/smithy/test.smithy b/tests/examplefiles/smithy/test.smithy
38index 3d20f06..9317fee 100644
39--- a/tests/examplefiles/smithy/test.smithy
40+++ b/tests/examplefiles/smithy/test.smithy
41@@ -2,6 +2,18 @@ $version: "1.0"
42
43 namespace test
44
45+metadata "foo" = ["bar", "baz"]
46+metadata validators = [
47+ {
48+ name: "ValidatorName"
49+ id: "ValidatorId"
50+ message: "Some string"
51+ configuration: {
52+ selector: "operation"
53+ }
54+ }
55+]
56+
57 /// Define how an HTTP request is serialized given a specific protocol,
58 /// authentication scheme, and set of input parameters.
59 @trait(selector: "operation")
60diff --git a/tests/examplefiles/smithy/test.smithy.output b/tests/examplefiles/smithy/test.smithy.output
61index 1f22489..db44a38 100644
62--- a/tests/examplefiles/smithy/test.smithy.output
63+++ b/tests/examplefiles/smithy/test.smithy.output
64@@ -7,6 +7,58 @@
65 ' test' Name.Class
66 '\n\n' Text.Whitespace
67
68+'metadata' Keyword.Declaration
69+' ' Text.Whitespace
70+'"foo"' Name.Class
71+' ' Text.Whitespace
72+'=' Name.Decorator
73+' ' Text.Whitespace
74+'[' Text
75+'"bar"' Literal.String.Double
76+',' Punctuation
77+' ' Text.Whitespace
78+'"baz"' Literal.String.Double
79+']' Text
80+'\n' Text.Whitespace
81+
82+'metadata' Keyword.Declaration
83+' ' Text.Whitespace
84+'validators' Name.Class
85+' ' Text.Whitespace
86+'=' Name.Decorator
87+' ' Text.Whitespace
88+'[' Text
89+'\n ' Text.Whitespace
90+'{' Text
91+'\n ' Text.Whitespace
92+'name:' Name.Label
93+' ' Text.Whitespace
94+'"ValidatorName"' Literal.String.Double
95+'\n ' Text.Whitespace
96+'id:' Name.Label
97+' ' Text.Whitespace
98+'"ValidatorId"' Literal.String.Double
99+'\n ' Text.Whitespace
100+'message:' Name.Label
101+' ' Text.Whitespace
102+'"Some string"' Literal.String.Double
103+'\n ' Text.Whitespace
104+'configuration:' Name.Label
105+' ' Text.Whitespace
106+'{' Text
107+'\n ' Text.Whitespace
108+'selector:' Name.Label
109+' ' Text.Whitespace
110+'"operation"' Literal.String.Double
111+'\n ' Text.Whitespace
112+'}' Text
113+'\n ' Text.Whitespace
114+'}' Text
115+'\n' Text.Whitespace
116+
117+']' Text
118+'\n\n' Text.Whitespace
119+
120 '/// Define how an HTTP request is serialized given a specific protocol,' Comment.Multiline
121 '\n' Text.Whitespace
122
123--
1242.40.0
diff --git a/meta/recipes-devtools/python/python3-pygments_2.11.2.bb b/meta/recipes-devtools/python/python3-pygments_2.11.2.bb
index 35d288c89e..6e787f23d2 100644
--- a/meta/recipes-devtools/python/python3-pygments_2.11.2.bb
+++ b/meta/recipes-devtools/python/python3-pygments_2.11.2.bb
@@ -7,6 +7,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=98419e351433ac106a24e3ad435930bc"
7inherit setuptools3 7inherit setuptools3
8SRC_URI[sha256sum] = "4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a" 8SRC_URI[sha256sum] = "4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a"
9 9
10SRC_URI += "file://CVE-2022-40896.patch"
11
10DEPENDS += "\ 12DEPENDS += "\
11 ${PYTHON_PN} \ 13 ${PYTHON_PN} \
12 " 14 "