From 777783171acfb77311bbc5836ee0d78d071dfd43 Mon Sep 17 00:00:00 2001 From: Maha Benzekri Date: Mon, 30 Oct 2023 09:36:56 +0100 Subject: [PATCH] ARSN-362: change new function name for clarity --- lib/policyEvaluator/evaluator.ts | 6 +++--- tests/unit/policyEvaluator.spec.js | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/policyEvaluator/evaluator.ts b/lib/policyEvaluator/evaluator.ts index 0d753fd6b..200816fa3 100644 --- a/lib/policyEvaluator/evaluator.ts +++ b/lib/policyEvaluator/evaluator.ts @@ -310,7 +310,7 @@ export function evaluatePolicy( } /** - * @deprecated Upgrade to evaluateAllPoliciesNew + * @deprecated Upgrade to standardEvaluateAllPolicies * Evaluate whether a request is permitted under a policy. * @param requestContext - Info necessary to * evaluate permission @@ -326,9 +326,9 @@ export function evaluateAllPolicies( allPolicies: any[], log: Logger, ): string { - return evaluateAllPoliciesNew(requestContext, allPolicies, log).verdict; + return standardEvaluateAllPolicies(requestContext, allPolicies, log).verdict; } -export function evaluateAllPoliciesNew( +export function standardEvaluateAllPolicies( requestContext: RequestContext, allPolicies: any[], log: Logger, diff --git a/tests/unit/policyEvaluator.spec.js b/tests/unit/policyEvaluator.spec.js index ef0f76d1e..33477c886 100644 --- a/tests/unit/policyEvaluator.spec.js +++ b/tests/unit/policyEvaluator.spec.js @@ -6,7 +6,7 @@ const fakeTimers = require('@sinonjs/fake-timers'); const evaluator = require('../../lib/policyEvaluator/evaluator'); const evaluatePolicy = evaluator.evaluatePolicy; const evaluateAllPolicies = evaluator.evaluateAllPolicies; -const evaluateAllPoliciesNew = evaluator.evaluateAllPoliciesNew; +const standardEvaluateAllPolicies = evaluator.standardEvaluateAllPolicies; const handleWildcards = require('../../lib/policyEvaluator/utils/wildcards').handleWildcards; const substituteVariables = @@ -1457,7 +1457,7 @@ describe('policyEvaluator', () => { 'my_favorite_bucket', undefined, undefined, undefined, 'bucketDelete', 's3'); requestContext.setRequesterInfo({}); - const result = evaluateAllPoliciesNew(requestContext, + const result = standardEvaluateAllPolicies(requestContext, [samples['arn:aws:iam::aws:policy/AmazonS3FullAccess'], samples['Deny Bucket Policy']], log); assert.deepStrictEqual(result, { @@ -1471,7 +1471,7 @@ describe('policyEvaluator', () => { 'notVeryPrivate', undefined, undefined, undefined, 'bucketDelete', 's3'); requestContext.setRequesterInfo({}); - const result = evaluateAllPoliciesNew(requestContext, + const result = standardEvaluateAllPolicies(requestContext, [samples['Multi-Statement Policy'], samples['Variable Bucket Policy']], log); assert.deepStrictEqual(result, { @@ -1485,7 +1485,7 @@ describe('policyEvaluator', () => { 'notbucket', undefined, undefined, undefined, 'objectGet', 's3'); requestContext.setRequesterInfo({}); - const result = evaluateAllPoliciesNew(requestContext, [ + const result = standardEvaluateAllPolicies(requestContext, [ samples['Multi-Statement Policy'], samples['Variable Bucket Policy'], ], log); @@ -1670,7 +1670,7 @@ describe('policyEvaluator', () => { 'my_favorite_bucket', undefined, undefined, undefined, 'objectGet', 's3'); requestContext.setRequesterInfo({}); - const result = evaluateAllPoliciesNew( + const result = standardEvaluateAllPolicies( requestContext, testCase.policiesToEvaluate.map(policyName => TestMatrixPolicies[policyName]), log);