Skip to content

Commit aca2084

Browse files
committed
feat: Update databases
1 parent 9f0114c commit aca2084

File tree

1 file changed

+47
-4
lines changed

1 file changed

+47
-4
lines changed

ql/lib/codeql/bicep/frameworks/Microsoft/Databases.qll

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,46 @@ module Databases {
2222
*/
2323
DatabaseProperties::Properties getProperties() { result = this.getProperty("properties") }
2424

25+
/**
26+
* Returns the version property as a StringLiteral, if present.
27+
*/
28+
StringLiteral getVersion() {
29+
result = this.getProperties().getProperty("version")
30+
}
31+
2532
/**
2633
* Returns the version property of the database resource, if present.
2734
*/
2835
string version() {
29-
result = this.getProperties().getProperty("version").(StringLiteral).getValue()
36+
result = this.getVersion().getValue()
3037
}
3138

39+
/**
40+
* Returns the publicNetworkAccess property as a StringLiteral, if present.
41+
*/
42+
StringLiteral getPublicNetworkAccess() {
43+
result = this.getProperties().getProperty("publicNetworkAccess")
44+
}
45+
46+
/**
47+
* Returns the value of the publicNetworkAccess property, if present.
48+
*/
3249
string publicNetworkAccess() {
33-
result = this.getProperties().getProperty("publicNetworkAccess").(StringLiteral).getValue()
50+
result = this.getPublicNetworkAccess().getValue()
51+
}
52+
53+
/**
54+
* Returns the sslEnforcement property as a StringLiteral, if present.
55+
*/
56+
StringLiteral getSslEnforcement() {
57+
result = this.getProperties().getProperty("sslEnforcement")
3458
}
3559

3660
/**
3761
* Returns the sslEnforcement property of the database resource, if present.
3862
*/
3963
string sslEnforcement() {
40-
result = this.getProperties().getProperty("sslEnforcement").(StringLiteral).getValue()
64+
result = this.getSslEnforcement().getValue()
4165
}
4266

4367
/**
@@ -47,11 +71,18 @@ module Databases {
4771
result = this.getProperties().getProperty("infrastructureEncryption").(StringLiteral).getValue()
4872
}
4973

74+
/**
75+
* Returns the minimalTlsVersion property as a StringLiteral, if present.
76+
*/
77+
StringLiteral getMinimalTlsVersion() {
78+
result = this.getProperties().getProperty("minimalTlsVersion")
79+
}
80+
5081
/**
5182
* Returns the minimalTlsVersion property of the database resource, if present.
5283
*/
5384
string minimalTlsVersion() {
54-
result = this.getProperties().getProperty("minimalTlsVersion").(StringLiteral).getValue()
85+
result = this.getMinimalTlsVersion().getValue()
5586
}
5687

5788
/**
@@ -230,17 +261,29 @@ module Databases {
230261
class PublicDatabaseResource extends PublicResource {
231262
private DatabaseResource database;
232263

264+
/**
265+
* Constructs a PublicDatabaseResource if the database has public network access enabled.
266+
*/
233267
PublicDatabaseResource() {
234268
database.publicNetworkAccess() = "Enabled" and
235269
this = database
236270
}
237271

272+
/**
273+
* Returns the property that indicates public access for the database resource.
274+
*/
238275
override Expr getPublicAccessProperty() {
239276
result = database.getProperties().getProperty("publicNetworkAccess")
240277
}
241278
}
242279

280+
/**
281+
* Represents a database resource with a weak TLS version configuration.
282+
*/
243283
class WeakDatabaseTlsVersion extends Cryptography::WeakTlsVersion instanceof DatabaseResource {
284+
/**
285+
* Returns the minimalTlsVersion property as a StringLiteral for weak TLS version detection.
286+
*/
244287
override StringLiteral getWeakTlsVersionProperty() {
245288
result = DatabaseResource.super.getProperties().getProperty("minimalTlsVersion")
246289
}

0 commit comments

Comments
 (0)