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

Commit 80bbb4e

Browse files
committed
#33 Add $ attribute to hold special "helper" attributes
Like "hostOrIP"
1 parent fa551dd commit 80bbb4e

File tree

1 file changed

+11
-2
lines changed
  • hooks/declarative-subsequent-scans

1 file changed

+11
-2
lines changed

hooks/declarative-subsequent-scans/hook.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,20 @@ export function getCascadingScans(
8181
if (matches) {
8282
const { scanType, parameters } = cascadingRule.spec.scanSpec;
8383

84+
const templateArgs = {
85+
...finding,
86+
// Attribute "$" hold special non finding helper attributes
87+
$: {
88+
hostOrIP:
89+
finding.attributes["hostname"] || finding.attributes["ip_address"]
90+
}
91+
};
92+
8493
cascadingScans.push({
8594
name: generateCascadingScanName(parentScan, cascadingRule),
86-
scanType: Mustache.render(scanType, finding),
95+
scanType: Mustache.render(scanType, templateArgs),
8796
parameters: parameters.map(parameter =>
88-
Mustache.render(parameter, finding)
97+
Mustache.render(parameter, templateArgs)
8998
),
9099
cascades: null,
91100
generatedBy: cascadingRule.metadata.name

0 commit comments

Comments
 (0)