Skip to content

Commit 2cb96bd

Browse files
committed
Make OSV validation pattern more flexible to accept all OSV formats
1 parent b903e1f commit 2cb96bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/dev/msftidy.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,9 @@ def check_ref_identifiers
278278
warn("Invalid GHSA reference") if value !~ ghsa_pattern
279279
# No specific validation for repo format yet, as it's an optional string
280280
when 'OSV'
281-
# OSV format: ECOSYSTEM-YEAR-ID (e.g., GO-2021-0113, PYSEC-2024-123)
282-
osv_pattern = /^[A-Z]+-\d{4}-[A-Z0-9-]+$/i
281+
# OSV format: ECOSYSTEM-YEAR-ID or ECOSYSTEM-xxxx-xxxx-xxxx (e.g., GO-2021-0113, GHSA-8c52-x9w7-vc95, MINI-xwm2-xhhw-2w6h)
282+
# OSV accepts various formats depending on the ecosystem
283+
osv_pattern = /^[A-Z]+-[A-Z0-9-]+$/i
283284
warn("Invalid OSV reference") if value !~ osv_pattern
284285
when 'URL'
285286
if value =~ /^https?:\/\/cvedetails\.com\/cve/

0 commit comments

Comments
 (0)