-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAKS.qll
More file actions
319 lines (260 loc) · 9.6 KB
/
AKS.qll
File metadata and controls
319 lines (260 loc) · 9.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
private import bicep
private import codeql.bicep.Concepts
module AKS {
/**
* Represents a Microsoft.ContainerService/managedClusters resource (AKS) in a Bicep file.
* See: https://learn.microsoft.com/en-us/azure/templates/microsoft.containerservice/managedclusters
*/
class ManagedContainerResource extends AzureResource {
/**
* Constructs a ManagedContainerResource for Microsoft.ContainerService/managedClusters resources.
*/
ManagedContainerResource() {
this.getResourceType().regexpMatch("^Microsoft.ContainerService/managedClusters@.*")
}
/**
* Returns the properties object for the AKS resource.
*/
ManagedContainerProperties::Properties getProperties() {
result = this.getProperty("properties")
}
/**
* Returns the kubernetesVersion property.
*/
StringLiteral getKubernetesVersion() { result = this.getProperties().getKubernetesVersion() }
/**
* Returns the dnsPrefix property.
*/
StringLiteral getDnsPrefix() { result = this.getProperties().getDnsPrefix() }
/**
* Returns the agentPoolProfiles property.
*/
ManagedContainerProperties::AgentPoolProfiles getAgentPoolProfiles() {
result = this.getProperties().getAgentPoolProfiles()
}
/**
* Returns the networkProfile property.
*/
Network::NetworkProfile getNetworkProfile() {
result = this.getProperties().getNetworkProfile()
}
override string toString() { result = "ManagedContainerResource" }
}
/**
* Module containing property classes for managed AKS (Azure Kubernetes Service) resources.
* Provides access to resource configuration, agent pools, network, API server, and addon profiles.
*/
module ManagedContainerProperties {
/**
* Represents the properties object for a Kubernetes (AKS) resource.
* Provides access to core configuration such as version, DNS prefix, agent pools, network, and more.
*/
class Properties extends ResourceProperties {
private ManagedContainerResource resource;
/**
* Constructs a Properties object for the given managed AKS resource.
*/
Properties() { this = resource.getProperty("properties") }
/**
* Gets the parent ManagedContainerResource.
*/
ManagedContainerResource getManagedContainerResource() { result = resource }
/**
* Gets the Kubernetes version property.
*/
StringLiteral getKubernetesVersion() { result = this.getProperty("kubernetesVersion") }
string kubernetesVersion() {
result = this.getKubernetesVersion().getValue()
}
/**
* Gets the DNS prefix property.
*/
StringLiteral getDnsPrefix() { result = this.getProperty("dnsPrefix") }
/**
* Gets the agent pool profiles for the cluster.
*/
AgentPoolProfiles getAgentPoolProfiles() {
result = this.getProperty("agentPoolProfiles").(Array).getElements()
}
/**
* Gets the network profile for the cluster.
*/
Network::NetworkProfile getNetworkProfile() { result = this.getProperty("networkProfile") }
/**
* Gets the API server access profile for the cluster.
*/
ApiServerAccessProfile getApiServerAccessProfile() {
result = this.getProperty("apiServerAccessProfile")
}
/**
* Gets the addon profiles for the cluster.
*/
AddonProfiles getAddonProfiles() { result = this.getProperty("addonProfiles") }
/**
* Gets the identity property for the cluster.
*/
Expr getIdentity() { result = this.getProperty("identity") }
/**
* Gets the Linux profile for the cluster.
*/
Expr getLinuxProfile() { result = this.getProperty("linuxProfile") }
/**
* Gets the Windows profile for the cluster.
*/
Expr getWindowsProfile() { result = this.getProperty("windowsProfile") }
/**
* Gets the service principal profile for the cluster.
*/
Expr getServicePrincipalProfile() { result = this.getProperty("servicePrincipalProfile") }
/**
* Gets the AAD profile for the cluster.
*/
Expr getAadProfile() { result = this.getProperty("aadProfile") }
/**
* Gets the auto scaler profile for the cluster.
*/
Expr getAutoScalerProfile() { result = this.getProperty("autoScalerProfile") }
/**
* Gets the HTTP proxy configuration for the cluster.
*/
Expr getHttpProxyConfig() { result = this.getProperty("httpProxyConfig") }
/**
* Gets the pod identity profile for the cluster.
*/
Expr getPodIdentityProfile() { result = this.getProperty("podIdentityProfile") }
/**
* Gets the workload auto scaler profile for the cluster.
*/
Expr getWorkloadAutoScalerProfile() { result = this.getProperty("workloadAutoScalerProfile") }
/**
* Gets the storage profile for the cluster.
*/
Expr getStorageProfile() { result = this.getProperty("storageProfile") }
/**
* Gets the tags for the cluster.
*/
Tags getTags() { result = this.getProperty("tags") }
override string toString() { result = "ManagedContainerProperties" }
}
/**
* Represents the agent pool profiles for a managed AKS cluster.
* Provides access to properties such as name, VM size, count, OS type, mode, autoscaling, and scaling limits.
*/
class AgentPoolProfiles extends Object {
private Properties properties;
/**
* Constructs an AgentPoolProfiles object for the given properties.
*/
AgentPoolProfiles() {
this = properties.getProperty("agentPoolProfiles").(Array).getElements()
}
/**
* Gets the name of the agent pool.
*/
StringLiteral getName() { result = this.getProperty("name") }
/**
* Gets the VM size for the agent pool.
*/
StringLiteral getVmSize() { result = this.getProperty("vmSize") }
/**
* Gets the node count for the agent pool.
*/
Number getCount() { result = this.getProperty("count") }
/**
* Gets the OS type for the agent pool.
*/
StringLiteral getOsType() { result = this.getProperty("osType") }
/**
* Gets the mode for the agent pool (e.g., System or User).
*/
StringLiteral getMode() { result = this.getProperty("mode") }
/**
* Gets whether autoscaling is enabled for the agent pool.
*/
Boolean getEnableAutoScaling() {
result = this.getProperty("enableAutoScaling")
}
/**
* Gets the minimum node count for autoscaling.
*/
Number getMinCount() { result = this.getProperty("minCount") }
/**
* Gets the maximum node count for autoscaling.
*/
Number getMaxCount() { result = this.getProperty("maxCount") }
string toString() { result = "AgentPoolProfiles" }
}
/**
* Represents the API server access profile for a managed AKS cluster.
* Provides access to properties such as enablePrivateCluster and privateDnsZone.
*/
class ApiServerAccessProfile extends Object {
private Properties properties;
/**
* Constructs an ApiServerAccessProfile object for the given properties.
*/
ApiServerAccessProfile() { this = properties.getProperty("apiServerAccessProfile") }
/**
* Gets the enablePrivateCluster property.
*/
Boolean getEnablePrivateCluster() { result = this.getProperty("enablePrivateCluster") }
boolean enablePrivateCluster() {
result = this.getEnablePrivateCluster().getBool()
}
/**
* Gets the privateDnsZone property.
*/
StringLiteral getPrivateDnsZone() { result = this.getProperty("privateDnsZone") }
string toString() { result = "ApiServerAccessProfile" }
}
/**
* Represents the addon profiles for a managed AKS cluster.
* Provides access to specific addons such as kubeDashboard and azurePolicy.
*/
class AddonProfiles extends Object {
private Properties properties;
/**
* Constructs an AddonProfiles object for the given properties.
*/
AddonProfiles() { this = properties.getProperty("addonProfiles") }
/**
* Gets the kubeDashboard addon profile.
*/
AddonKubeDashboard getKubeDashboard() { result = this.getProperty("kubeDashboard") }
string toString() { result = "AddonProfiles" }
}
/**
* Represents the kubeDashboard addon profile for a managed AKS cluster.
*/
class AddonKubeDashboard extends Object {
private AddonProfiles profiles;
/**
* Constructs an AddonKubeDashboard object for the given addon profiles.
*/
AddonKubeDashboard() { this = profiles.getProperty("kubeDashboard") }
/**
* Gets the enabled property for the kubeDashboard addon.
*/
Boolean getEnabled() { result = this.getProperty("enabled") }
boolean enabled() {
result = this.getEnabled().getBool()
}
string toString() { result = "AddonKubeDashboard" }
}
/**
* Represents the azurePolicy addon profile for a managed AKS cluster.
*/
class AddonAzurePolicy extends Object {
private AddonProfiles profiles;
/**
* Constructs an AddonAzurePolicy object for the given addon profiles.
*/
AddonAzurePolicy() { this = profiles.getProperty("azurePolicy") }
/**
* Gets the enabled property for the azurePolicy addon.
*/
Boolean getEnabled() { result = this.getProperty("enabled") }
string toString() { result = "AddonAzurePolicy" }
}
}
}