summaryrefslogtreecommitdiffstats
path: root/meta/lib/patchtest/tests/test_patch_cve.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/patchtest/tests/test_patch_cve.py')
-rw-r--r--meta/lib/patchtest/tests/test_patch_cve.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/meta/lib/patchtest/tests/test_patch_cve.py b/meta/lib/patchtest/tests/test_patch_cve.py
deleted file mode 100644
index c77848de45..0000000000
--- a/meta/lib/patchtest/tests/test_patch_cve.py
+++ /dev/null
@@ -1,37 +0,0 @@
1# Checks related to the patch's CVE lines
2#
3# Copyright (C) 2016 Intel Corporation
4#
5# SPDX-License-Identifier: GPL-2.0-only
6#
7
8import base
9import pyparsing
10
11class CVE(base.Base):
12
13 re_cve_pattern = pyparsing.Regex("CVE\-\d{4}\-\d+")
14 re_cve_payload_tag = pyparsing.Regex("\+CVE:(\s+CVE\-\d{4}\-\d+)+")
15
16 def setUp(self):
17 if self.unidiff_parse_error:
18 self.skip('Parse error %s' % self.unidiff_parse_error)
19
20 # we are just interested in series that introduce CVE patches, thus discard other
21 # possibilities: modification to current CVEs, patch directly introduced into the
22 # recipe, upgrades already including the CVE, etc.
23 new_cves = [p for p in self.patchset if p.path.endswith('.patch') and p.is_added_file]
24 if not new_cves:
25 self.skip('No new CVE patches introduced')
26
27 def test_cve_tag_format(self):
28 for commit in CVE.commits:
29 if self.re_cve_pattern.search_string(commit.shortlog) or self.re_cve_pattern.search_string(commit.commit_message):
30 tag_found = False
31 for line in commit.payload.splitlines():
32 if self.re_cve_payload_tag.search_string(line):
33 tag_found = True
34 break
35 if not tag_found:
36 self.fail('Missing or incorrectly formatted CVE tag in patch file. Correct or include the CVE tag in the patch with format: "CVE: CVE-YYYY-XXXX"',
37 commit=commit)