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

Modify rule S6648: Add language AzureResourceManager (Bicep) #2277

Merged
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 docs/header_names/allowed_framework_names.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,6 @@
* CommonCrypto
* CryptoSwift
* IDZSwiftCommonCrypto
// Azure resource manager
* ARM templates
* Bicep
34 changes: 34 additions & 0 deletions rules/S6648/azureresourcemanager/how-to-fix-it/arm.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
== How to fix it in ARM templates

=== 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",
"parameters": {
"secretValue": {
"type": "securestring",
"defaultValue": "S3CR3T"
}
}
}
----

==== 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",
"parameters": {
"secretValue": {
"type": "securestring"
}
}
}
----
19 changes: 19 additions & 0 deletions rules/S6648/azureresourcemanager/how-to-fix-it/bicep.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
== How to fix it in Bicep

=== Code examples

==== Noncompliant code example

[source,bicep,diff-id=1,diff-type=noncompliant]
----
@secure()
param secureStringWithDefaultValue string = 'S3CR3T' // Noncompliant
----

==== Compliant solution

[source,bicep,diff-id=1,diff-type=compliant]
----
@secure()
param secureStringWithDefaultValue string
----
38 changes: 3 additions & 35 deletions rules/S6648/azureresourcemanager/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,9 @@ Secure parameters can be assigned a default value which will be used if the para

If the default value contains a secret, it will be disclosed to all accounts that have read access to the deployment history.

== How to fix it in ARM Templates

=== 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",
"parameters": {
"secretValue": {
"type": "securestring",
"defaultValue": "S3CR3T"
}
}
}
----

==== 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",
"parameters": {
"secretValue": {
"type": "securestring"
}
}
}
----
include::how-to-fix-it/arm.adoc[]

include::how-to-fix-it/bicep.adoc[]

== Resources
=== Documentation
Expand All @@ -70,4 +38,4 @@ ifdef::env-github,rspecator-view[]

The default value

endif::env-github,rspecator-view[]
endif::env-github,rspecator-view[]