Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Rename techniques to relevantTechniques #39

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ This way the following KQL query will be converted...

## Changelog

### 2.4.2
* FIX: Arm to YAML used `techniques` instead of `relevantTechniques`

### 2.4.1
* FIX: Handle error if `incidentConfiguration` section is missing from source YAML in `Convert-SentinelARYamlToArm` when using `-DisableIncidentCreation`

Expand Down
2 changes: 1 addition & 1 deletion src/SentinelARConverter.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'SentinelARConverter.psm1'

# Version number of this module.
ModuleVersion = '2.4.1'
ModuleVersion = '2.4.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
2 changes: 1 addition & 1 deletion src/public/Convert-SentinelARArmToYaml.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function Convert-SentinelARArmToYaml {
# We must merge all techniques since (relevant)techniques could contain values not preset in subTechniques
if ($PropertyName -like "*techniques") {
foreach ($value in $AnalyticsRule.$PropertyName) {
$KeyName = "techniques"
$KeyName = "relevantTechniques"
$technique = $value -replace "(T\d{4})\.\d{3}", '$1'
# Create an empty key
if ( -not $AnalyticsRuleCleaned.Contains($KeyName) ) {
Expand Down
5 changes: 2 additions & 3 deletions tests/Convert-SentinelARArmToYaml.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ Describe "Convert-SentinelARArmToYaml" {
}

BeforeEach {
$ARMTemplateContent = Get-Content -Path "TestDrive:/$ExampleFileName" -Raw
$ARMTemplateContent | Convert-SentinelARArmToYaml -OutFile $convertedExampleFilePath
Convert-SentinelARArmToYaml -Filename "TestDrive:/$ExampleFileName" -OutFile $convertedExampleFilePath
}

It "Properly converts the propertynames" {
Expand Down Expand Up @@ -589,7 +588,7 @@ Describe "Simple example tests" {
It "Merged RelevantTechniques, SubTechniques and Techniques into single property" {
$converted = Convert-SentinelARArmToYaml -Filename "TestDrive:/Content/TTPWithTacticsNTechniques.json" | ConvertFrom-Yaml
$converted.subTechniques | Should -Be $null
$converted.Techniques -join ", " | Should -Be "T1078.003, T1078.004"
$converted.RelevantTechniques -join ", " | Should -Be "T1078.003, T1078.004"
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions tests/examples/Scheduled.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
Expand Down Expand Up @@ -30,7 +29,9 @@
"tactics": [
"InitialAccess"
],
"techniques": [],
"techniques": [
"T1078"
],
"alertRuleTemplateName": "2de8abd6-a613-450e-95ed-08e503369fb3",
"incidentConfiguration": {
"createIncident": true,
Expand Down Expand Up @@ -71,4 +72,4 @@
}
}
]
}
}
Loading