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(graphql-auth-transformer): protection for connection types #5655

Conversation

chrisjprior
Copy link
Contributor

@chrisjprior chrisjprior commented Oct 21, 2020

When generating auth directives to protect fields decorated by @connection we now protect the
operation including its return type instead of protecting only the field. This is important for the
case where queries are not defined on the nested model type since they wont be generated for the
schemas Query.operation.

"fix #4874", "fix #5510" "fix #6104"

Issue #, if available:

Description of changes:

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

When generating auth directives to protect fields decorated by @connection we now protect the
operation including its return type instead of protecting only the field. This is important for the
case where queries are not defined on the nested model type since they wont be generated for the
schemas Query.operation.

"fix aws-amplify#4874", "fix aws-amplify#5510"
@codecov
Copy link

codecov bot commented Oct 21, 2020

Codecov Report

Merging #5655 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5655      +/-   ##
==========================================
+ Coverage   57.89%   57.94%   +0.04%     
==========================================
  Files         410      410              
  Lines       18709    18709              
  Branches     3738     3543     -195     
==========================================
+ Hits        10831    10840       +9     
- Misses       7194     7205      +11     
+ Partials      684      664      -20     
Impacted Files Coverage Δ
...aphql-auth-transformer/src/ModelAuthTransformer.ts 88.51% <100.00%> (+0.78%) ⬆️
packages/amplify-util-mock/src/api/api.ts 0.00% <0.00%> (ø)
packages/graphql-mapping-template/src/print.ts 34.65% <0.00%> (ø)
packages/amplify-util-mock/src/storage/storage.ts 0.00% <0.00%> (ø)
...ges/amplify-util-mock/src/CFNParser/stack/index.ts 0.00% <0.00%> (ø)
...es/amplify-util-mock/src/api/resolver-overrides.ts 0.00% <0.00%> (ø)
...es/graphql-transformer-core/src/stripDirectives.ts 35.29% <0.00%> (ø)
.../amplify-cli-core/src/state-manager/pathManager.ts 69.86% <0.00%> (ø)
.../amplify-util-mock/src/utils/lambda/loadMinimal.ts 0.00% <0.00%> (ø)
...graphql-transformer-core/src/TransformerContext.ts 25.09% <0.00%> (ø)
... and 12 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 250854c...8419e86. Read the comment docs.

@akshbhu akshbhu self-assigned this Nov 9, 2020
@akshbhu akshbhu added the pending-review Pending review from core-team label Nov 9, 2020
@akshbhu
Copy link
Contributor

akshbhu commented Jan 15, 2021

Thanks for the Contribution @chrisjprior.

It looks good to me to add necessary auth directives when the query argument is null in @model directive. I missed this case when I was trying to repro this issue #4874
I will ping this to one more member of the team to have a look and approve this.

Copy link
Contributor

@akshbhu akshbhu left a comment

Choose a reason for hiding this comment

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

LGTM!

@SwaySway SwaySway self-assigned this Jan 15, 2021
@jhockett jhockett removed the pending-review Pending review from core-team label Jan 20, 2021
@akshbhu akshbhu merged commit 52d33f8 into aws-amplify:master Jan 20, 2021
@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants