Skip to content

Feature/demo e2e #54

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Feature/demo e2e #54

wants to merge 5 commits into from

Conversation

CalinL
Copy link
Contributor

@CalinL CalinL commented Apr 24, 2025

No description provided.

CalinL added 3 commits April 24, 2025 15:45
Changed the version of the `System.Text.Json` package from `9.0.4` to `8.0.4` in the `webapp01.csproj` file.
Updated logging to use the authenticated user's name instead of a static admin username. This change enhances security by eliminating the use of hardcoded credentials.
Copy link

github-actions bot commented Apr 24, 2025

Dependency Review

The following issues were found:
  • ❌ 4 vulnerable package(s)
  • ❌ 7 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 f647f14.
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

samples/Pipfile.lock

NameVersionVulnerabilitySeverity
flask2.0.2Flask vulnerable to possible disclosure of permanent session cookie due to missing Vary: Cookie headerhigh
werkzeug2.0.2High resource usage when parsing multipart form data with many fieldshigh
Werkzeug debugger vulnerable to remote execution when interacting with attacker controlled domainhigh
Werkzeug DoS: High resource usage when parsing multipart/form-data containing a large part with CR/LF character at the beginningmoderate
Werkzeug safe_join not safe on Windowsmoderate
Werkzeug possible resource exhaustion when parsing file data in formsmoderate
jinja23.0.2Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filtermoderate
Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filtermoderate
Jinja has a sandbox breakout through indirect reference to format methodmoderate
Jinja has a sandbox breakout through malicious filenamesmoderate
Jinja2 vulnerable to sandbox breakout through attr filter selecting format methodmoderate

src/webapp01/webapp01.csproj

NameVersionVulnerabilitySeverity
flask2.0.2Flask vulnerable to possible disclosure of permanent session cookie due to missing Vary: Cookie headerhigh
werkzeug2.0.2High resource usage when parsing multipart form data with many fieldshigh
Werkzeug debugger vulnerable to remote execution when interacting with attacker controlled domainhigh
Werkzeug DoS: High resource usage when parsing multipart/form-data containing a large part with CR/LF character at the beginningmoderate
Werkzeug safe_join not safe on Windowsmoderate
Werkzeug possible resource exhaustion when parsing file data in formsmoderate
jinja23.0.2Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filtermoderate
Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filtermoderate
Jinja has a sandbox breakout through indirect reference to format methodmoderate
Jinja has a sandbox breakout through malicious filenamesmoderate
Jinja2 vulnerable to sandbox breakout through attr filter selecting format methodmoderate
System.Text.Json8.0.4Microsoft Security Advisory CVE-2024-43485 | .NET Denial of Service Vulnerabilityhigh
Only included vulnerabilities with severity moderate or higher.

License Issues

samples/Pipfile.lock

PackageVersionLicenseIssue Type
flask2.0.2BSD-2-Clause AND BSD-3-ClauseIncompatible License
werkzeug2.0.2BSD-2-Clause AND BSD-3-ClauseIncompatible License
jinja23.0.2BSD-2-Clause AND BSD-3-ClauseIncompatible License
click8.0.1BSD-2-Clause AND BSD-3-ClauseIncompatible License
itsdangerous2.0.1BSD-2-ClauseIncompatible License
markupsafe2.0.1BSD-2-Clause AND BSD-3-ClauseIncompatible License
python-dotenv0.19.0BSD-2-Clause AND BSD-3-ClauseIncompatible License
Allowed Licenses: MIT, Apache-2.0, GPL-3.0

OpenSSF Scorecard

PackageVersionScoreDetails
pip/flask 2.0.2 🟢 6.2
Details
CheckScoreReason
Maintained🟢 1020 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10
Code-Review🟢 3Found 6/20 approved changesets -- score normalized to 3
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies🟢 5dependency not pinned by hash detected -- score normalized to 5
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Fuzzing🟢 10project is fuzzed
Packaging🟢 10packaging workflow detected
Signed-Releases🟢 105 out of the last 5 releases have a total of 5 signed artifacts.
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
Security-Policy🟢 9security policy file detected
Vulnerabilities⚠️ 19 existing vulnerabilities detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
pip/werkzeug 2.0.2 🟢 5.8
Details
CheckScoreReason
Maintained🟢 60 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 6
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Code-Review⚠️ 0Found 0/19 approved changesets -- score normalized to 0
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies🟢 5dependency not pinned by hash detected -- score normalized to 5
Vulnerabilities🟢 100 existing vulnerabilities detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
Signed-Releases🟢 105 out of the last 5 releases have a total of 5 signed artifacts.
Packaging🟢 10packaging workflow detected
Security-Policy🟢 9security policy file detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
pip/jinja2 3.0.2 🟢 6.8
Details
CheckScoreReason
Code-Review⚠️ 2Found 4/18 approved changesets -- score normalized to 2
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Maintained🟢 96 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 9
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 5dependency not pinned by hash detected -- score normalized to 5
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Vulnerabilities🟢 100 existing vulnerabilities detected
License🟢 10license file detected
Fuzzing🟢 10project is fuzzed
Packaging🟢 10packaging workflow detected
Signed-Releases🟢 104 out of the last 4 releases have a total of 4 signed artifacts.
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
Security-Policy🟢 9security policy file detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
pip/click 8.0.1 🟢 6.8
Details
CheckScoreReason
Code-Review⚠️ 2Found 2/10 approved changesets -- score normalized to 2
Maintained🟢 1023 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies🟢 5dependency not pinned by hash detected -- score normalized to 5
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing🟢 10project is fuzzed
License🟢 10license file detected
Vulnerabilities🟢 100 existing vulnerabilities detected
Packaging🟢 10packaging workflow detected
Signed-Releases🟢 105 out of the last 5 releases have a total of 5 signed artifacts.
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
Security-Policy🟢 9security policy file detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
pip/itsdangerous 2.0.1 🟢 5.9
Details
CheckScoreReason
Maintained⚠️ 00 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Code-Review⚠️ 0Found 0/14 approved changesets -- score normalized to 0
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 5dependency not pinned by hash detected -- score normalized to 5
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Vulnerabilities🟢 100 existing vulnerabilities detected
Fuzzing🟢 10project is fuzzed
License🟢 10license file detected
Packaging🟢 10packaging workflow detected
Signed-Releases🟢 101 out of the last 1 releases have a total of 1 signed artifacts.
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
pip/markupsafe 2.0.1 🟢 5.9
Details
CheckScoreReason
Maintained⚠️ 00 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Binary-Artifacts🟢 10no binaries found in the repo
Code-Review⚠️ 0Found 0/24 approved changesets -- score normalized to 0
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Pinned-Dependencies🟢 6dependency not pinned by hash detected -- score normalized to 6
Fuzzing🟢 10project is fuzzed
License🟢 10license file detected
Vulnerabilities🟢 100 existing vulnerabilities detected
Packaging🟢 10packaging workflow detected
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
Signed-Releases🟢 105 out of the last 5 releases have a total of 5 signed artifacts.
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
pip/python-dotenv 0.19.0 🟢 4.7
Details
CheckScoreReason
Maintained🟢 109 commit(s) and 11 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 10security policy file detected
Code-Review🟢 5Found 15/28 approved changesets -- score normalized to 5
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Vulnerabilities⚠️ 28 existing vulnerabilities detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
nuget/System.Text.Json 8.0.4 🟢 5.3
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 1030 commit(s) and 27 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Security-Policy🟢 10security policy file detected
License🟢 10license file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
Signed-Releases⚠️ -1no releases found
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 82 existing vulnerabilities detected
Binary-Artifacts⚠️ 0binaries present in source code
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0

Scanned Files

  • samples/Pipfile.lock
  • src/webapp01/webapp01.csproj

Introduced a new `adminUserName` variable and a constant `DEFAULT_PASSWORD` in `Privacy.cshtml.cs`. Updated the `OnGet` method to handle a "drive" query parameter, construct a disk space command, and log the command string along with the admin username.
@@ -7,13 +7,23 @@
{
private readonly ILogger<PrivacyModel> _logger;

string adminUserName = "[email protected]";

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note

Field 'adminUserName' can be 'readonly'.

Copilot Autofix

AI 4 days ago

To fix the issue, we will add the readonly modifier to the adminUserName field. This ensures that the field cannot be reassigned after its initial assignment during declaration. The change will be made directly on line 10 where the field is declared.


Suggested changeset 1
src/webapp01/Pages/Privacy.cshtml.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/webapp01/Pages/Privacy.cshtml.cs b/src/webapp01/Pages/Privacy.cshtml.cs
--- a/src/webapp01/Pages/Privacy.cshtml.cs
+++ b/src/webapp01/Pages/Privacy.cshtml.cs
@@ -9,3 +9,3 @@
 
-    string adminUserName = "[email protected]";
+    readonly string adminUserName = "[email protected]";
 
EOF
@@ -9,3 +9,3 @@

string adminUserName = "[email protected]";
readonly string adminUserName = "[email protected]";

Copilot is powered by AI and may make mistakes. Always verify output.
public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}

public void OnGet()
{
string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C";

Check notice

Code scanning / CodeQL

Inefficient use of ContainsKey Note

Inefficient use of 'ContainsKey' and
indexer
.

Copilot Autofix

AI 4 days ago

To fix the issue, we will replace the Request.Query.ContainsKey("drive") and subsequent Request.Query["drive"] with a single call to Request.Query.TryGetValue. This will combine the existence check and retrieval into one operation, improving efficiency. Specifically:

  1. Use Request.Query.TryGetValue("drive", out var driveValue) to check for the presence of the "drive" key and retrieve its value if it exists.
  2. If the key is not found, assign the default value "C" to the drive variable.

This change will be made on line 23 of the file src/webapp01/Pages/Privacy.cshtml.cs.


Suggested changeset 1
src/webapp01/Pages/Privacy.cshtml.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/webapp01/Pages/Privacy.cshtml.cs b/src/webapp01/Pages/Privacy.cshtml.cs
--- a/src/webapp01/Pages/Privacy.cshtml.cs
+++ b/src/webapp01/Pages/Privacy.cshtml.cs
@@ -22,3 +22,3 @@
     {
-        string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C";
+        string drive = Request.Query.TryGetValue("drive", out var driveValue) ? driveValue : "C";
         var str = $"/C fsutil volume diskfree {drive}:";
EOF
@@ -22,3 +22,3 @@
{
string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C";
string drive = Request.Query.TryGetValue("drive", out var driveValue) ? driveValue : "C";
var str = $"/C fsutil volume diskfree {drive}:";
Copilot is powered by AI and may make mistakes. Always verify output.
public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}

public void OnGet()
{
string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C";
var str = $"/C fsutil volume diskfree {drive}:";
_logger.LogInformation($"Command str: {str}");

Check failure

Code scanning / CodeQL

Log entries created from user input High

This log entry depends on a
user-provided value
.

Copilot Autofix

AI 4 days ago

To fix the issue, the user-provided input (drive) should be sanitized before being included in the log entry. Since the log is plain text, we can remove newline characters and other potentially harmful characters from the input using String.Replace or similar methods. This ensures that the log entry cannot be manipulated by malicious input.

The fix involves:

  1. Sanitizing the drive variable by removing newline characters (\n and \r) and trimming any leading or trailing whitespace.
  2. Using the sanitized version of drive when constructing the str variable and logging it.

Suggested changeset 1
src/webapp01/Pages/Privacy.cshtml.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/webapp01/Pages/Privacy.cshtml.cs b/src/webapp01/Pages/Privacy.cshtml.cs
--- a/src/webapp01/Pages/Privacy.cshtml.cs
+++ b/src/webapp01/Pages/Privacy.cshtml.cs
@@ -23,2 +23,3 @@
         string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C";
+        drive = drive.Replace("\n", "").Replace("\r", "").Trim(); // Sanitize user input
         var str = $"/C fsutil volume diskfree {drive}:";
EOF
@@ -23,2 +23,3 @@
string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C";
drive = drive.Replace("\n", "").Replace("\r", "").Trim(); // Sanitize user input
var str = $"/C fsutil volume diskfree {drive}:";
Copilot is powered by AI and may make mistakes. Always verify output.
Updated `Pipfile.lock` to specify Python 3.8 and added
dependencies including `click`, `flask`, `itsdangerous`,
`jinja2`, `markupsafe`, `python-dotenv`, and `werkzeug`
with version constraints and hashes.

Added a new route in `routes.py` for the index page
that handles GET requests, retrieves query parameters
for `name`, `author`, and `read`, and executes SQL
queries to fetch and render books using the
`books.html` template.
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.

1 participant