@@ -18,12 +18,13 @@ describe('PCI Data Security Standard: 3.2.1', () => {
1818 } )
1919
2020 describe ( 'IAM Check 1: IAM root user access key should not exist' , ( ) => {
21- test ( 'Should fail when it finds a user called root ' , async ( ) => {
21+ test ( 'Should fail when root account has at least one access key active ' , async ( ) => {
2222 const data = {
2323 queryawsIamUser : [
2424 {
2525 id : cuid ( ) ,
2626 name : 'root' ,
27+ accessKeysActive : true ,
2728 } ,
2829 ] ,
2930 }
@@ -36,12 +37,13 @@ describe('PCI Data Security Standard: 3.2.1', () => {
3637 expect ( processedRule . result ) . toBe ( Result . FAIL )
3738 } )
3839
39- test ( 'Should pass when it does not find a user called root ' , async ( ) => {
40+ test ( 'Should pass when a root account does not have any access key active ' , async ( ) => {
4041 const data = {
4142 queryawsIamUser : [
4243 {
4344 id : cuid ( ) ,
44- name : 'user' ,
45+ name : 'root' ,
46+ accessKeysActive : false ,
4547 } ,
4648 ] ,
4749 }
@@ -101,6 +103,7 @@ describe('PCI Data Security Standard: 3.2.1', () => {
101103 queryawsIamPolicy : [
102104 {
103105 id : cuid ( ) ,
106+ name : 'AdministratorAccess-Amplify' ,
104107 policyContent : {
105108 statement : [
106109 {
@@ -131,6 +134,7 @@ describe('PCI Data Security Standard: 3.2.1', () => {
131134 queryawsIamPolicy : [
132135 {
133136 id : cuid ( ) ,
137+ name : 'AdministratorAccess-Amplify' ,
134138 policyContent : {
135139 statement : [
136140 {
@@ -157,6 +161,7 @@ describe('PCI Data Security Standard: 3.2.1', () => {
157161 queryawsIamPolicy : [
158162 {
159163 id : cuid ( ) ,
164+ name : 'AdministratorAccess-Amplify' ,
160165 policyContent : {
161166 statement : [
162167 {
@@ -187,6 +192,7 @@ describe('PCI Data Security Standard: 3.2.1', () => {
187192 queryawsIamPolicy : [
188193 {
189194 id : cuid ( ) ,
195+ name : 'AdministratorAccess-Amplify' ,
190196 policyContent : {
191197 statement : [
192198 {
@@ -207,6 +213,33 @@ describe('PCI Data Security Standard: 3.2.1', () => {
207213
208214 expect ( processedRule . result ) . toBe ( Result . FAIL )
209215 } )
216+
217+ test ( 'Should pass when IAM policies that allow full "*:*" administrative privileges for AdministratorAccess policy' , async ( ) => {
218+ const data = {
219+ queryawsIamPolicy : [
220+ {
221+ id : cuid ( ) ,
222+ name : 'AdministratorAccess' ,
223+ policyContent : {
224+ statement : [
225+ {
226+ effect : 'Allow' ,
227+ action : [ '*' ] ,
228+ resource : [ '*' ] ,
229+ } ,
230+ ] ,
231+ } ,
232+ } ,
233+ ] ,
234+ }
235+
236+ const [ processedRule ] = await rulesEngine . processRule (
237+ Aws_PCI_DSS_321_IAM_3 as Rule ,
238+ { ...data } as any
239+ )
240+
241+ expect ( processedRule . result ) . toBe ( Result . PASS )
242+ } )
210243 } )
211244
212245 describe ( 'IAM Check 4: Hardware MFA should be enabled for the root user' , ( ) => {
0 commit comments