Merge Dev/apikey into develop#6
Open
JCruiz15 wants to merge 9 commits into
Open
Conversation
* Finished implementation of API key protocol. * On every sensitive endpoint an API token will be requested before doing anything. * The API token is sended as a bearer token in 'Authentication' header. * Instructions page updated, explaining API token procedure. * README updated with API token environement variable.
jfaldanam
requested changes
Sep 14, 2023
| http.HandleFunc(fmt.Sprintf("%s/api/refresh", subpath), refreshProxy) | ||
| http.HandleFunc(fmt.Sprintf("%s/api/reset/refresh", subpath), resetRefreshDate) | ||
| http.HandleFunc(fmt.Sprintf("%s/api/check-custom-fields", subpath), checkFields) | ||
| // http.HandleFunc(fmt.Sprintf("%s/api/save-APIkey", subpath), saveAPIkey) |
Collaborator
There was a problem hiding this comment.
Why is this comment here?
| func getLogs(w http.ResponseWriter, r *http.Request) { | ||
| if !utils.APIkeyCheck(r) { | ||
| log.Warn("Error 401: API key token is not correct or was not found. Use your api key to use GHOPI's functionalities") | ||
| w.Write([]byte("ERROR 401")) |
Collaborator
There was a problem hiding this comment.
Each time the error is returned it is worded differently
| Function LoginHandler creates the URL that redirects to GitHub with the permissions needed for GHOPI. | ||
| */ | ||
| func (gh *Github) LoginHandler(w http.ResponseWriter, r *http.Request) { | ||
| //TODO - CHECK APIKEY |
Collaborator
There was a problem hiding this comment.
it is a todo or it is not a todo?
| Function LoginHandler creates the URL that redirects to Open Project with the permissions needed for GHOPI. | ||
| */ | ||
| func (op *Openproject) LoginHandler(w http.ResponseWriter, r *http.Request) { | ||
| //TODO - CHECK APIKEY |
Collaborator
There was a problem hiding this comment.
it is a todo or it is not a todo?
| headers: {'Authentication': 'Bearer '.concat(readCookie("apikey"))} | ||
| }); | ||
| let data = await response.text(); | ||
| if(data == "ERROR 401") { |
Collaborator
There was a problem hiding this comment.
the check should be for response.status, and check the return value to see if ti valid or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Api token requirement feature added to GHOPI. Requesting availability to merge with develop