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 Http Api Authorizers identity Header #2339

Merged
merged 2 commits into from Jun 7, 2022

Conversation

jonife
Copy link
Contributor

@jonife jonife commented Mar 7, 2022

Issue #, if available:

Description of changes:
added validation to validate the property type of Authorizers Identity parameter Headers to arrest a situation where an intrinsic value can't be resolved.

Description of how you validated changes:
created a test sam template and tested the exception

Checklist:

  • Add/update unit tests using:
  • Add/update integration tests
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected

Examples?

Please reach out in the comments, if you want to add an example. Examples will be
added to sam init through https://github.com/awslabs/aws-sam-cli-app-templates/

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

Comment on lines 176 to 177
if self.identity.get("Headers"):
headers = self.identity.get("Headers")
Copy link
Contributor

Choose a reason for hiding this comment

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

To prevent the duplication:

Suggested change
if self.identity.get("Headers"):
headers = self.identity.get("Headers")
headers = self.identity.get("Headers")
if headers:

@codecov-commenter
Copy link

codecov-commenter commented Mar 24, 2022

Codecov Report

Merging #2339 (b0f45e4) into develop (e7a1496) will increase coverage by 0.80%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #2339      +/-   ##
===========================================
+ Coverage    93.58%   94.38%   +0.80%     
===========================================
  Files           90       98       +8     
  Lines         6124     7217    +1093     
  Branches      1260     1493     +233     
===========================================
+ Hits          5731     6812    +1081     
- Misses         183      196      +13     
+ Partials       210      209       -1     
Impacted Files Coverage Δ
samtranslator/region_configuration.py 77.77% <0.00%> (-22.23%) ⬇️
samtranslator/validator/validator.py 91.80% <0.00%> (-3.85%) ⬇️
samtranslator/model/exceptions.py 97.67% <0.00%> (-2.33%) ⬇️
samtranslator/open_api/open_api.py 90.03% <0.00%> (-1.94%) ⬇️
samtranslator/model/s3_utils/uri_parser.py 68.42% <0.00%> (-0.81%) ⬇️
samtranslator/yaml_helper.py 89.47% <0.00%> (-0.53%) ⬇️
samtranslator/translator/logical_id_generator.py 90.62% <0.00%> (-0.29%) ⬇️
samtranslator/model/api/api_generator.py 94.08% <0.00%> (-0.28%) ⬇️
samtranslator/model/apigateway.py 96.98% <0.00%> (-0.18%) ⬇️
samtranslator/intrinsics/resource_refs.py 95.83% <0.00%> (-0.17%) ⬇️
... and 43 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6638c32...b0f45e4. Read the comment docs.

@moelasmar
Copy link
Contributor

@jonife .. could you please resolve the merge conflicts.

@jonife jonife force-pushed the ops_03_07_22_identity_header branch from ae91988 to b0f45e4 Compare April 22, 2022 00:46
@hawflau hawflau merged commit 67c2358 into aws:develop Jun 7, 2022
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.

None yet

7 participants