Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit fc726be

Browse files
committed
Ensure annotations are defined before accessing it
1 parent c465dfb commit fc726be

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

hooks/declarative-subsequent-scans/hook.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ export function getCascadingScans(
5252
const cascadingRuleChain = new Set<string>();
5353

5454
// Get the current Scan Chain (meaning which CascadingRules were used to start this scan and its parents) and convert it to a set, which makes it easier to query.
55-
if (parentScan.metadata.annotations["cascading.securecodebox.io/chain"]) {
55+
if (
56+
parentScan.metadata.annotations &&
57+
parentScan.metadata.annotations["cascading.securecodebox.io/chain"]
58+
) {
5659
const chainElements = parentScan.metadata.annotations[
5760
"cascading.securecodebox.io/chain"
5861
].split(",");

hooks/declarative-subsequent-scans/scan-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function startSubsequentSecureCodeBoxScan({
6565
}) {
6666
let cascadingChain: Array<string> = [];
6767

68-
if (parentScan.metadata.annotations["cascading.securecodebox.io/chain"]) {
68+
if (parentScan.metadata.annotations && parentScan.metadata.annotations["cascading.securecodebox.io/chain"]) {
6969
cascadingChain = parentScan.metadata.annotations[
7070
"cascading.securecodebox.io/chain"
7171
].split(",");

0 commit comments

Comments
 (0)