From 700a3de4f5a7893aa9cba2238be485dc2254e7a6 Mon Sep 17 00:00:00 2001 From: "mariano.pizarro" Date: Wed, 17 May 2023 11:01:16 -0300 Subject: [PATCH] fix(checks): Cannot read properties of undefined (reading 'direction') --- .../pci-dss-3.2.1/rules/pci-dss-3.2.1-networking-check-1.ts | 1 + .../pci-dss-3.2.1/tests/pci-dss-3.2.1-networking-checks.test.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/azure/pci-dss-3.2.1/rules/pci-dss-3.2.1-networking-check-1.ts b/src/azure/pci-dss-3.2.1/rules/pci-dss-3.2.1-networking-check-1.ts index 6a7b88be..1bee16ac 100644 --- a/src/azure/pci-dss-3.2.1/rules/pci-dss-3.2.1-networking-check-1.ts +++ b/src/azure/pci-dss-3.2.1/rules/pci-dss-3.2.1-networking-check-1.ts @@ -81,6 +81,7 @@ export default { ] return !rules.some((rule: any) => { return ( + rule && rule.direction === 'Inbound' && rule.access === 'Allow' && ['TCP', 'Tcp', '*'].includes(rule.protocol) && diff --git a/src/azure/pci-dss-3.2.1/tests/pci-dss-3.2.1-networking-checks.test.ts b/src/azure/pci-dss-3.2.1/tests/pci-dss-3.2.1-networking-checks.test.ts index 8472decc..190aaa09 100644 --- a/src/azure/pci-dss-3.2.1/tests/pci-dss-3.2.1-networking-checks.test.ts +++ b/src/azure/pci-dss-3.2.1/tests/pci-dss-3.2.1-networking-checks.test.ts @@ -102,6 +102,7 @@ describe('PCI Data Security Standard: 3.2.1', () => { destinationPortRanges: fromPort && toPort ? [`${fromPort}-${toPort}`] : [], }, + undefined as unknown as SecurityRule ], }, ],