Skip to content

Commit 651ca69

Browse files
authored
CodeQL fixes - tests applications (#4158)
* [CodeQL] Creating an ASP.NET debug binary may reveal sensitive information * [CodeQL] ASP.NET config file enables directory browsing * [CodeQL] Missing global error handler * [CodeQL] Missing X-Frame-Options HTTP header
1 parent b1699b5 commit 651ca69

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

test/test-applications/integrations/TestApplication.AspNet.NetFramework/Views/Web.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
<remove name="BlockViewHandler"/>
3131
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
3232
</handlers>
33+
<httpProtocol>
34+
<customHeaders>
35+
<add name="X-Frame-Options" value="SAMEORIGIN" />
36+
</customHeaders>
37+
</httpProtocol>
3338
</system.webServer>
3439

3540
<system.web>

test/test-applications/integrations/TestApplication.AspNet.NetFramework/Web.config

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
1010
</appSettings>
1111
<system.web>
12-
<customErrors mode="Off">
12+
<customErrors mode="On">
1313
</customErrors>
14-
<compilation debug="true" targetFramework="4.6.2" />
14+
<compilation targetFramework="4.6.2" />
1515
<httpRuntime targetFramework="4.6.2" />
1616
</system.web>
1717
<system.webServer>
@@ -22,6 +22,11 @@
2222
<remove name="TRACEVerbHandler" />
2323
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
2424
</handlers>
25+
<httpProtocol>
26+
<customHeaders>
27+
<add name="X-Frame-Options" value="SAMEORIGIN" />
28+
</customHeaders>
29+
</httpProtocol>
2530
</system.webServer>
2631
<runtime>
2732
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

test/test-applications/integrations/TestApplication.Owin.IIS.NetFramework/Web.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@
1616
<compilation debug="true" targetFramework="4.6.2"/>
1717
<httpRuntime targetFramework="4.6.2"/>
1818
</system.web>
19+
20+
<system.webServer>
21+
<httpProtocol>
22+
<customHeaders>
23+
<add name="X-Frame-Options" value="SAMEORIGIN" />
24+
</customHeaders>
25+
</httpProtocol>
26+
</system.webServer>
1927
</configuration>

test/test-applications/integrations/TestApplication.Wcf.Server.IIS.NetFramework/Web.config

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,17 @@
4141
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
4242
</system.serviceModel>
4343
<system.webServer>
44+
<httpProtocol>
45+
<customHeaders>
46+
<add name="X-Frame-Options" value="SAMEORIGIN" />
47+
</customHeaders>
48+
</httpProtocol>
4449
<modules runAllManagedModulesForAllRequests="true"/>
4550
<!--
4651
To browse web app root directory during debugging, set the value below to true.
4752
Set to false before deployment to avoid disclosing web app folder information.
4853
-->
49-
<directoryBrowse enabled="true"/>
54+
<directoryBrowse enabled="false"/>
5055
</system.webServer>
5156

5257
</configuration>

0 commit comments

Comments
 (0)