Skip to content

Commit

Permalink
Merge pull request #26 from JasonLovesDoggo/fix-regex-anchor
Browse files Browse the repository at this point in the history
Potential fix for code scanning alert no. 7: Missing regular expression anchor
  • Loading branch information
JasonLovesDoggo authored Jan 25, 2025
2 parents d82e5d8 + 2888b2b commit eae43e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ranges/fetchers/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (f AzurePublicCloudFetcher) FetchIPRanges() ([]string, error) {
}

// Step 2: Extract the JSON download URL using a regex
urlRegex := regexp.MustCompile(`https://download\.microsoft\.com/.*?\.json`)
urlRegex := regexp.MustCompile(`^https://download\.microsoft\.com/.*?\.json$`)
matches := urlRegex.FindStringSubmatch(string(body))
if len(matches) == 0 {
return nil, fmt.Errorf("failed to find JSON download URL in Azure download page")
Expand Down

0 comments on commit eae43e4

Please sign in to comment.