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

✨ checks: add GitHub Webhook check #1675

Merged
merged 5 commits into from
Mar 31, 2022
Merged

Conversation

cpanato
Copy link
Contributor

@cpanato cpanato commented Feb 24, 2022

  • Please check if the PR fulfills these requirements
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    This adds a new check to validate the GitHub repositories Webhooks if the webhook has a secret configured.
    Tested with a token with public_repo permission only and worked.

Fixes #1655

TODO:

  • create a repo with webhooks configured to set up the e2e tests (@laurentsimon this is something that you can help with?)
  • What is the current behavior? (You can also link to an open issue here)
    NONE

  • What is the new behavior (if this is a feature change)?
    Add a new check to validate GitHub Webhook

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    No

  • Other information:

@codecov
Copy link

codecov bot commented Feb 24, 2022

Codecov Report

Merging #1675 (77236bf) into main (d10ac0d) will increase coverage by 2.91%.
The diff coverage is 44.91%.

❗ Current head 77236bf differs from pull request most recent head 36076d8. Consider uploading reports for the commit 36076d8 to get more accurate results

@@            Coverage Diff             @@
##             main    #1675      +/-   ##
==========================================
+ Coverage   54.71%   57.62%   +2.91%     
==========================================
  Files          67       71       +4     
  Lines        6521     6639     +118     
==========================================
+ Hits         3568     3826     +258     
+ Misses       2713     2563     -150     
- Partials      240      250      +10     

@github-actions
Copy link

Integration tests success for
[bfd93e7]
(https://github.com/ossf/scorecard/actions/runs/1892072247)

@cpanato cpanato temporarily deployed to integration-test February 24, 2022 09:04 Inactive
@github-actions
Copy link

Integration tests success for
[4ac8dc5]
(https://github.com/ossf/scorecard/actions/runs/1892110248)

checks/raw/webhook.go Show resolved Hide resolved
checks/webhook.go Outdated Show resolved Hide resolved
clients/mockclients/repo_client.go Outdated Show resolved Hide resolved
docs/checks.md Outdated Show resolved Hide resolved
docs/checks.md Show resolved Hide resolved
@cpanato cpanato temporarily deployed to integration-test February 25, 2022 08:43 Inactive
@cpanato cpanato temporarily deployed to integration-test February 25, 2022 08:45 Inactive
@github-actions
Copy link

Integration tests success for
[c1d955c]
(https://github.com/ossf/scorecard/actions/runs/1897677836)

@github-actions
Copy link

Integration tests success for
[6ec2f92]
(https://github.com/ossf/scorecard/actions/runs/1897682442)

checks/webhook.go Outdated Show resolved Hide resolved
checks/webhook.go Outdated Show resolved Hide resolved
Copy link
Contributor

@azeemshaikh38 azeemshaikh38 left a comment

Choose a reason for hiding this comment

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

Looks good to me overall. Thanks for the awesome PR and for adding tests! Left some comments, please take a look.

checker/raw_result.go Outdated Show resolved Hide resolved
checks/webhook.go Outdated Show resolved Hide resolved
checks/raw/webhook.go Show resolved Hide resolved
checks/webhook.go Outdated Show resolved Hide resolved
checks/webhook.go Outdated Show resolved Hide resolved
Copy link
Contributor

@laurentsimon laurentsimon left a comment

Choose a reason for hiding this comment

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

see comments inline

@laurentsimon
Copy link
Contributor

UsesAuthSecret (as suggested by @azeemshaikh38) sounds good: it disambiguate the use case. HasSecret may be interpreted as a secret is stored and should be removed

docs/checks.md Outdated Show resolved Hide resolved
Copy link
Contributor

@laurentsimon laurentsimon left a comment

Choose a reason for hiding this comment

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

any update you'd like me to review?

checks/raw/webhook.go Show resolved Hide resolved
@cpanato cpanato temporarily deployed to integration-test March 30, 2022 12:33 Inactive
@github-actions
Copy link

Integration tests success for
[ae28356]
(https://github.com/ossf/scorecard/actions/runs/2064721141)

@github-actions
Copy link

Integration tests success for
[54e0f3c]
(https://github.com/ossf/scorecard/actions/runs/2064756999)

Copy link
Contributor

@azeemshaikh38 azeemshaikh38 left a comment

Choose a reason for hiding this comment

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

LG to submit.

checks/webhook.go Show resolved Hide resolved
@laurentsimon
Copy link
Contributor

protobuf compilation error, not your fault. Re-launching

@laurentsimon laurentsimon enabled auto-merge (squash) March 30, 2022 23:20
@laurentsimon laurentsimon temporarily deployed to integration-test March 30, 2022 23:20 Inactive
@github-actions
Copy link

Integration tests success for
[77236bf]
(https://github.com/ossf/scorecard/actions/runs/2067935123)

@cpanato
Copy link
Contributor Author

cpanato commented Mar 31, 2022

i will rebase

auto-merge was automatically disabled March 31, 2022 07:57

Head branch was pushed to by a user without write access

@cpanato cpanato temporarily deployed to integration-test March 31, 2022 07:57 Inactive
@github-actions
Copy link

Integration tests success for
[5be197f]
(https://github.com/ossf/scorecard/actions/runs/2069688157)

@cpanato cpanato temporarily deployed to integration-test March 31, 2022 10:22 Inactive
@github-actions
Copy link

Integration tests success for
[2885c3f]
(https://github.com/ossf/scorecard/actions/runs/2070405159)

cpanato added 5 commits March 31, 2022 15:01
Signed-off-by: cpanato <[email protected]>
Signed-off-by: cpanato <[email protected]>
Signed-off-by: cpanato <[email protected]>
Signed-off-by: cpanato <[email protected]>
@cpanato cpanato temporarily deployed to integration-test March 31, 2022 13:09 Inactive
@github-actions
Copy link

Integration tests success for
[36076d8]
(https://github.com/ossf/scorecard/actions/runs/2071176374)

@cpanato
Copy link
Contributor Author

cpanato commented Mar 31, 2022

all green now :)

@azeemshaikh38 azeemshaikh38 merged commit 7dcb3cb into ossf:main Mar 31, 2022
@laurentsimon
Copy link
Contributor

Thank you, fantastic work!

@cpanato cpanato deleted the GH-1655 branch March 31, 2022 15:38
@cpanato
Copy link
Contributor Author

cpanato commented Mar 31, 2022

thanks for all the reviews and feedback

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.

Web hook secret used
4 participants