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: Relaxed OpenApi authorizer definition #5182

Merged
merged 9 commits into from
May 25, 2023

Conversation

lucashuy
Copy link
Contributor

@lucashuy lucashuy commented May 17, 2023

Which issue(s) does this change fix?

N/A

Why is this change necessary?

Request based authorizers can have no identity sources defined if caching is disabled. We don't check for caching, but we can make the change to allow empty identity sources.

Additionally, the root level authorizer check was incorrectly written to not apply to Rest Apis, however this is not the case.

How does it address the issue?

Relaxes the check only for request based authorizers to allow empty identity sources. Also updates the validation to accept root default authorizers for Rest Apis when using the 3.x version specification.

What side effects does this change have?

None.

Mandatory Checklist

PRs will only be reviewed after checklist is complete

  • Add input/output type hints to new functions/methods
  • Write design document if needed (Do I need to write a design document?)
  • Write/update unit tests
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

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

@lucashuy lucashuy marked this pull request as ready for review May 18, 2023 17:31
@lucashuy lucashuy requested a review from a team as a code owner May 18, 2023 17:31
@lucashuy lucashuy requested review from hawflau and jfuss May 18, 2023 17:31
@@ -152,9 +152,9 @@ def get_authorizers(self, event_type: str = Route.API) -> Dict[str, Authorizer]:
auth_name,
)

if not identity_sources:
if not identity_sources and authorizer_type == LambdaAuthorizer.TOKEN:
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 to explain this condition

Copy link
Contributor

@moelasmar moelasmar left a comment

Choose a reason for hiding this comment

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

Thanks Lucas, it looks good to me. Just left a small comment.

Copy link
Contributor

@hawflau hawflau left a comment

Choose a reason for hiding this comment

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

LGTM

@lucashuy lucashuy enabled auto-merge May 25, 2023 17:56
@lucashuy lucashuy added this pull request to the merge queue May 25, 2023
Merged via the queue into aws:develop with commit 68351db May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants