Skip to content

Commit

Permalink
Add additional validation of TTPs to core code
Browse files Browse the repository at this point in the history
  • Loading branch information
f-bader committed Nov 17, 2023
1 parent 419e2e6 commit 0c8ca61
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/public/Convert-SentinelARYamlToArm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,21 @@ function Convert-SentinelARYamlToArm {
}
}

# Remove any subtechniques from the techniques array
if ($ARMTemplate.techniques) {
$ARMTemplate.techniques = $ARMTemplate.techniques -replace "(T\d{4})\.\d{3}", '$1'
}

# Remove any invalid or non-existent techniques from the techniques array
if ($ARMTemplate.techniques) {
$ARMTemplate.techniques = $ARMTemplate.techniques | Where-Object { Test-MITRETechnique $_ }
}

# Remove any invalid or non-existent tactics from the tactics array
if ($ARMTemplate.tactics) {
$ARMTemplate.tactics = $ARMTemplate.tactics | Where-Object { Test-MITRETactic $_ }
}

# Convert hashtable to JSON
$JSON = $ARMTemplate | ConvertTo-Json -Depth 99
# Use ISO8601 format for timespan values
Expand Down

0 comments on commit 0c8ca61

Please sign in to comment.