File tree Expand file tree Collapse file tree 4 files changed +59
-2
lines changed
Expand file tree Collapse file tree 4 files changed +59
-2
lines changed Original file line number Diff line number Diff line change 1+ @page
2+ @model webapp01 .Pages .DevSecOpsModel
3+ @{
4+ ViewData [" Title" ] = " DevSecOps" ;
5+ }
6+
7+ <h2 >DevSecOps & GitHub Advanced Security News</h2 >
8+ <div >
9+ <ul >
10+ <li ><strong >May 2025:</strong > GitHub Advanced Security now supports secret scanning for custom patterns.</li >
11+ <li ><strong >April 2025:</strong > Code scanning with CodeQL adds new C# queries for insecure deserialization.</li >
12+ <li ><strong >March 2025:</strong > Push protection for credentials is now enabled by default for all repos.</li >
13+ </ul >
14+ </div >
15+ <p >Below is a demonstration of insecure C# code for educational purposes only.</p >
16+ <pre >
17+ @Model.InsecureLogExample
18+ @Model.InsecureRegexExample
19+ </pre >
Original file line number Diff line number Diff line change 1+ using Microsoft . AspNetCore . Mvc . RazorPages ;
2+ using Microsoft . Extensions . Logging ;
3+ using System . Text . RegularExpressions ;
4+
5+ namespace webapp01 . Pages
6+ {
7+ public class DevSecOpsModel : PageModel
8+ {
9+ private readonly ILogger < DevSecOpsModel > _logger ;
10+ public string InsecureLogExample { get ; private set ; }
11+ public string InsecureRegexExample { get ; private set ; }
12+
13+ public DevSecOpsModel ( ILogger < DevSecOpsModel > logger )
14+ {
15+ _logger = logger ;
16+ }
17+
18+ public void OnGet ( )
19+ {
20+ // Insecure log forging example
21+ string userInput = "attacker\n InjectedLogEntry" ;
22+ _logger . LogInformation ( "User input: {UserInput}" , userInput ) ;
23+ InsecureLogExample = $ "_logger.LogInformation(\" User input: {{UserInput}}\" , \" { userInput } \" );";
24+
25+ // Insecure regex example (ReDoS)
26+ string evilInput = new string ( 'a' , 10000 ) + "!" ;
27+ string pattern = "(a+)+!" ;
28+ try
29+ {
30+ Regex . Match ( evilInput , pattern ) ;
31+ InsecureRegexExample = $ "Regex.Match(evilInput, \" { pattern } \" ); // Potential ReDoS";
32+ }
33+ catch { }
34+ }
35+ }
36+ }
Original file line number Diff line number Diff line change 99 <h5 class =" card-title" >.NET 💜 Azure v4</h5 >
1010 <p class =" card-text" >Learn about <a href =" https://learn.microsoft.com/aspnet/core" >building Web apps with ASP.NET Core</a >.</p >
1111 <p class =" card-text" >Visit our <a asp-page =" /About" >About GHAS</a > page to learn about GitHub Advanced Security features.</p >
12+ <p class =" card-text" >Check out the <a asp-page =" /DevSecOps" >DevSecOps</a > page for the latest security news and a demo.</p >
1213 </div >
1314</div >
Original file line number Diff line number Diff line change 1111
1212 <ItemGroup >
1313 <PackageReference Include =" Azure.Identity" Version =" 1.13.2" />
14- <PackageReference Include =" Microsoft.Data.SqlClient" Version =" 6 .0.2" />
14+ <PackageReference Include =" Microsoft.Data.SqlClient" Version =" 5 .0.2" />
1515 <PackageReference Include =" Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version =" 1.21.0" />
16- <PackageReference Include =" System.Text.Json" Version =" 9.0.4" />
16+ <PackageReference Include =" Newtonsoft.Json" Version =" 12.0.2" />
17+ <PackageReference Include =" System.Text.Json" Version =" 8.0.4" />
1718 </ItemGroup >
1819
1920</Project >
You can’t perform that action at this time.
0 commit comments