Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scm): handle new go-github validation changes and ensure correct number for init hook #822

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

ecrupper
Copy link
Contributor

@ecrupper ecrupper commented Apr 19, 2023

With the release of go-github/v51, the ValidatePayload method now requires secret validation in order to capture a payload (ref).

Since our webhook validation occurs later, when we actually have our webhook secret, we cannot grab this payload unless we call ValidatePayloadFromBody with empty signature and secret values instead.

Lastly, in this change, I failed to account for situations where a repo was being re-enabled / repaired, and thus the init webhook would not have a number value of 1

@ecrupper ecrupper self-assigned this Apr 19, 2023
@ecrupper ecrupper requested a review from a team as a code owner April 19, 2023 05:20
@codecov
Copy link

codecov bot commented Apr 19, 2023

Codecov Report

Merging #822 (34f53dc) into main (3fec46c) will decrease coverage by 0.01%.
The diff coverage is 57.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #822      +/-   ##
==========================================
- Coverage   57.73%   57.73%   -0.01%     
==========================================
  Files         263      263              
  Lines       15911    15915       +4     
==========================================
+ Hits         9187     9188       +1     
- Misses       6310     6312       +2     
- Partials      414      415       +1     
Impacted Files Coverage Δ
scm/github/webhook.go 85.71% <40.00%> (-0.60%) ⬇️
scm/github/repo.go 76.42% <100.00%> (ø)

scm/github/webhook.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jbrockopp jbrockopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ecrupper ecrupper merged commit 2913b6d into main Apr 19, 2023
@ecrupper ecrupper deleted the fix/scm-validate-and-correct-hook-num branch April 19, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants