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: skip checks on non serverless api resources #6471

Merged
merged 6 commits into from
Jan 4, 2024

Conversation

sidhujus
Copy link
Contributor

@sidhujus sidhujus commented Dec 19, 2023

Which issue(s) does this change fix?

#6310

Why is this change necessary?

if an api event has a ref to a non serverless api resource we still perform checks as if its a serverless api resource.

How does it address the issue?

skips checking for auth on Aws::ApiGateway::RestApi resources

What side effects does this change have?

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.

@sidhujus sidhujus requested a review from a team as a code owner December 19, 2023 00:33
@sidhujus sidhujus changed the title skip checks on non serverless api resources fix: skip checks on non serverless api resources Dec 19, 2023
@github-actions github-actions bot added area/deploy sam deploy command pr/internal labels Dec 19, 2023
@@ -101,6 +101,11 @@ def _auth_id(resources_dict, event_properties, identifier):
"""
resource_name = event_properties.get(identifier, "")
api_resource = resources_dict.get(resource_name, {})

# Auth does not apply to ApiGateway::RestApi resources so return true and continue
if api_resource and api_resource["Type"] == "AWS::ApiGateway::RestApi":
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this apply to AWS::ApiGatewayV2::Api as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yea good catch. I think it should since if the event refers to an httpApi then it would have to be this

Copy link
Contributor

@mildaniel mildaniel left a comment

Choose a reason for hiding this comment

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

Couple minor comments, looks good overall!

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!

@sidhujus sidhujus added this pull request to the merge queue Jan 3, 2024
@mildaniel mildaniel removed this pull request from the merge queue due to a manual request Jan 3, 2024
@mildaniel mildaniel added this pull request to the merge queue Jan 4, 2024
Merged via the queue into aws:develop with commit af9e38f Jan 4, 2024
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy sam deploy command pr/internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants