Skip to content

Commit d27b7bf

Browse files
committed
fix: Update Web framework support
1 parent c3cfe7f commit d27b7bf

File tree

1 file changed

+72
-33
lines changed
  • ql/lib/codeql/bicep/frameworks/Microsoft

1 file changed

+72
-33
lines changed

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

Lines changed: 72 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module Web {
6363
/**
6464
* Returns the kind of App Service as a string.
6565
*/
66-
string kind() {
66+
string kind() {
6767
exists(StringLiteral kind | kind = this.getKind() and result = kind.getValue())
6868
}
6969

@@ -75,22 +75,17 @@ module Web {
7575
/**
7676
* Checks if the site is a regular web app.
7777
*/
78-
predicate isWebApp() {
78+
predicate isWebApp() {
7979
this.kind().regexpMatch(".*app.*") and
8080
not this.isFunctionApp()
8181
}
8282

83-
/**
84-
* Gets the HTTPS-only flag for the App Service.
85-
*/
86-
BooleanLiteral getHttpsOnly() { result = this.getProperty("httpsOnly") }
87-
8883
/**
8984
* Returns true if HTTPS-only setting is enabled.
9085
*/
9186
predicate isHttpsOnly() {
9287
exists(BooleanLiteral httpsOnly |
93-
httpsOnly = this.getHttpsOnly() and
88+
httpsOnly = this.getProperties().getHttpsOnly() and
9489
httpsOnly.getBool() = true
9590
)
9691
}
@@ -158,7 +153,9 @@ module Web {
158153
/**
159154
* Gets the keyVaultReferenceIdentity.
160155
*/
161-
StringLiteral getKeyVaultReferenceIdentity() { result = this.getProperty("keyVaultReferenceIdentity") }
156+
StringLiteral getKeyVaultReferenceIdentity() {
157+
result = this.getProperty("keyVaultReferenceIdentity")
158+
}
162159

163160
/**
164161
* Gets the redundancyMode.
@@ -168,7 +165,9 @@ module Web {
168165
/**
169166
* Gets the storageAccountRequired flag.
170167
*/
171-
BooleanLiteral getStorageAccountRequired() { result = this.getProperty("storageAccountRequired") }
168+
BooleanLiteral getStorageAccountRequired() {
169+
result = this.getProperty("storageAccountRequired")
170+
}
172171

173172
/**
174173
* Returns true if a storage account is required.
@@ -183,7 +182,9 @@ module Web {
183182
/**
184183
* Gets the virtualNetworkSubnetId.
185184
*/
186-
StringLiteral getVirtualNetworkSubnetId() { result = this.getProperty("virtualNetworkSubnetId") }
185+
StringLiteral getVirtualNetworkSubnetId() {
186+
result = this.getProperty("virtualNetworkSubnetId")
187+
}
187188

188189
override string toString() { result = "AppService[" + this.getIdentifier().getName() + "]" }
189190
}
@@ -296,7 +297,7 @@ module Web {
296297
*/
297298
string getParentSiteName() {
298299
// Parse from the resource name which is in the format "siteName/slotName"
299-
exists(string fullName |
300+
exists(string fullName |
300301
fullName = this.getName() and
301302
result = fullName.regexpCapture("([^/]+)/.*", 1)
302303
)
@@ -307,7 +308,7 @@ module Web {
307308
*/
308309
string getSlotName() {
309310
// Parse from the resource name which is in the format "siteName/slotName"
310-
exists(string fullName |
311+
exists(string fullName |
311312
fullName = this.getName() and
312313
result = fullName.regexpCapture("[^/]+/(.*)", 1)
313314
)
@@ -352,12 +353,16 @@ module Web {
352353
/**
353354
* Constructs a HostingEnvironmentsResource for Microsoft.Web/hostingEnvironments resources.
354355
*/
355-
HostingEnvironmentsResource() { this.getResourceType().regexpMatch("^Microsoft.Web/hostingEnvironments@.*") }
356+
HostingEnvironmentsResource() {
357+
this.getResourceType().regexpMatch("^Microsoft.Web/hostingEnvironments@.*")
358+
}
356359

357360
/**
358361
* Gets the properties object for the App Service Environment.
359362
*/
360-
HostingEnvironmentsProperties::Properties getProperties() { result = this.getProperty("properties") }
363+
HostingEnvironmentsProperties::Properties getProperties() {
364+
result = this.getProperty("properties")
365+
}
361366

362367
/**
363368
* Gets the kind of the App Service Environment.
@@ -369,7 +374,9 @@ module Web {
369374
*/
370375
string kind() { result = this.getKind().getValue() }
371376

372-
override string toString() { result = "AppServiceEnvironment[" + this.getIdentifier().getName() + "]" }
377+
override string toString() {
378+
result = "AppServiceEnvironment[" + this.getIdentifier().getName() + "]"
379+
}
373380
}
374381

375382
/**
@@ -400,17 +407,26 @@ module Web {
400407
/**
401408
* Gets the hostingEnvironmentProfile.
402409
*/
403-
Object getHostingEnvironmentProfile() { result = this.getProperty("hostingEnvironmentProfile") }
410+
Object getHostingEnvironmentProfile() {
411+
result = this.getProperty("hostingEnvironmentProfile")
412+
}
404413

405414
/**
406415
* Gets the public network access setting.
407416
*/
408417
StringLiteral getPublicNetworkAccess() { result = this.getProperty("publicNetworkAccess") }
409418

419+
/**
420+
* Gets the HTTPS-only flag for the App Service.
421+
*/
422+
BooleanLiteral getHttpsOnly() { result = this.getProperty("httpsOnly") }
423+
410424
/**
411425
* Gets the virtualNetworkSubnetId.
412426
*/
413-
StringLiteral getVirtualNetworkSubnetId() { result = this.getProperty("virtualNetworkSubnetId") }
427+
StringLiteral getVirtualNetworkSubnetId() {
428+
result = this.getProperty("virtualNetworkSubnetId")
429+
}
414430

415431
/**
416432
* Gets the enabled value.
@@ -431,7 +447,7 @@ module Web {
431447
* Gets the client certificate mode.
432448
*/
433449
StringLiteral getClientCertMode() { result = this.getProperty("clientCertMode") }
434-
450+
435451
/**
436452
* Returns true if client certificate is required.
437453
*/
@@ -445,7 +461,9 @@ module Web {
445461
/**
446462
* Gets the client certificate exclusion paths.
447463
*/
448-
StringLiteral getClientCertExclusionPaths() { result = this.getProperty("clientCertExclusionPaths") }
464+
StringLiteral getClientCertExclusionPaths() {
465+
result = this.getProperty("clientCertExclusionPaths")
466+
}
449467

450468
/**
451469
* Gets the container size.
@@ -455,7 +473,9 @@ module Web {
455473
/**
456474
* Gets the custom domain verification ID.
457475
*/
458-
StringLiteral getCustomDomainVerificationId() { result = this.getProperty("customDomainVerificationId") }
476+
StringLiteral getCustomDomainVerificationId() {
477+
result = this.getProperty("customDomainVerificationId")
478+
}
459479

460480
/**
461481
* Gets the daily memory time quota.
@@ -509,7 +529,9 @@ module Web {
509529
/**
510530
* Gets whether remote debugging is enabled.
511531
*/
512-
BooleanLiteral getRemoteDebuggingEnabled() { result = this.getProperty("remoteDebuggingEnabled") }
532+
BooleanLiteral getRemoteDebuggingEnabled() {
533+
result = this.getProperty("remoteDebuggingEnabled")
534+
}
513535

514536
/**
515537
* Returns true if remote debugging is enabled.
@@ -524,7 +546,9 @@ module Web {
524546
/**
525547
* Gets the remote debugging version.
526548
*/
527-
StringLiteral getRemoteDebuggingVersion() { result = this.getProperty("remoteDebuggingVersion") }
549+
StringLiteral getRemoteDebuggingVersion() {
550+
result = this.getProperty("remoteDebuggingVersion")
551+
}
528552

529553
/**
530554
* Gets whether HTTP 2.0 is enabled.
@@ -546,6 +570,11 @@ module Web {
546570
*/
547571
BooleanLiteral getAlwaysOn() { result = this.getProperty("alwaysOn") }
548572

573+
/**
574+
* Returns the Always On setting as a boolean.
575+
*/
576+
boolean alwaysOn() { result = this.getAlwaysOn().getBool() }
577+
549578
/**
550579
* Returns true if Always On is enabled.
551580
*/
@@ -657,9 +686,7 @@ module Web {
657686
/**
658687
* Gets a certificate by index.
659688
*/
660-
Object getCertificate(int index) {
661-
result = this.getElement(index)
662-
}
689+
Object getCertificate(int index) { result = this.getElement(index) }
663690

664691
string toString() { result = "HttpsCertificates" }
665692
}
@@ -728,12 +755,16 @@ module Web {
728755
/**
729756
* Gets the staging environment policy.
730757
*/
731-
StringLiteral getStagingEnvironmentPolicy() { result = this.getProperty("stagingEnvironmentPolicy") }
758+
StringLiteral getStagingEnvironmentPolicy() {
759+
result = this.getProperty("stagingEnvironmentPolicy")
760+
}
732761

733762
/**
734763
* Gets whether private endpoint connections are allowed.
735764
*/
736-
BooleanLiteral getAllowConfigFileUpdates() { result = this.getProperty("allowConfigFileUpdates") }
765+
BooleanLiteral getAllowConfigFileUpdates() {
766+
result = this.getProperty("allowConfigFileUpdates")
767+
}
737768

738769
/**
739770
* Returns true if config file updates are allowed.
@@ -763,7 +794,9 @@ module Web {
763794
/**
764795
* Gets whether private endpoint connections are allowed.
765796
*/
766-
BooleanLiteral getAllowPrivateEndpoints() { result = this.getProperty("allowPrivateEndpoints") }
797+
BooleanLiteral getAllowPrivateEndpoints() {
798+
result = this.getProperty("allowPrivateEndpoints")
799+
}
767800

768801
/**
769802
* Returns true if private endpoints are allowed.
@@ -817,7 +850,9 @@ module Web {
817850
/**
818851
* Gets the internal load balancing mode.
819852
*/
820-
StringLiteral getInternalLoadBalancingMode() { result = this.getProperty("internalLoadBalancingMode") }
853+
StringLiteral getInternalLoadBalancingMode() {
854+
result = this.getProperty("internalLoadBalancingMode")
855+
}
821856

822857
/**
823858
* Gets the cluster settings.
@@ -827,7 +862,9 @@ module Web {
827862
/**
828863
* Gets the virtual network configuration.
829864
*/
830-
VnetConfiguration getVirtualNetworkProfile() { result = this.getProperty("virtualNetworkProfile") }
865+
VnetConfiguration getVirtualNetworkProfile() {
866+
result = this.getProperty("virtualNetworkProfile")
867+
}
831868

832869
override string toString() { result = "HostingEnvironmentProperties" }
833870
}
@@ -960,7 +997,9 @@ module Web {
960997
/**
961998
* Gets the maximum number of workers.
962999
*/
963-
Number getMaximumElasticWorkerCount() { result = this.getProperty("maximumElasticWorkerCount") }
1000+
Number getMaximumElasticWorkerCount() {
1001+
result = this.getProperty("maximumElasticWorkerCount")
1002+
}
9641003

9651004
/**
9661005
* Returns the maximum number of workers as an integer.
@@ -970,4 +1009,4 @@ module Web {
9701009
override string toString() { result = "ServerFarmProperties" }
9711010
}
9721011
}
973-
}
1012+
}

0 commit comments

Comments
 (0)