Skip to content

Commit 95bdcdc

Browse files
crenshaw-devtodaywasawesome
authored andcommitted
Merge commit from fork
Signed-off-by: Michael Crenshaw <[email protected]>
1 parent 553400b commit 95bdcdc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

util/webhook/webhook.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,13 @@ func (a *ArgoCDWebhookHandler) affectedRevisionInfo(payloadIf any) (webURLs []st
280280
// so we cannot update changedFiles for this type of payload
281281

282282
case gogsclient.PushPayload:
283-
webURLs = append(webURLs, payload.Repo.HTMLURL)
284283
revision = ParseRevision(payload.Ref)
285284
change.shaAfter = ParseRevision(payload.After)
286285
change.shaBefore = ParseRevision(payload.Before)
287-
touchedHead = bool(payload.Repo.DefaultBranch == revision)
286+
if payload.Repo != nil {
287+
webURLs = append(webURLs, payload.Repo.HTMLURL)
288+
touchedHead = payload.Repo.DefaultBranch == revision
289+
}
288290
for _, commit := range payload.Commits {
289291
changedFiles = append(changedFiles, commit.Added...)
290292
changedFiles = append(changedFiles, commit.Modified...)

util/webhook/webhook_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,9 @@ func Test_affectedRevisionInfo_appRevisionHasChanged(t *testing.T) {
705705
{true, "refs/tags/no-slashes", bitbucketRefChangedPayload("no-slashes"), "bitbucket ref changed branch or tag name without slashes, targetRevision tag prefixed"},
706706
{true, "refs/tags/no-slashes", gogsPushPayload("no-slashes"), "gogs push branch or tag name without slashes, targetRevision tag prefixed"},
707707

708+
// Tests fix for https://github.com/argoproj/argo-cd/security/advisories/GHSA-wp4p-9pxh-cgx2
709+
{true, "test", gogsclient.PushPayload{Ref: "test", Repo: nil}, "gogs push branch with nil repo in payload"},
710+
708711
// Testing fix for https://github.com/argoproj/argo-cd/security/advisories/GHSA-gpx4-37g2-c8pv
709712
{false, "test", azuredevops.GitPushEvent{Resource: azuredevops.Resource{RefUpdates: []azuredevops.RefUpdate{}}}, "Azure DevOps malformed push event with no ref updates"},
710713

0 commit comments

Comments
 (0)