Skip to content

Commit 1c12963

Browse files
committed
feat(query): Add queries
1 parent 7292962 commit 1c12963

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# TLS Disabled
2+
3+
Disabling TLS (Transport Layer Security) exposes resources to unencrypted network traffic, making them vulnerable to interception and attacks. Always ensure TLS is enabled for all network-accessible resources.
4+
5+
## Bad Example
6+
The following Bicep resource has `enableNonSslPort` set to `true`, which disables TLS and allows unencrypted connections:
7+
8+
```bicep
9+
resource redis 'Microsoft.Cache/Redis@2021-06-01' = {
10+
name: 'myredis'
11+
location: 'eastus'
12+
properties: {
13+
enableNonSslPort: true
14+
publicNetworkAccess: 'Enabled'
15+
}
16+
}
17+
```
18+
19+
## Good Example
20+
The following Bicep resources either do not set `enableNonSslPort` (defaulting to secure) or explicitly set it to `false`, ensuring TLS is enforced:
21+
22+
```bicep
23+
// TLS enforced by default (property not set)
24+
resource redis1 'Microsoft.Cache/Redis@2021-06-01' = {
25+
name: 'redis1'
26+
location: 'eastus'
27+
properties: {
28+
publicNetworkAccess: 'Enabled'
29+
}
30+
}
31+
32+
// TLS explicitly enforced
33+
resource redis2 'Microsoft.Cache/Redis@2021-06-01' = {
34+
name: 'redis2'
35+
location: 'eastus'
36+
properties: {
37+
enableNonSslPort: false
38+
publicNetworkAccess: 'Enabled'
39+
}
40+
}
41+
```
42+
43+
## Recommendation
44+
Always leave `enableNonSslPort` unset or set it to `false` to ensure all connections are encrypted using TLS.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @name TLS Disabled
3+
* @description Detects resources where TLS is disabled, which is insecure.
4+
* @kind problem
5+
* @problem.severity error
6+
* @security-severity 8.5
7+
* @precision high
8+
* @id bicep/tls-disabled
9+
* @tags security
10+
* bicep
11+
* azure
12+
* cryptography
13+
*/
14+
import bicep
15+
16+
from Cryptography::TlsDisabled resource
17+
where resource.isTlsDisabled() = true
18+
select resource, "TLS is disabled for this resource"

0 commit comments

Comments
 (0)