Skip to content

Commit 94369c4

Browse files
committed
feat: Improve Properties Resource
1 parent 67471b3 commit 94369c4

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ module Cache {
105105
*/
106106
RedisCacheResource getRedisCacheResource() { result = redisCache }
107107

108-
string toString() { result = "CacheProperties" }
108+
override string toString() { result = "CacheProperties[" + redisCache.getName() + "]" }
109109
}
110110

111111
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ module Compute {
8181
* Returns the OS profile object for the virtual machine.
8282
*/
8383
Compute::Profiles::OsProfile getOsProfile() { result = this.getProperty("osProfile") }
84+
85+
override string toString() {
86+
result = "VirtualMachinesProperties[" + virtualMachines.getName() + "]"
87+
}
8488
}
8589

8690
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ module Containers {
151151
*/
152152
StringLiteral getWorkloadProfileName() { result = this.getProperty("workloadProfileName") }
153153

154-
string toString() { result = "ContainerProperties" }
154+
override string toString() { result = "ContainerProperties" }
155155
}
156156

157157
/**

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ module Databases {
243243
override string databaseType() { result = "arc-sql-managed-instance" }
244244
}
245245

246-
class PublicDatabaseResource extends PublicResource {
246+
private class PublicDatabaseResource extends PublicResource {
247247
private DatabaseResource database;
248248

249249
/**
@@ -265,7 +265,7 @@ module Databases {
265265
/**
266266
* Represents a database resource with a weak TLS version configuration.
267267
*/
268-
class WeakDatabaseTlsVersion extends Cryptography::WeakTlsVersion instanceof DatabaseResource {
268+
private class WeakDatabaseTlsVersion extends Cryptography::WeakTlsVersion instanceof DatabaseResource {
269269
/**
270270
* Returns the minimalTlsVersion property as a StringLiteral for weak TLS version detection.
271271
*/
@@ -279,7 +279,7 @@ module Databases {
279279
* Represents the properties object for a database resource.
280280
*/
281281
class Properties extends ResourceProperties {
282-
private Resource resource;
282+
private DatabaseResource resource;
283283

284284
/**
285285
* Constructs a Properties object for the given resource.
@@ -290,6 +290,10 @@ module Databases {
290290
* Returns the underlying resource for these properties.
291291
*/
292292
Resource getResource() { result = resource }
293+
294+
override string toString() {
295+
result = "DatabaseProperties[" + resource.databaseType() + "]"
296+
}
293297
}
294298

295299
/**

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
private import bicep
22

3-
abstract class ResourceProperties extends Object {}
3+
abstract class ResourceProperties extends Object {
4+
string toString() {
5+
result = super.toString()
6+
}
7+
}
48

59
class Sku extends Object {
610
private Resource resource;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module KeyVault {
7070
* The properties object for the Microsoft.KeyVault/vaults type.
7171
* Provides access to Key Vault configuration and settings.
7272
*/
73-
class Properties extends Object {
73+
class Properties extends ResourceProperties {
7474
private VaultResource vaultResource;
7575

7676
/**
@@ -189,6 +189,10 @@ module KeyVault {
189189
AccessPolicy getAccessPolicy(int index) {
190190
result = this.getProperty("accessPolicies").(Array).getElement(index)
191191
}
192+
193+
override string toString() {
194+
result = "Key Vault Properties"
195+
}
192196
}
193197

194198
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ module ManagedContainers {
164164
*/
165165
Tags getTags() { result = this.getProperty("tags") }
166166

167-
string toString() { result = "ManagedContainerProperties" }
167+
override string toString() { result = "ManagedContainerProperties" }
168168
}
169169

170170
/**

0 commit comments

Comments
 (0)