diff --git a/CHANGELOG.md b/CHANGELOG.md index cb4f956..1a1e73e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Remove get permissions from access audit metrics + ## [2.4.0] - 2023-11-07 ### Added diff --git a/node/resolvers/directives/auditAccess.ts b/node/resolvers/directives/auditAccess.ts index 082494b..f0c4d63 100644 --- a/node/resolvers/directives/auditAccess.ts +++ b/node/resolvers/directives/auditAccess.ts @@ -2,7 +2,6 @@ import type { GraphQLField } from 'graphql' import { defaultFieldResolver } from 'graphql' import { SchemaDirectiveVisitor } from 'graphql-tools' -import type StorefrontPermissions from '../../clients/storefrontPermissions' import sendAuthMetric, { AuthMetric } from '../../metrics/auth' export class AuditAccess extends SchemaDirectiveVisitor { @@ -23,7 +22,6 @@ export class AuditAccess extends SchemaDirectiveVisitor { private async sendAuthMetric(field: GraphQLField, context: any) { const { - clients: { storefrontPermissions }, vtex: { adminUserAuthToken, storeUserAuthToken, account, logger }, request, } = context @@ -43,18 +41,6 @@ export class AuditAccess extends SchemaDirectiveVisitor { const hasStoreToken = !!storeUserAuthToken const hasApiToken = !!request.headers['vtex-api-apptoken'] - let role - let permissions - - if (hasAdminToken || hasStoreToken) { - const userPermissions = await this.getUserPermission( - storefrontPermissions - ) - - role = userPermissions?.role?.slug - permissions = userPermissions?.permissions - } - const authMetric = new AuthMetric(account, { caller, forwardedHost, @@ -62,18 +48,8 @@ export class AuditAccess extends SchemaDirectiveVisitor { hasApiToken, hasStoreToken, operation, - permissions, - role, }) await sendAuthMetric(logger, authMetric) } - - private async getUserPermission( - storefrontPermissions: StorefrontPermissions - ) { - const result = await storefrontPermissions.checkUserPermission() - - return result?.data?.checkUserPermission ?? null - } }