Csharp: rename predicate

This commit is contained in:
Paolo Tranquilli
2025-10-21 11:47:21 +02:00
parent 6f8b1f6f4c
commit 316225bb88
2 changed files with 4 additions and 4 deletions

View File

@@ -16,12 +16,12 @@ import csharp
import semmle.code.asp.WebConfig
import semmle.code.csharp.frameworks.system.Web
XmlElement getAWebServerConfig(WebConfigXml webConfig) {
XmlElement getAWebConfigRoot(WebConfigXml webConfig) {
result = webConfig.getARootElement()
or
result = webConfig.getARootElement().getAChild("location") and
(
not exists(result.getAttributeValue("path")) // equivalent to path="."
not result.hasAttribute("path") // equivalent to path="."
or
result.getAttributeValue("path") = ["", "."]
)
@@ -42,7 +42,7 @@ predicate hasWebConfigXFrameOptions(WebConfigXml webConfig) {
// </system.webServer>
// ```
// This can also be in a `location`
getAWebServerConfig(webConfig)
getAWebConfigRoot(webConfig)
.getAChild("system.webServer")
.getAChild("httpProtocol")
.getAChild("customHeaders")

View File

@@ -1,4 +1,4 @@
---
category: minorAnalysis
---
* the `cs/web/missing-x-frame-options` query now correctly handles configuration nested in `<location>` elements.
* the `cs/web/missing-x-frame-options` query now correctly handles configuration nested in a `<location >` elements.