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(gitlab): vcs gitlab groups retrieval #3716

Merged
merged 3 commits into from
Oct 23, 2022
Merged

fix(gitlab): vcs gitlab groups retrieval #3716

merged 3 commits into from
Oct 23, 2022

Conversation

maxamel
Copy link
Contributor

@maxamel maxamel commented Oct 23, 2022

Description

This PR fixes an issue in vcs gitlab groups retrieval. One part is in schema validation, and the second in the logic of failing checks.

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 changed the title fix: vcs gitlab groups retrieval fix gitlab gitlab groups retrieval Oct 23, 2022
@maxamel maxamel changed the title fix gitlab gitlab groups retrieval fix gitlab: vcs gitlab groups retrieval Oct 23, 2022
@maxamel maxamel changed the title fix gitlab: vcs gitlab groups retrieval fix(gitlab): vcs gitlab groups retrieval Oct 23, 2022
@maxamel maxamel marked this pull request as ready for review October 23, 2022 14:31
if group.get("require_two_factor_authentication", False) is True:
return CheckResult.PASSED, conf
return CheckResult.FAILED, conf
if group.get("require_two_factor_authentication") is False:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that maybe require_two_factor_authentication is not a required field (although the schema down here states it is required - from the docs: https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/groups.md)
Hence in case there is no require_two_factor_authentication the schema will be filtered and will not get here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the docs state that require_two_factor_authentication is not mandatory on PUT/POST operations, since it defaults to False. But on retrieval it is always returned.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are correct! missed the difference :)

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.

@maxamel maxamel merged commit 6ed886e into master Oct 23, 2022
@maxamel maxamel deleted the fix-gitlab-groups branch October 23, 2022 15:16
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.

4 participants