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

feat(github): split repo and org webhooks to separate files #3764

Merged
merged 2 commits into from
Oct 31, 2022

Conversation

maxamel
Copy link
Contributor

@maxamel maxamel commented Oct 30, 2022

Description

This PR splits multiple vcs webhooks into separate files so each one appears as new check violation.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@maxamel maxamel marked this pull request as ready for review October 30, 2022 13:47
BaseVCSDAL.persist(path=self.github_conf_file_paths["repository_webhooks"], conf=repository_webhooks)
for idx, item in enumerate(repository_webhooks):
path = str(self.github_conf_file_paths["repository_webhooks"])
BaseVCSDAL.persist(path=path.replace(".json", str(idx) + ".json"), conf=[item]) # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add some logs here for path=path.replace(".json", str(idx) + ".json") ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have the logs inside the persist method, so we'll know what we're writing and to where

@nimrodkor
Copy link
Contributor

What about repo webhooks?

Copy link
Contributor

@nimrodkor nimrodkor left a comment

Choose a reason for hiding this comment

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

Can you share an example of the new output?

@maxamel
Copy link
Contributor Author

maxamel commented Oct 31, 2022

Example output:

`Check: CKV_GITHUB_7: "Ensure GitHub repository webhooks are using HTTPS"
	FAILED for resource: /github_conf/repository_webhooks2.json.*./github_conf/repository_webhooks2.json.CKV_GITHUB_7
	Severity: MEDIUM
	File: /repository_webhooks2.json:10-13
	Guide: https://docs.bridgecrew.io/docs/ensure-github-organization-and-repository-webhooks-are-using-https
	10 |         "config": {
	11 |             "content_type": "form",
	12 |             "insecure_ssl": "0",
	13 |             "url": "http://howdy.co.com"
Check: CKV_GITHUB_7: "Ensure GitHub repository webhooks are using HTTPS"
	FAILED for resource: /github_conf/repository_webhooks1.json.*./github_conf/repository_webhooks1.json.CKV_GITHUB_7
	Severity: MEDIUM
	File: /repository_webhooks1.json:10-13
	Guide: https://docs.bridgecrew.io/docs/ensure-github-organization-and-repository-webhooks-are-using-https
	10 |         "config": {
	11 |             "content_type": "form",
	12 |             "insecure_ssl": "0",
	13 |             "url": "http://dimdim.com"`

@maxamel maxamel merged commit bf5d2be into master Oct 31, 2022
@maxamel maxamel deleted the split_multiple_separate_webhooks branch October 31, 2022 08:44
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.

5 participants