diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..727aa8d9 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,67 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '38 16 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'go', 'javascript', 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # âšī¸ Command-line programs to run using the OS shell. + # đ https://git.io/JvXDl + + # âī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/backend/go-app/codegen.go b/backend/go-app/codegen.go index 9de39237..4b20d2fa 100644 --- a/backend/go-app/codegen.go +++ b/backend/go-app/codegen.go @@ -504,7 +504,7 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger, var parse parsed err := json.Unmarshal([]byte(parsedCategories), &parse) if err != nil { - log.Printf("Failed unmarshaling categories", err) + log.Printf("Failed unmarshaling categories: %v", err) } else { api.Categories = parse.Categories } diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 80157f6e..f0fbc5c6 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -870,7 +870,7 @@ func deleteUser(resp http.ResponseWriter, request *http.Request) { err = setUser(ctx, foundUser) if err != nil { - log.Printf("Failed swapping active for user %s (%s)", foundUser, foundUser.Username, foundUser.Id) + log.Printf("Failed swapping active for user %s (%s)", foundUser.Username, foundUser.Id) resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false}`))) return @@ -2033,7 +2033,7 @@ func handlePasswordChange(resp http.ResponseWriter, request *http.Request) { if len(users) != 1 { log.Printf(`Found multiple or no users with the same username: %s: %d`, t.Username, len(users)) resp.WriteHeader(401) - resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Found %d users with the same username: %s (%d)"}`, len(users), t.Username))) + resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Found %d users with the same username: %s"}`, len(users), t.Username))) return } @@ -2505,7 +2505,7 @@ func handleLogin(resp http.ResponseWriter, request *http.Request) { } if !Userdata.Active { - log.Printf("%s is not active, but tried to login", data.Username, err) + log.Printf("%s is not active, but tried to login. Error: %v", data.Username, err) resp.WriteHeader(401) resp.Write([]byte(`{"success": false, "reason": "This user is deactivated"}`)) return @@ -3584,7 +3584,7 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) { func executeCloudAction(action CloudSyncJob, apikey string) error { data, err := json.Marshal(action) if err != nil { - log.Printf("Failed cloud webhook action marshalling", err) + log.Printf("Failed cloud webhook action marshalling: %s", err) return err } @@ -5389,7 +5389,7 @@ func handleGetSpecificStats(resp http.ResponseWriter, request *http.Request) { b, err := json.Marshal(statisticsItem) if err != nil { - log.Println("Failed to marshal data: %s", err) + log.Printf("Failed to marshal data: %s", err) resp.WriteHeader(401) return } @@ -7969,7 +7969,7 @@ func handleCloudSetup(resp http.ResponseWriter, request *http.Request) { if err != nil { log.Printf("Failed marshaling api key data: %s", err) resp.WriteHeader(401) - resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Failed cloud sync."}`, err))) + resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Failed cloud sync: %s"}`, err))) return } diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 8d3b0df6..4d858dc6 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -16,10 +16,10 @@ import ( "time" "cloud.google.com/go/datastore" - "cloud.google.com/go/scheduler/apiv1" + scheduler "cloud.google.com/go/scheduler/apiv1" gyaml "github.com/ghodss/yaml" "github.com/h2non/filetype" - "github.com/satori/go.uuid" + uuid "github.com/satori/go.uuid" "google.golang.org/api/cloudfunctions/v1" schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1" @@ -3501,7 +3501,7 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf } if len(allEnvs) == 0 { - log.Printf("[ERROR] No active environments found for org", workflowExecution.ExecutionOrg) + log.Printf("[ERROR] No active environments found for org: %s", workflowExecution.ExecutionOrg) return WorkflowExecution{}, "No active environments found", errors.New(fmt.Sprintf("No active env found for org %s", workflowExecution.ExecutionOrg)) } @@ -3871,7 +3871,7 @@ func stopSchedule(resp http.ResponseWriter, request *http.Request) { err = executeCloudAction(action, org.SyncConfig.Apikey) if err != nil { - log.Printf("Failed cloud action STOP schedule", err) + log.Printf("Failed cloud action STOP schedule: %s", err) resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err))) return @@ -4212,7 +4212,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) { err = setSchedule(ctx, newSchedule) if err != nil { - log.Printf("Failed setting cloud schedule: returning", err) + log.Printf("Failed setting cloud schedule: %s", err) resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err))) return @@ -4221,7 +4221,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) { log.Printf("Action: %#v", action) err = executeCloudAction(action, org.SyncConfig.Apikey) if err != nil { - log.Printf("Failed cloud action START schedule", err) + log.Printf("Failed cloud action START schedule: %s", err) resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err))) return @@ -7192,7 +7192,7 @@ func handleDeleteHook(resp http.ResponseWriter, request *http.Request) { err = executeCloudAction(action, org.SyncConfig.Apikey) if err != nil { - log.Printf("Failed cloud action STOP execution", err) + log.Printf("Failed cloud action STOP execution: %s", err) resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err))) return diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 394331aa..223525c6 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -569,6 +569,9 @@ const AngularWorkflow = (props) => { } break case "FAILURE": + //When status comes as failure, allow user to start workflow execution + setExecutionRunning(false) + currentnode.removeClass('not-executing-highlight') currentnode.removeClass('executing-highlight') currentnode.removeClass('success-highlight') @@ -6625,7 +6628,7 @@ const AngularWorkflow = (props) => { } : -