-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/devsecops demo 03 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@page | ||
@model DevSecOpsModel | ||
@{ | ||
ViewData["Title"] = "DevSecOps"; | ||
} | ||
|
||
<h1>@ViewData["Title"]</h1> | ||
|
||
<p>Stay up-to-date with the latest advancements in GitHub Advanced Security.</p> | ||
|
||
<h2>Latest News</h2> | ||
<div class="card-deck"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h5 class="card-title">GitHub Universe 2025 Highlights</h5> | ||
<p class="card-text">Discover the key announcements from GitHub Universe 2025, including new features for Advanced Security that help you build more secure applications.</p> | ||
<a href="#" class="btn btn-primary">Read More</a> | ||
</div> | ||
<div class="card-footer"> | ||
<small class="text-muted">Posted on May 8, 2025</small> | ||
</div> | ||
</div> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Secret Scanning Enhancements</h5> | ||
<p class="card-text">Learn about the latest improvements to secret scanning, including expanded partner patterns and new detection capabilities to keep your secrets safe.</p> | ||
<a href="#" class="btn btn-primary">Read More</a> | ||
</div> | ||
<div class="card-footer"> | ||
<small class="text-muted">Posted on April 25, 2025</small> | ||
</div> | ||
</div> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h5 class="card-title">CodeQL Gets Faster and Smarter</h5> | ||
<p class="card-text">Explore the performance and intelligence upgrades to CodeQL, enabling faster and more accurate security analysis of your codebases.</p> | ||
<a href="#" class="btn btn-primary">Read More</a> | ||
</div> | ||
<div class="card-footer"> | ||
<small class="text-muted">Posted on April 10, 2025</small> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,35 @@ | |||||||||||||||||
using Microsoft.AspNetCore.Mvc; | |||||||||||||||||
using Microsoft.AspNetCore.Mvc.RazorPages; | |||||||||||||||||
using Microsoft.Extensions.Logging; | |||||||||||||||||
|
|||||||||||||||||
public class DevSecOpsModel : PageModel | |||||||||||||||||
{ | |||||||||||||||||
private readonly ILogger<DevSecOpsModel> _logger; | |||||||||||||||||
|
|||||||||||||||||
string adminUserName = "demouser@example.com"; | |||||||||||||||||
|
|||||||||||||||||
// TODO: Don't use this in production | |||||||||||||||||
public const string DEFAULT_PASSWORD_NEW = "Pass@word1"; | |||||||||||||||||
|
|||||||||||||||||
// TODO: Change this to an environment variable | |||||||||||||||||
public const string JWT_SECRET_KEY = "SecretKeyOfDoomThatMustBeAMinimumNumberOfBytes"; | |||||||||||||||||
|
|||||||||||||||||
|
|||||||||||||||||
public DevSecOpsModel(ILogger<DevSecOpsModel> logger) | |||||||||||||||||
{ | |||||||||||||||||
_logger = logger; | |||||||||||||||||
} | |||||||||||||||||
|
|||||||||||||||||
public void OnGet() | |||||||||||||||||
{ | |||||||||||||||||
string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C"; | |||||||||||||||||
Check warning on line 25 in src/webapp01/Pages/DevSecOps.cshtml.cs
|
|||||||||||||||||
Check noticeCode scanning / CodeQL Inefficient use of ContainsKey Note
Inefficient use of 'ContainsKey' and
indexer Error loading related location Loading
Copilot AutofixAI 8 days ago To fix the issue, replace the Specifically:
Suggested changeset
1
src/webapp01/Pages/DevSecOps.cshtml.cs
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
|
|||||||||||||||||
var str = $"/C fsutil volume diskfree {drive}:"; | |||||||||||||||||
|
|||||||||||||||||
_logger.LogInformation($"Executing command: {str}"); | |||||||||||||||||
Check failureCode scanning / CodeQL Log entries created from user input High
This log entry depends on a
user-provided value Error loading related location Loading
Copilot AutofixAI 8 days ago To fix the issue, the user-provided input ( Specifically:
Suggested changeset
1
src/webapp01/Pages/DevSecOps.cshtml.cs
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
|
|||||||||||||||||
_logger.LogInformation($"User: {User.Identity?.Name}"); | |||||||||||||||||
_logger.LogInformation($"Admin: {User.IsInRole("Admin")}"); | |||||||||||||||||
_logger.LogInformation("Admin" + adminUserName); | |||||||||||||||||
|
|||||||||||||||||
_logger.LogInformation("DevSecOps page visited at {Time}", System.DateTime.UtcNow); | |||||||||||||||||
} | |||||||||||||||||
} |
Check notice
Code scanning / CodeQL
Missed 'readonly' opportunity Note
Copilot Autofix
AI 8 days ago
To fix the issue, we will add the
readonly
modifier to theadminUserName
field. This ensures that the field cannot be reassigned after its initial value is set during declaration. The change will be made directly in the declaration of the field on line 9.