Skip to content

Commit

Permalink
FIX Add SS-2023-001 style security commits. (silverstripe#246)
Browse files Browse the repository at this point in the history
Noticed this in passing while reviewing another change
  • Loading branch information
GuySartorelli authored Sep 19, 2023
1 parent b38097f commit ac1dc5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/Model/Changelog/ChangelogItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>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>SS-(\d){4}-(\d){3})\]/i', $this->getRawMessage(), $matches)) {
return strtolower($matches['ss']);
}
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/Model/Changelog/ChangelogItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit ac1dc5a

Please sign in to comment.