Skip to content

Commit

Permalink
Merge pull request #933 from snyk/feat/update-hook-rules
Browse files Browse the repository at this point in the history
fix: add github and azure-repos filter rules for webhook event upgrades
  • Loading branch information
aarlaud authored Feb 21, 2025
2 parents 309c97f + e5ef101 commit a26247f
Show file tree
Hide file tree
Showing 10 changed files with 462 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client-templates/azure-repos/accept.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,16 @@
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get webhook",
"method": "GET",
"path": "/_apis/hooks/subscriptions/:subscriptionId",
"origin": "https://${AZURE_REPOS_HOST}/${AZURE_REPOS_ORG}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
}
]
}
6 changes: 6 additions & 0 deletions client-templates/github-com/accept.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2142,6 +2142,12 @@
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id/config",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
},
{
"//": "allow webhooks to be updated, to allow for event upgrades",
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
}
]
}
6 changes: 6 additions & 0 deletions client-templates/github-enterprise/accept.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,12 @@
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id/config",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
},
{
"//": "allow webhooks to be updated, to allow for event upgrades",
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
}
]
}
6 changes: 6 additions & 0 deletions client-templates/github-server-app/accept.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,12 @@
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id/config",
"origin": "https://${GITHUB_API}"
},
{
"//": "allow webhooks to be updated, to allow for event upgrades",
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id",
"origin": "https://${GITHUB_API}"
}
]
}
10 changes: 10 additions & 0 deletions defaultFilters/azure-repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,16 @@
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get webhook",
"method": "GET",
"path": "/_apis/hooks/subscriptions/:subscriptionId",
"origin": "https://${AZURE_REPOS_HOST}/${AZURE_REPOS_ORG}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
}
]
}
6 changes: 6 additions & 0 deletions defaultFilters/github-enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,12 @@
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id/config",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
},
{
"//": "allow webhooks to be updated, to allow for event upgrades",
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
}
]
}
10 changes: 10 additions & 0 deletions defaultFilters/github-server-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2033,5 +2033,15 @@
"token": "${GHA_ACCESS_TOKEN}"
}
},
{
"//": "allow webhooks to be updated, to allow for event upgrades",
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id",
"origin": "https://${GITHUB_API}",
"auth": {
"scheme": "bearer",
"token": "${GHA_ACCESS_TOKEN}"
}
}
]
}
6 changes: 6 additions & 0 deletions defaultFilters/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,12 @@
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id/config",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
},
{
"//": "allow webhooks to be updated, to allow for event upgrades",
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
}
]
}
6 changes: 6 additions & 0 deletions test/fixtures/accept/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id/config",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
},
{
"//": "allow webhooks to be updated, to allow for event upgrades",
"method": "PATCH",
"path": "/repos/:name/:repo/hooks/:id",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
}
]
}
Loading

0 comments on commit a26247f

Please sign in to comment.