-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: main
Are you sure you want to change the base?
Feature/demo e2e #54
Changes from all commits
3f6abba
557dabf
e82352f
c6f4d20
f647f14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
from flask import request, render_template, make_response | ||
|
||
from server.webapp import flaskapp, cursor | ||
from server.models import Book | ||
|
||
|
||
@flaskapp.route('/') | ||
def index(): | ||
name = request.args.get('name') | ||
author = request.args.get('author') | ||
read = bool(request.args.get('read')) | ||
|
||
if name: | ||
cursor.execute( | ||
"SELECT * FROM books WHERE name LIKE '%" + name + "%'" | ||
) | ||
books = [Book(*row) for row in cursor] | ||
|
||
elif author: | ||
cursor.execute( | ||
"SELECT * FROM books WHERE author LIKE '%" + author + "%'" | ||
) | ||
books = [Book(*row) for row in cursor] | ||
|
||
else: | ||
cursor.execute("SELECT name, author, read FROM books") | ||
books = [Book(*row) for row in cursor] | ||
|
||
return render_template('books.html', books=books) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace webapp01.Pages; | ||
|
||
public class IndexModel : PageModel | ||
{ | ||
string adminUserName = "[email protected]"; | ||
|
||
// TODO: Don't use this in production | ||
public const string DEFAULT_PASSWORD = "Pass@word1"; | ||
|
||
private readonly ILogger<IndexModel> _logger; | ||
|
||
public IndexModel(ILogger<IndexModel> logger) | ||
|
@@ -19,9 +13,6 @@ public IndexModel(ILogger<IndexModel> 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}"); | ||
_logger.LogInformation("Admin" + adminUserName); | ||
_logger.LogInformation($"User: {User.Identity?.Name}"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,13 +7,23 @@ | ||||||||||||||||
{ | |||||||||||||||||
private readonly ILogger<PrivacyModel> _logger; | |||||||||||||||||
|
|||||||||||||||||
string adminUserName = "[email protected]"; | |||||||||||||||||
|
|||||||||||||||||
// TODO: Don't use this in production | |||||||||||||||||
public const string DEFAULT_PASSWORD = "Pass@word1"; | |||||||||||||||||
|
|||||||||||||||||
|
|||||||||||||||||
public PrivacyModel(ILogger<PrivacyModel> logger) | |||||||||||||||||
{ | |||||||||||||||||
_logger = logger; | |||||||||||||||||
} | |||||||||||||||||
|
|||||||||||||||||
public void OnGet() | |||||||||||||||||
{ | |||||||||||||||||
string drive = Request.Query.ContainsKey("drive") ? Request.Query["drive"] : "C"; | |||||||||||||||||
Check warning on line 23 in src/webapp01/Pages/Privacy.cshtml.cs
|
|||||||||||||||||
Check noticeCode scanning / CodeQL Inefficient use of ContainsKey Note
Inefficient use of 'ContainsKey' and
indexer Error loading related location Loading
Copilot AutofixAI 5 days ago To fix the issue, we will replace the
This change will be made on line 23 of the file
Suggested changeset
1
src/webapp01/Pages/Privacy.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($"Command str: {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 5 days ago To fix the issue, the user-provided input ( The fix involves:
Suggested changeset
1
src/webapp01/Pages/Privacy.cshtml.cs
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
|
|||||||||||||||||
_logger.LogInformation("Admin" + adminUserName); | |||||||||||||||||
} | |||||||||||||||||
} | |||||||||||||||||
|
Check notice
Code scanning / CodeQL
Missed 'readonly' opportunity Note
Copilot Autofix
AI 5 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 assignment during declaration. The change will be made directly on line 10 where the field is declared.