Skip to content

Add login endpoint #2

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 20 commits into
base: main
Choose a base branch
from
Open

Add login endpoint #2

wants to merge 20 commits into from

Conversation

alpire
Copy link
Contributor

@alpire alpire commented Apr 6, 2021

This PR introduces a SQL Injection and a Path Traversal in new login, logout and attachments endpoints, which Mayhem for API detects, preventing the PR from being merged.

@github-actions
Copy link

github-actions bot commented Jan 5, 2023

Mayhem for API Automated API Testing Report

❗ 3 Errors Found

Rule Method Path Details
Internal Server Error GET /login ↗️
Internal Server Error GET /login ↗️
Internal Server Error GET /login ↗️

✔️ 🎆 0 Warnings Found


Testing details and issue reproduction found at https://app.mayhem.security/forallsecure-demo/mapi-action-examples/fastapi/276

@app.get("/login")
async def login(email: str, password: str):
cur = con.cursor()
cur.execute("SELECT * FROM users WHERE email = '%s' and password = '%s'" % (email, password))

Check failure

Code scanning / mAPI

Internal Server Error (sqlite3.Warning)

Internal Server Error in 'GET /login'. [Details](https://mayhem4api.forallsecure.com/issues/21320/1160482)
@app.get("/login")
async def login(email: str, password: str):
cur = con.cursor()
cur.execute("SELECT * FROM users WHERE email = '%s' and password = '%s'" % (email, password))

Check failure

Code scanning / mAPI

Internal Server Error (ValueError)

Internal Server Error in 'GET /login'. [Details](https://mayhem4api.forallsecure.com/issues/21320/1160483)
@app.get("/login")
async def login(email: str, password: str):
cur = con.cursor()
cur.execute("SELECT * FROM users WHERE email = '%s' and password = '%s'" % (email, password))

Check failure

Code scanning / mAPI

Internal Server Error (sqlite3.OperationalError)

Internal Server Error in 'GET /login'. [Details](https://mayhem4api.forallsecure.com/issues/21320/1160485)
@app.get("/login")
async def login(email: str, password: str):
cur = con.cursor()
cur.execute("SELECT * FROM users WHERE email = '%s' and password = '%s'" % (email, password))

Check failure

Code scanning / mAPI

Internal Server Error (sqlite3.OperationalError)

Internal Server Error in 'GET /login'. [Details](https://mayhem4api.forallsecure.com/issues/21320/1160485)
@app.get("/login")
async def login(email: str, password: str):
cur = con.cursor()
cur.execute("SELECT * FROM users WHERE email = '%s' and password = '%s'" % (email, password))

Check failure

Code scanning / mAPI

Internal Server Error (ValueError)

Internal Server Error in 'GET /login'. [Details](https://mayhem4api.forallsecure.com/issues/21320/1160483)
@app.get("/login")
async def login(email: str, password: str):
cur = con.cursor()
cur.execute("SELECT * FROM users WHERE email = '%s' and password = '%s'" % (email, password))

Check failure

Code scanning / mAPI

Internal Server Error (sqlite3.Warning)

Internal Server Error in 'GET /login'. [Details](https://mayhem4api.forallsecure.com/issues/21320/1160482)
@vlussenburg vlussenburg force-pushed the bad-login-endpoint branch 3 times, most recently from 0c8cfbb to f9014dd Compare January 12, 2023 18:58
@vlussenburg vlussenburg force-pushed the bad-login-endpoint branch 4 times, most recently from 863be11 to b3f647d Compare January 12, 2023 19:51
@vlussenburg vlussenburg force-pushed the bad-login-endpoint branch 2 times, most recently from 44168ec to c7ad466 Compare January 20, 2023 00:06
@codecov-commenter
Copy link

codecov-commenter commented Feb 28, 2023

Codecov Report

Attention: Patch coverage is 47.05882% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 59.52%. Comparing base (8813c9d) to head (c816f67).

Files Patch % Lines
src/main.py 47.05% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #2      +/-   ##
==========================================
- Coverage   69.23%   59.52%   -9.71%     
==========================================
  Files           2        2              
  Lines          26       42      +16     
==========================================
+ Hits           18       25       +7     
- Misses          8       17       +9     
Flag Coverage Δ
unit-tests 59.52% <47.05%> (-9.71%) ⬇️
vulnerability-tests 59.52% <47.05%> (-9.71%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

4 participants