Skip to content

Commit 761fc27

Browse files
authored
Merge commit from fork
Signed-off-by: Michael Crenshaw <[email protected]>
1 parent 1a023f1 commit 761fc27

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
@@ -284,11 +284,13 @@ func (a *ArgoCDWebhookHandler) affectedRevisionInfo(payloadIf any) (webURLs []st
284284
// so we cannot update changedFiles for this type of payload
285285

286286
case gogsclient.PushPayload:
287-
webURLs = append(webURLs, payload.Repo.HTMLURL)
288287
revision = ParseRevision(payload.Ref)
289288
change.shaAfter = ParseRevision(payload.After)
290289
change.shaBefore = ParseRevision(payload.Before)
291-
touchedHead = bool(payload.Repo.DefaultBranch == revision)
290+
if payload.Repo != nil {
291+
webURLs = append(webURLs, payload.Repo.HTMLURL)
292+
touchedHead = payload.Repo.DefaultBranch == revision
293+
}
292294
for _, commit := range payload.Commits {
293295
changedFiles = append(changedFiles, commit.Added...)
294296
changedFiles = append(changedFiles, commit.Modified...)

util/webhook/webhook_test.go

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

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

0 commit comments

Comments
 (0)