Skip to content

Commit

Permalink
OCPBUGS-26937: Add extra check in ids to bypass validations (#899)
Browse files Browse the repository at this point in the history
* Add extra check in ids (snyk)

* Add snyk ignore policy for vendor folder

* fix linting
  • Loading branch information
ncaak authored Feb 1, 2024
1 parent ec30666 commit 9db82ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
ignore: {}
patch: {}
exclude:
global:
- vendor
17 changes: 12 additions & 5 deletions cmd/changelog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,19 @@ func getChanges(pullRequestIds, pullRequestHashes []string) []*Change {
var changes []*Change
log.Print("Reading changes from the GitHub API")
for i, id := range pullRequestIds {
change := getPullRequestFromGitHub(id)
change.hash = pullRequestHashes[i]
if _, err := determineReleases(change); err != nil {
continue
// This regex checks that the ids passed as CLI arguments are valid.
// This code cannot be encapsulated or Snyk will flag it as a defect.
// This warning was originally raised in issue OCPBUGS-26937.
if regexp.MustCompile(`^\d*$`).MatchString(id) {
change := getPullRequestFromGitHub(id)
change.hash = pullRequestHashes[i]
if _, err := determineReleases(change); err != nil {
continue
}
changes = append(changes, change)
} else {
log.Print("ERR :: could not validate entered Pull Request, ", id)
}
changes = append(changes, change)
}
return changes
}
Expand Down

0 comments on commit 9db82ef

Please sign in to comment.