-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONARIAC-1892 Modify rule S6975: Fix how to fix it section split (#4604)
- Loading branch information
Showing
28 changed files
with
282 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
== How to fix it in Bicep | ||
|
||
include::../../common/how-to-fix-it/intro.adoc[] | ||
|
||
=== Code examples | ||
|
||
==== Noncompliant code example | ||
|
||
[source,bicep,diff-id=2,diff-type=noncompliant] | ||
---- | ||
resource securityRules 'Microsoft.Network/networkSecurityGroups/securityRules@2022-11-01' = { | ||
name: 'securityRules' | ||
properties: { | ||
direction: 'Inbound' | ||
access: 'Allow' | ||
protocol: '*' | ||
destinationPortRange: '*' | ||
sourceAddressPrefix: '*' | ||
} | ||
} | ||
---- | ||
|
||
==== Compliant solution | ||
|
||
[source,bicep,diff-id=2,diff-type=compliant] | ||
---- | ||
resource securityRules 'Microsoft.Network/networkSecurityGroups/securityRules@2022-11-01' = { | ||
name: 'securityRules' | ||
properties: { | ||
direction: 'Inbound' | ||
access: 'Allow' | ||
protocol: '*' | ||
destinationPortRange: '22' | ||
sourceAddressPrefix: '10.0.0.0/24' | ||
} | ||
} | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
== How to fix it in JSON templates | ||
|
||
include::../../common/how-to-fix-it/intro.adoc[] | ||
|
||
=== Code examples | ||
|
||
==== Noncompliant code example | ||
|
||
[source,json,diff-id=1,diff-type=noncompliant] | ||
---- | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"resources": [ | ||
{ | ||
"name": "networkSecurityGroups/example", | ||
"type": "Microsoft.Network/networkSecurityGroups/securityRules", | ||
"apiVersion": "2022-11-01", | ||
"properties": { | ||
"protocol": "*", | ||
"destinationPortRange": "*", | ||
"sourceAddressPrefix": "*", | ||
"access": "Allow", | ||
"direction": "Inbound" | ||
} | ||
} | ||
] | ||
} | ||
---- | ||
|
||
==== Compliant solution | ||
|
||
[source,json,diff-id=1,diff-type=compliant] | ||
---- | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"resources": [ | ||
{ | ||
"name": "networkSecurityGroups/example", | ||
"type": "Microsoft.Network/networkSecurityGroups/securityRules", | ||
"apiVersion": "2022-11-01", | ||
"properties": { | ||
"protocol": "*", | ||
"destinationPortRange": "22", | ||
"sourceAddressPrefix": "10.0.0.0/24", | ||
"access": "Allow", | ||
"direction": "Inbound" | ||
} | ||
} | ||
] | ||
} | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
== How to fix it in Bicep | ||
|
||
include::../../common/fix/rationale.adoc[] | ||
|
||
=== Code examples | ||
|
||
==== Noncompliant code example | ||
|
||
[source,bicep,diff-id=2,diff-type=noncompliant] | ||
---- | ||
targetScope = 'managementGroup' | ||
resource roleDef 'Microsoft.Authorization/roleDefinitions@2022-04-01' = { // Sensitive | ||
properties: { | ||
permissions: [ | ||
{ | ||
actions: ['*'] | ||
notActions: [] | ||
} | ||
] | ||
assignableScopes: [ | ||
managementGroup().id | ||
] | ||
} | ||
} | ||
---- | ||
|
||
==== Compliant solution | ||
|
||
[source,bicep,diff-id=2,diff-type=compliant] | ||
---- | ||
targetScope = 'managementGroup' | ||
resource roleDef 'Microsoft.Authorization/roleDefinitions@2022-04-01' = { | ||
properties: { | ||
permissions: [ | ||
{ | ||
actions: ['Microsoft.Compute/*'] | ||
notActions: [] | ||
} | ||
] | ||
assignableScopes: [ | ||
managementGroup().id | ||
] | ||
} | ||
} | ||
---- | ||
|
||
include::../../common/fix/extra-mile.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ureresourcemanager/how-to-fix-it/arm.adoc → ...reresourcemanager/how-to-fix-it/json.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.