Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-amplify/graphql-auth-transformer

Package Overview
Dependencies
Maintainers
7
Versions
434
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/graphql-auth-transformer - npm Package Compare versions

Comparing version 0.2.0-ext16.0 to 0.2.0-ext17.0

4

CHANGELOG.md

@@ -6,3 +6,3 @@ # Change Log

# 0.2.0-ext16.0 (2021-11-08)
# 0.2.0-ext17.0 (2021-11-09)

@@ -17,2 +17,3 @@

* add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
* allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
* auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))

@@ -22,2 +23,3 @@ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))

* **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
* searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
* update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))

@@ -24,0 +26,0 @@

@@ -10,2 +10,3 @@ declare type ACMConfig = {

resource?: string;
allowRoleOverwrite?: boolean;
};

@@ -21,2 +22,3 @@ export declare class AccessControlMatrix {

hasRole(role: string): boolean;
getName(): string;
getRoles(): Array<string>;

@@ -23,0 +25,0 @@ getResources(): Readonly<Array<string>>;

@@ -18,3 +18,3 @@ "use strict";

setRole(input) {
const { role, resource, operations } = input;
const { role, resource, operations, allowRoleOverwrite = false } = input;
this.validate({ resource, operations });

@@ -28,3 +28,3 @@ let allowedVector;

}
else if (this.roles.includes(role) && resource) {
else if (this.roles.includes(role) && (resource || allowRoleOverwrite)) {
allowedVector = this.getResourceOperationMatrix({ operations, resource, role });

@@ -41,2 +41,5 @@ const roleIndex = this.roles.indexOf(role);

}
getName() {
return this.name;
}
getRoles() {

@@ -43,0 +46,0 @@ return this.roles;

@@ -52,2 +52,6 @@ "use strict";

const typeName = def.name.value;
let isJoinType = false;
if (context.metadata.has('joinTypeList')) {
isJoinType = context.metadata.get('joinTypeList').includes(typeName);
}
const authDir = new graphql_transformer_core_1.DirectiveWrapper(directive);

@@ -65,3 +69,3 @@ const rules = authDir.getArguments({ rules: [] }).rules;

this.addTypeToResourceReferences(def.name.value, rules);
this.convertRulesToRoles(acm, rules);
this.convertRulesToRoles(acm, rules, isJoinType);
this.modelDirectiveConfig.set(typeName, utils_1.getModelConfig(modelDirective, typeName, context.isProjectUsingDataStore()));

@@ -107,3 +111,3 @@ this.authModelConfig.set(typeName, acm);

}
this.convertRulesToRoles(acm, rules, fieldName);
this.convertRulesToRoles(acm, rules, false, fieldName);
this.authModelConfig.set(typeName, acm);

@@ -119,3 +123,3 @@ }

});
this.convertRulesToRoles(acm, staticRules, typeFieldName, ['read']);
this.convertRulesToRoles(acm, staticRules, false, typeFieldName, ['read']);
this.authNonModelConfig.set(typeFieldName, acm);

@@ -372,5 +376,6 @@ }

const modelFields = (_a = def.fields) !== null && _a !== void 0 ? _a : [];
const name = acm.getName();
const allowedAggFields = modelFields.map(f => f.name.value).filter(f => !acmFields.includes(f));
let leastAllowedFields = acmFields;
const resolver = ctx.resolvers.getResolver(typeName, fieldName);
const resolver = ctx.resolvers.getResolver('Search', graphql_transformer_common_2.toUpper(name));
const readRoleDefinitions = acm.getRolesPerOperation('read').map(role => {

@@ -468,3 +473,3 @@ const allowedFields = acmFields.filter(resource => acm.isAllowed(role, resource, 'read'));

}
convertRulesToRoles(acm, authRules, field, overideOperations) {
convertRulesToRoles(acm, authRules, allowRoleOverwrite, field, overideOperations) {
for (let rule of authRules) {

@@ -485,3 +490,3 @@ let operations = overideOperations ? overideOperations : rule.operations || utils_1.MODEL_OPERATIONS;

}
acm.setRole({ role: roleName, resource: field, operations });
acm.setRole({ role: roleName, resource: field, operations, allowRoleOverwrite });
});

@@ -554,3 +559,3 @@ }

}
acm.setRole({ role: roleName, resource: field, operations });
acm.setRole({ role: roleName, resource: field, operations, allowRoleOverwrite });
}

@@ -557,0 +562,0 @@ }

{
"name": "@aws-amplify/graphql-auth-transformer",
"version": "0.2.0-ext16.0",
"version": "0.2.0-ext17.0",
"description": "Amplify GraphQL @auth Transformer",

@@ -30,5 +30,5 @@ "repository": {

"dependencies": {
"@aws-amplify/graphql-model-transformer": "0.7.0-ext16.0",
"@aws-amplify/graphql-transformer-core": "0.10.0-ext16.0",
"@aws-amplify/graphql-transformer-interfaces": "1.10.1-ext16.0",
"@aws-amplify/graphql-model-transformer": "0.7.0-ext17.0",
"@aws-amplify/graphql-transformer-core": "0.10.0-ext17.0",
"@aws-amplify/graphql-transformer-interfaces": "1.10.1-ext17.0",
"@aws-cdk/aws-appsync": "~1.124.0",

@@ -40,9 +40,9 @@ "@aws-cdk/aws-dynamodb": "~1.124.0",

"graphql": "^14.5.8",
"graphql-mapping-template": "4.18.4-ext16.0",
"graphql-transformer-common": "4.20.0-ext16.0",
"graphql-mapping-template": "4.18.4-ext17.0",
"graphql-transformer-common": "4.20.0-ext17.0",
"lodash": "^4.17.21"
},
"devDependencies": {
"@aws-amplify/graphql-index-transformer": "0.5.0-ext16.0",
"@aws-amplify/graphql-searchable-transformer": "0.7.0-ext16.0",
"@aws-amplify/graphql-index-transformer": "0.5.0-ext17.0",
"@aws-amplify/graphql-searchable-transformer": "0.7.0-ext17.0",
"@aws-cdk/assert": "~1.124.0",

@@ -68,3 +68,3 @@ "@types/fs-extra": "^8.0.1",

},
"gitHead": "a0fa3ff4dd6728fea3927918c55ee65b4b0f171b"
"gitHead": "e4ad558753965dc40afe462d0cf9abd5d6271734"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc