Skip to content
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

Add authentication system to naruno/api/main.py #1728

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 7, 2023

Description

This PR adds an authentication system to the naruno/api/main.py file in order to secure the Naruno API. Currently, the API does not require any credentials for accessing its routes, which poses a security risk. With this PR, we introduce basic authentication to ensure that only authorized users can make requests to the API.

Summary of Changes

  • Added a new function check_auth() to perform the authentication check before each request.
  • Imported necessary modules Response and request from Flask.
  • Stored the username and password in environment variables for simplicity.
  • If the provided credentials do not match the stored ones, a 401 response is returned asking for proper credentials.

This PR addresses Issue #1726.

Fixes #1726.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/add-authentication-system

To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 7, 2023
@sweep-ai sweep-ai bot temporarily deployed to Tests August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to LINT Tests August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Tests August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 09:40 Inactive
@viezly
Copy link

viezly bot commented Aug 7, 2023

Changes preview:

Legend:

👀 Review pull request on Viezly

@sweep-ai sweep-ai bot temporarily deployed to Tests August 7, 2023 10:15 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds August 7, 2023 10:15 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Tests August 7, 2023 10:15 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Tests October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Tests October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
@sweep-ai sweep-ai bot temporarily deployed to Builds October 20, 2023 15:06 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API GitHub sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: In naruno/api/main.py add an authendication system
1 participant