Skip to content

Commit 4bf262f

Browse files
authored
Merge pull request #2 from GitHubSecurityLab/framework-docs
feat: Update framework docs
2 parents ce3e8be + 5888c01 commit 4bf262f

File tree

5 files changed

+177
-25
lines changed

5 files changed

+177
-25
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
--pattern 'extractor-bicep.tar.gz'
4747
4848
tar -zxf extractor-bicep.tar.gz
49+
chmod +x extractor-pack/tools/*.sh
50+
chmod +x extractor-pack/tools/**/*
4951
5052
- name: "Set up Rust"
5153
uses: dtolnay/rust-toolchain@nightly

.github/workflows/self-action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: "CodeQL Bicep Extractor"
33
on:
44
push:
55
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
86
workflow_dispatch:
97

108
jobs:

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

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,126 +4,212 @@ private import bicep
44
* A resource of type Microsoft.Compute/virtualMachines
55
*/
66
module Compute {
7+
/**
8+
* Represents a generic Microsoft.Compute resource.
9+
* Matches any resource of type Microsoft.Compute/*.
10+
*/
711
class ComputeResource extends Resource {
12+
/**
13+
* Constructs a ComputeResource for any Microsoft.Compute resource type.
14+
*/
815
ComputeResource() { this.getResourceType().regexpMatch("^Microsoft.Compute/.*") }
916
}
1017

1118
/**
12-
* A resource of type Microsoft.Compute/virtualMachines
13-
* https://learn.microsoft.com/en-us/azure/templates/microsoft.compute/virtualmachines
19+
* Represents a Microsoft.Compute/virtualMachines resource.
20+
* See: https://learn.microsoft.com/en-us/azure/templates/microsoft.compute/virtualmachines
1421
*/
1522
class VirtualMachines extends ComputeResource {
23+
/**
24+
* Constructs a VirtualMachines resource.
25+
*/
1626
VirtualMachines() {
1727
this.getResourceType().regexpMatch("^Microsoft.Compute/virtualMachines@.*")
1828
}
1929

30+
/**
31+
* Returns a string representation of the VirtualMachines resource.
32+
*/
2033
override string toString() { result = "VirtualMachines Resource" }
2134

35+
/**
36+
* Returns the properties object for this virtual machine.
37+
*/
2238
VirtualMachinesProperties::Properties getProperties() {
2339
result = this.getProperty("properties")
2440
}
2541

2642
/**
27-
* The the hardware network interfaces of the virtual machine
43+
* Returns the hardware network interfaces of the virtual machine.
2844
*/
2945
Network::NetworkInterfaces getNetworkInterfaces() {
3046
result = this.getProperties().getNetworkProfile().getNetworkInterfaces()
3147
}
3248
}
3349

3450
/**
35-
* The properties module for Microsoft.Compute/virtualMachines
51+
* The properties module for Microsoft.Compute/virtualMachines resources.
3652
*/
3753
module VirtualMachinesProperties {
3854
/**
39-
* The properties object for the Microsoft.Compute/virtualMachines type
55+
* The properties object for the Microsoft.Compute/virtualMachines type.
4056
*/
4157
class Properties extends Object {
4258
private VirtualMachines virtualMachines;
4359

60+
/**
61+
* Constructs a Properties object for the given virtual machine.
62+
*/
4463
Properties() { this = virtualMachines.getProperty("properties") }
4564

65+
/**
66+
* Returns the parent VirtualMachines resource.
67+
*/
4668
VirtualMachines getVirtualMachine() { result = virtualMachines }
4769

70+
/**
71+
* Returns the hardware profile object for the virtual machine.
72+
*/
4873
HardwareProfile getHardwareProfile() { result = this.getProperty("hardwareProfile") }
4974

75+
/**
76+
* Returns the network profile object for the virtual machine.
77+
*/
5078
NetworkProfile getNetworkProfile() { result = this.getProperty("networkProfile") }
5179

80+
/**
81+
* Returns the OS profile object for the virtual machine.
82+
*/
5283
OsProfile getOsProfile() { result = this.getProperty("osProfile") }
5384
}
5485

5586
/**
56-
* The hardwareProfile property object for the Microsoft.Compute/virtualMachines type
87+
* The hardwareProfile property object for the Microsoft.Compute/virtualMachines type.
5788
*/
5889
class HardwareProfile extends Object {
5990
private Properties properties;
6091

92+
/**
93+
* Constructs a HardwareProfile object for the given properties.
94+
*/
6195
HardwareProfile() { this = properties.getProperty("hardwareProfile") }
6296

97+
/**
98+
* Returns a string representation of the hardware profile.
99+
*/
63100
string toString() { result = "HardwareProfile" }
64101

102+
/**
103+
* Returns the vmSize property of the hardware profile.
104+
*/
65105
Expr getVmSize() { result = this.getProperty("vmSize") }
66106
}
67107

68108
/**
69-
* A NetworkProfile for the Microsoft.Compute/virtualMachines type
109+
* Represents a network profile for the Microsoft.Compute/virtualMachines type.
70110
*/
71111
class NetworkProfile extends Object {
72112
private Properties properties;
73113

114+
/**
115+
* Constructs a NetworkProfile object for the given properties.
116+
*/
74117
NetworkProfile() { this = properties.getProperty("networkProfile") }
75118

119+
/**
120+
* Returns a string representation of the network profile.
121+
*/
76122
string toString() { result = "NetworkProfile" }
77123

124+
/**
125+
* Returns the network interfaces for the virtual machine.
126+
*/
78127
Network::NetworkInterfaces getNetworkInterfaces() {
79128
result = resolveResource(this.getNetworkInterfacesObject())
80129
}
81130

131+
/**
132+
* Returns the networkInterfaces property as an object array.
133+
*/
82134
private Object getNetworkInterfacesObject() {
83135
result = this.getProperty("networkInterfaces").(Array).getElements()
84136
}
85137
}
86138

87139
/**
140+
* Represents the storage profile for the Microsoft.Compute/virtualMachines type.
88141
*/
89142
class StorageProfile extends Object {
90143
private Properties properties;
91144

145+
/**
146+
* Constructs a StorageProfile object for the given properties.
147+
*/
92148
StorageProfile() { this = properties.getProperty("storageProfile") }
93149

150+
/**
151+
* Returns the image reference for the storage profile.
152+
*/
94153
ImageReference getImageReference() { result = this.getProperty("imageReference") }
95154
}
96155

97156
/**
98-
* A ImageReference for the Microsoft.Compute/virtualMachines type
99-
* https://learn.microsoft.com/en-us/azure/templates/microsoft.compute/virtualmachines?pivots=deployment-language-bicep#imagereference
157+
* Represents an image reference for the Microsoft.Compute/virtualMachines type.
158+
* See: https://learn.microsoft.com/en-us/azure/templates/microsoft.compute/virtualmachines?pivots=deployment-language-bicep#imagereference
100159
*/
101160
class ImageReference extends Object {
102161
private StorageProfile storageProfile;
103162

163+
/**
164+
* Constructs an ImageReference object for the given storage profile.
165+
*/
104166
ImageReference() { this = storageProfile.getProperty("imageReference") }
105167

168+
/**
169+
* Returns the publisher property of the image reference.
170+
*/
106171
Expr getPublisher() { result = this.getProperty("publisher") }
107172

173+
/**
174+
* Returns the offer property of the image reference.
175+
*/
108176
Expr getOffer() { result = this.getProperty("offer") }
109177

178+
/**
179+
* Returns the sku property of the image reference.
180+
*/
110181
Expr getSku() { result = this.getProperty("sku") }
111182

183+
/**
184+
* Returns the version property of the image reference.
185+
*/
112186
Expr getVersion() { result = this.getProperty("version") }
113187
}
114188

115189
/**
116-
* The OsProfile object for the Microsoft.Compute/virtualMachines type
190+
* Represents the OS profile for the Microsoft.Compute/virtualMachines type.
117191
*/
118192
class OsProfile extends Object {
119193
private Properties properties;
120194

195+
/**
196+
* Constructs an OsProfile object for the given properties.
197+
*/
121198
OsProfile() { this = properties.getProperty("osProfile") }
122199

200+
/**
201+
* Returns the computerName property of the OS profile.
202+
*/
123203
Expr getComputerName() { result = this.getProperty("computerName") }
124204

205+
/**
206+
* Returns the adminUsername property of the OS profile.
207+
*/
125208
Expr getAdminUsername() { result = this.getProperty("adminUsername") }
126209

210+
/**
211+
* Returns the adminPassword property of the OS profile.
212+
*/
127213
Expr getAdminPassword() { result = this.getProperty("adminPassword") }
128214
}
129215
}

0 commit comments

Comments
 (0)