From 59fc682a651793f1c8275bd5f8303aba9c866fd2 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 19 Sep 2023 09:57:52 +1200 Subject: [PATCH] FIX Add SS-2023-001 style security commits. Noticed this in passing while reviewing another change --- src/Model/Changelog/ChangelogItem.php | 6 +++++- tests/Model/Changelog/ChangelogItemTest.php | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Model/Changelog/ChangelogItem.php b/src/Model/Changelog/ChangelogItem.php index 956aa08..e63c173 100644 --- a/src/Model/Changelog/ChangelogItem.php +++ b/src/Model/Changelog/ChangelogItem.php @@ -301,10 +301,14 @@ public function getShortHash() */ public function getSecurityCVE() { - // New CVE style identifiers + // New CVE style identifiers (e.g. CVE-2023-32302) if (preg_match('/^\[(?CVE-(\d){4}-(\d){4,})\]/i', $this->getRawMessage(), $matches)) { return strtolower($matches['cve']); } + // Non-CVE style identifiers (e.g. SS-2023-001) + if (preg_match('/^\[(?SS-(\d){4}-(\d){3})\]/i', $this->getRawMessage(), $matches)) { + return strtolower($matches['ss']); + } } /** diff --git a/tests/Model/Changelog/ChangelogItemTest.php b/tests/Model/Changelog/ChangelogItemTest.php index 6f13f1d..017673c 100644 --- a/tests/Model/Changelog/ChangelogItemTest.php +++ b/tests/Model/Changelog/ChangelogItemTest.php @@ -82,15 +82,15 @@ public function messageProvider() [ '[SS-2047-123] Lower doubt with cow coverage', '[SS-2047-123] Lower doubt with cow coverage', - 'Other changes' + 'Security' ], [ '[ss-2047-123] Lower doubt with cow coverage', '[ss-2047-123] Lower doubt with cow coverage', - 'Other changes' + 'Security' ], - ['[SS-2047-123]: Logins now use passwords', '[SS-2047-123]: Logins now use passwords', 'Other changes'], - ['[ss-2047-123]: Logins now use passwords', '[ss-2047-123]: Logins now use passwords', 'Other changes'], + ['[SS-2047-123]: Logins now use passwords', '[SS-2047-123]: Logins now use passwords', 'Security'], + ['[ss-2047-123]: Logins now use passwords', '[ss-2047-123]: Logins now use passwords', 'Security'], ['[CVE-1234-56789]: Fix something serious', 'Fix something serious', 'Security'], ['[CVE-1234-12345] Remove admin login backdoor', 'Remove admin login backdoor', 'Security'], ['[cve-1234-123456] added admin login backdoor', 'added admin login backdoor', 'Security'],