Skip to content

Add DevSecOps-10309 demo page with intentional vulnerabilities for GHAS scanning - #143

Draft
CalinL with Copilot wants to merge 3 commits into
mainfrom
copilot/featuredevsecops-demo-12345-yet-again
Draft

CalinL with Copilot wants to merge 3 commits into
mainfrom
copilot/featuredevsecops-demo-12345-yet-again

Conversation

Copilot AI commented Feb 12, 2026 •

Copy link
Copy Markdown

New demo page showcasing GitHub Advanced Security capabilities through intentional security vulnerabilities and 2026 GHAS feature updates.

New Files

  • DevSecOps-10309.cshtml - Razor page with GHAS news, interactive vulnerability demos (ReDoS, SQL injection testing)
  • DevSecOps-10309.cshtml.cs - Code-behind with ILogger and intentional security flaws

Intentional Vulnerabilities

Implements patterns that GHAS code scanning should detect:

// Log forging - unsanitized user input
_logger.LogInformation($"User accessed page: {userInput}");

// ReDoS - nested quantifiers
private static readonly Regex VulnerableRegex = new Regex(@"^(a+)+$");

// SQL injection - string concatenation
string query = "SELECT * FROM Users WHERE UserId = " + userId;

// Hardcoded credentials
private const string CONNECTION_STRING = "Server=prod-sql;User Id=sa;Password=P@ssw0rd123!;";

// Insecure deserialization
JsonConvert.DeserializeObject<List<string>>(jsonData, new JsonSerializerSettings {
    TypeNameHandling = TypeNameHandling.Auto
});

Package Changes

Downgraded to vulnerable versions for demonstration:

UI Updates

Added navigation link in Index.cshtml to new demo page.

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: DevSecOps (04)</issue_title>
<issue_description>- Use the gh-advsec-devsecops repository from the workspace

  • Create me a new unique branch name under feature/devsecops-demo-[randon-number]
  • Create a new DevSecOps-[random-number].cshtml page and reference it into the Index page.
  • Add some content to it with some latest news about GitHub Advanced Security.
  • Implemented the ILogger for the backend code of the page.
  • For demo purpose, generate some C# insecure code, like log forging or regex exposure
  • Add package System.Text.Json --version 8.0.4
  • Add package Microsoft.Data.SqlClient --version 5.0.2
  • Add package newtonsoft.json --version 12.0.2
  • Build the webapp to make sure there are not build errors.
  • Prepare for committing the changes.</issue_description>

<agent_instructions>implement this</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ate packages

Co-authored-by: CalinL <10718943+CalinL@users.noreply.github.com>
Copilot AI changed the title [WIP] Add DevSecOps page with news and logging issues Add DevSecOps-10309 demo page with intentional vulnerabilities for GHAS scanning Feb 12, 2026
Copilot AI requested a review from CalinL February 12, 2026 21:37
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
Comment thread src/webapp01/Pages/DevSecOps-10309.cshtml.cs Fixed
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ❌ 1 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses.
See the Details below.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA f8ee66d.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Vulnerabilities

src/webapp01/webapp01.csproj

NameVersionVulnerabilitySeverity
Newtonsoft.Json12.0.2Improper Handling of Exceptional Conditions in Newtonsoft.Jsonhigh
Only included vulnerabilities with severity moderate or higher.

OpenSSF Scorecard

PackageVersionScoreDetails
nuget/Newtonsoft.Json 12.0.2 🟢 5.6
Details
CheckScoreReason
Code-Review⚠️ 2Found 7/30 approved changesets -- score normalized to 2
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Maintained🟢 1019 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Token-Permissions🟢 9detected GitHub workflow tokens with excessive permissions
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Security-Policy⚠️ 0security policy file not detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
SAST🟢 9SAST tool detected but not run on all commits

Scanned Files

  • src/webapp01/webapp01.csproj

1 similar comment
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ❌ 1 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses.
See the Details below.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA f8ee66d.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Vulnerabilities

src/webapp01/webapp01.csproj

NameVersionVulnerabilitySeverity
Newtonsoft.Json12.0.2Improper Handling of Exceptional Conditions in Newtonsoft.Jsonhigh
Only included vulnerabilities with severity moderate or higher.

OpenSSF Scorecard

PackageVersionScoreDetails
nuget/Newtonsoft.Json 12.0.2 🟢 5.6
Details
CheckScoreReason
Code-Review⚠️ 2Found 7/30 approved changesets -- score normalized to 2
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Maintained🟢 1019 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Token-Permissions🟢 9detected GitHub workflow tokens with excessive permissions
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Security-Policy⚠️ 0security policy file not detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
SAST🟢 9SAST tool detected but not run on all commits

Scanned Files

  • src/webapp01/webapp01.csproj

public void OnGet()
{
// VULNERABILITY: Log forging - user input directly in logs without sanitization
string userInput = Request.Query.ContainsKey("user") ? Request.Query["user"].ToString() ?? "anonymous" : "anonymous";
LoadLatestGHASNews();

// Demonstrate ReDoS vulnerability
string testPattern = Request.Query.ContainsKey("pattern") ? Request.Query["pattern"].ToString() ?? "aaa" : "aaa";
Comment on lines +54 to +58
catch (Exception ex)
{
// VULNERABILITY: Logging full exception details including stack trace
_logger.LogError($"Regex evaluation failed for pattern: {testPattern}. Error: {ex.ToString()}");
}
Comment on lines +67 to +70
catch (Exception ex)
{
_logger.LogError($"Database connection failed: {ex.Message}");
}
Comment on lines +132 to +137
catch (Exception ex)
{
// VULNERABILITY: Logging sensitive information and full stack trace
_logger.LogError($"Regex test failed for pattern: {pattern}. Exception: {ex.ToString()}");
TempData["RegexError"] = "Pattern evaluation failed - potential ReDoS attack detected";
}
Comment on lines +170 to +175
catch (Exception ex)
{
// VULNERABILITY: Logging detailed error information
_logger.LogError($"SQL execution failed for userId: {userId}. Error: {ex.ToString()}");
TempData["RegexError"] = "SQL query failed";
}
catch (Exception ex)
{
// VULNERABILITY: Logging full exception details including stack trace
_logger.LogError($"Regex evaluation failed for pattern: {testPattern}. Error: {ex.ToString()}");
catch (Exception ex)
{
// VULNERABILITY: Logging sensitive information and full stack trace
_logger.LogError($"Regex test failed for pattern: {pattern}. Exception: {ex.ToString()}");
catch (Exception ex)
{
// VULNERABILITY: Logging detailed error information
_logger.LogError($"SQL execution failed for userId: {userId}. Error: {ex.ToString()}");

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: DevSecOps (04)

2 participants