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

Validate provider config when creating the OAuth provider or the GitHub App provider. #3535

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Jun 5, 2024

Summary

Adds a special error code as well as means to catch it in the provider
handlers on provider creation so that we disallow creating providers with bad
config.

Fixes #3510

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

unit tests + manual

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

Adds a new error ErrProviderInvalidConfig that is returned if the
ValidateConfig method of the provider Manager fails. This allows the
handlers to catch this error and display its details.

Fixes: mindersec#3510
Adds the call to clients.ParseV1AppConfig to the code that creates GH
apps and returns the providers.ErrProviderInvalidConfig if the parsing
fails.

Catches the providers.ErrProviderInvalidConfig in the handler code to
display a user-friendly message.

Fixes: mindersec#3510
@jhrozek jhrozek requested a review from a team as a code owner June 5, 2024 09:32
@jhrozek jhrozek changed the title validate oauth create Validate provider config when creating the OAuth provider or the GitHub App provider. Jun 5, 2024
@coveralls
Copy link

Coverage Status

coverage: 53.189% (+0.06%) from 53.127%
when pulling 0f2635b on jhrozek:validate_oauth_create
into 936892a on stacklok:main.

@jhrozek jhrozek merged commit cded599 into mindersec:main Jun 5, 2024
22 checks passed
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.

Validate the provider configuration on create
3 participants