Fixed bad API key for abort workflow
This commit is contained in:
+43
-16
@@ -2118,17 +2118,7 @@ func abortExecution(resp http.ResponseWriter, request *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Check the execution if this fails.
|
|
||||||
user, err := handleApiAuthentication(resp, request)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Api authentication failed in abort workflow: %s", err)
|
|
||||||
resp.WriteHeader(401)
|
|
||||||
resp.Write([]byte(`{"success": false}`))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
location := strings.Split(request.URL.String(), "/")
|
location := strings.Split(request.URL.String(), "/")
|
||||||
|
|
||||||
var fileId string
|
var fileId string
|
||||||
if location[1] == "api" {
|
if location[1] == "api" {
|
||||||
if len(location) <= 4 {
|
if len(location) <= 4 {
|
||||||
@@ -2162,12 +2152,34 @@ func abortExecution(resp http.ResponseWriter, request *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - have a check for org etc too..
|
apikey := request.Header.Get("Authorization")
|
||||||
if user.Id != workflowExecution.Workflow.Owner && user.Role != "admin" {
|
parsedKey := ""
|
||||||
log.Printf("Wrong user (%s) for workflowexecution workflow %s", user.Username, workflowExecution.Workflow.ID)
|
if strings.HasPrefix(apikey, "Bearer ") {
|
||||||
resp.WriteHeader(401)
|
apikeyCheck := strings.Split(apikey, " ")
|
||||||
resp.Write([]byte(`{"success": false}`))
|
if len(apikeyCheck) == 2 {
|
||||||
return
|
parsedKey = apikeyCheck[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if workflowExecution.Authorization != parsedKey {
|
||||||
|
// FIXME: Check the execution if this fails.
|
||||||
|
user, err := handleApiAuthentication(resp, request)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Api authentication failed in abort workflow: %s", err)
|
||||||
|
resp.WriteHeader(401)
|
||||||
|
resp.Write([]byte(`{"success": false}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME - have a check for org etc too..
|
||||||
|
if user.Id != workflowExecution.Workflow.Owner && user.Role != "admin" {
|
||||||
|
log.Printf("Wrong user (%s) for workflowexecution workflow %s", user.Username, workflowExecution.Workflow.ID)
|
||||||
|
resp.WriteHeader(401)
|
||||||
|
resp.Write([]byte(`{"success": false}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Printf("API key %s is correct to abort %s", parsedKey, executionId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if workflowExecution.Status == "ABORTED" || workflowExecution.Status == "FAILURE" || workflowExecution.Status == "FINISHED" {
|
if workflowExecution.Status == "ABORTED" || workflowExecution.Status == "FAILURE" || workflowExecution.Status == "FINISHED" {
|
||||||
@@ -4685,7 +4697,22 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string,
|
|||||||
case mode.IsRegular():
|
case mode.IsRegular():
|
||||||
// Check the file
|
// Check the file
|
||||||
filename := file.Name()
|
filename := file.Name()
|
||||||
|
filteredNames := []string{"FUNDING.yml"}
|
||||||
if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") {
|
if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") {
|
||||||
|
|
||||||
|
contOuter := false
|
||||||
|
for _, name := range filteredNames {
|
||||||
|
if filename == name {
|
||||||
|
contOuter = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if contOuter {
|
||||||
|
log.Printf("Skipping %s", filename)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
//log.Printf("File: %s", filename)
|
//log.Printf("File: %s", filename)
|
||||||
//log.Printf("Found file: %s", filename)
|
//log.Printf("Found file: %s", filename)
|
||||||
log.Printf("OpenAPI app: %s", filename)
|
log.Printf("OpenAPI app: %s", filename)
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
#build: ./frontend
|
build: ./frontend
|
||||||
image: frikky/shuffle:frontend
|
image: frikky/shuffle:frontend
|
||||||
container_name: shuffle-frontend
|
container_name: shuffle-frontend
|
||||||
hostname: shuffle-frontend
|
hostname: shuffle-frontend
|
||||||
|
|||||||
Reference in New Issue
Block a user