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(github): fix variables initialization #3585

Merged
merged 4 commits into from
Sep 29, 2022
Merged

Conversation

marynaKK
Copy link
Contributor

@marynaKK marynaKK commented Sep 29, 2022

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

The initialization of the variables in the init of GitHub class is done before the type is set to string (by assigning the "" string). This caused to no checks at all from the GitHub framework (as no repo/account/rtc. are set in the first place)

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

@marynaKK marynaKK reopened this Sep 29, 2022
self.github_conf_dir_path = ""
self.github_org_security_file_path = ""
self.github_branch_protection_rules_file_path = ""
self.github_org_webhooks_file_path = ""
self.github_repository_webhooks_file_path = ""
self.github_repository_collaborators_file_path = ""
super().__init__()
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 a comment the init has to be at the end and also add or extend an existing UT to check some/all attributes are filled with something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi! thanks for the review :) I've added a test for this (all paths should be initialized even if not used)
Also, I moved the type declaration (by Nimrod's suggestion) to be in the class instead of the init method.
💪 🐶

Copy link
Contributor

@gruebel gruebel left a comment

Choose a reason for hiding this comment

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

🐶

@marynaKK marynaKK merged commit aa067b2 into master Sep 29, 2022
@marynaKK marynaKK deleted the bug-fix-gihub-dal branch September 29, 2022 13:08
pull bot pushed a commit to Mu-L/checkov that referenced this pull request Sep 29, 2022
* vairables nulled after they are initiallized

* vairables nulled after they are initiallized

* changes to proper str typing in class

* fis lint
gruebel pushed a commit to gruebel/checkov that referenced this pull request Sep 29, 2022
* vairables nulled after they are initiallized

* vairables nulled after they are initiallized

* changes to proper str typing in class

* fis lint
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