secureCodeBox/secureCodeBox

View on GitHub

Showing 202 of 524 total issues

File hook.test.js has 2560 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0

const {getCascadingScans} = require("./hook");
Severity: Major
Found in hooks/cascading-scans/hook/hook.test.js - About 1 wk to fix

    File parser.test.js has 1226 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // SPDX-FileCopyrightText: the secureCodeBox authors
    //
    // SPDX-License-Identifier: Apache-2.0
    
    const { readFile } = require("fs/promises");
    Severity: Major
    Found in scanners/nmap/parser/parser.test.js - About 3 days to fix

      File scope-limiter.test.js has 942 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // SPDX-FileCopyrightText: the secureCodeBox authors
      //
      // SPDX-License-Identifier: Apache-2.0
      
      const {isInScope: isInScopeInternal} = require("./scope-limiter");
      Severity: Major
      Found in hooks/cascading-scans/hook/scope-limiter.test.js - About 2 days to fix

        File parser.test.js has 872 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // SPDX-FileCopyrightText: the secureCodeBox authors
        //
        // SPDX-License-Identifier: Apache-2.0
        
        const fs = require("fs");
        Severity: Major
        Found in scanners/ssh-audit/parser/parser.test.js - About 2 days to fix

          File parser.test.js has 722 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // SPDX-FileCopyrightText: the secureCodeBox authors
          //
          // SPDX-License-Identifier: Apache-2.0
          
          const { readFile } = require("fs/promises");
          Severity: Major
          Found in scanners/sslyze/parser/parser.test.js - About 1 day to fix

            File zz_generated.deepcopy.go has 844 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            //go:build !ignore_autogenerated
            // +build !ignore_autogenerated
            
            // SPDX-FileCopyrightText: the secureCodeBox authors
            //
            Severity: Major
            Found in operator/apis/execution/v1/zz_generated.deepcopy.go - About 1 day to fix

              File parser.test.js has 570 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // SPDX-FileCopyrightText: the secureCodeBox authors
              //
              // SPDX-License-Identifier: Apache-2.0
              
              const { readFile } = require("fs/promises");
              Severity: Major
              Found in scanners/git-repo-scanner/parser/parser.test.js - About 1 day to fix

                Method ScanReconciler.startParser has 205 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
                    ctx := context.Background()
                    namespacedName := fmt.Sprintf("%s/%s", scan.Namespace, scan.Name)
                    log := r.Log.WithValues("scan_parse", namespacedName)
                
                
                Severity: Major
                Found in operator/controllers/execution/scans/parse_reconciler.go - About 7 hrs to fix

                  Method ScanReconciler.constructJobForScan has 189 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanTypeSpec *executionv1.ScanTypeSpec) (*batch.Job, error) {
                      filename := filepath.Base(scanTypeSpec.ExtractResults.Location)
                      urlExpirationDuration, err := util.GetUrlExpirationDuration(util.ScanController)
                      if err != nil {
                          r.Log.Error(err, "Failed to parse scan url expiration")
                  Severity: Major
                  Found in operator/controllers/execution/scans/scan_reconciler.go - About 6 hrs to fix

                    Function HomePage has 145 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function HomePage() {
                      const { isDarkTheme } = useColorMode();
                    
                      return (
                        <>
                    Severity: Major
                    Found in documentation/src/pages/index.tsx - About 5 hrs to fix

                      V1ScanStatus has 42 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      @ApiModel(description = "ScanStatus defines the observed state of Scan")
                      @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2021-11-17T10:13:00.848Z[Etc/UTC]")
                      public class V1ScanStatus {
                        public static final String SERIALIZED_NAME_ERROR_DESCRIPTION = "errorDescription";
                        @SerializedName(SERIALIZED_NAME_ERROR_DESCRIPTION)

                        File parser.test.js has 402 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        // SPDX-FileCopyrightText: the secureCodeBox authors
                        //
                        // SPDX-License-Identifier: Apache-2.0
                        
                        const { readFile } = require("fs/promises");
                        Severity: Minor
                        Found in scanners/gitleaks/parser/parser.test.js - About 5 hrs to fix

                          Function isInScope has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function isInScope(
                            scopeLimiter: ScopeLimiter,
                            scanAnnotations: V1ObjectMeta["annotations"],
                            finding: Finding,
                            scopeLimiterAliases: ScopeLimiterAliases
                          Severity: Minor
                          Found in hooks/cascading-scans/hook/scope-limiter.ts - About 5 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          File hook.test.js has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          // SPDX-FileCopyrightText: the secureCodeBox authors
                          //
                          // SPDX-License-Identifier: Apache-2.0
                          
                          const { handle } = require("./hook")
                          Severity: Minor
                          Found in hooks/finding-post-processing/hook/hook.test.js - About 5 hrs to fix

                            File hook.ts has 367 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // SPDX-FileCopyrightText: the secureCodeBox authors
                            //
                            // SPDX-License-Identifier: Apache-2.0
                            
                            import {
                            Severity: Minor
                            Found in hooks/cascading-scans/hook/hook.ts - About 4 hrs to fix

                              Function isInScope has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function isInScope(
                                scopeLimiter: ScopeLimiter,
                                scanAnnotations: V1ObjectMeta["annotations"],
                                finding: Finding,
                                scopeLimiterAliases: ScopeLimiterAliases
                              Severity: Major
                              Found in hooks/cascading-scans/hook/scope-limiter.ts - About 4 hrs to fix

                                Method ScanReconciler.createJobForHook has 143 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (r *ScanReconciler) createJobForHook(hookName string, hookSpec *executionv1.ScanCompletionHookSpec, scan *executionv1.Scan, cliArgs []string) (string, error) {
                                    ctx := context.Background()
                                
                                    serviceAccountName := "scan-completion-hook"
                                    if hookSpec.ServiceAccountName != nil {
                                Severity: Major
                                Found in operator/controllers/execution/scans/hook_reconciler.go - About 4 hrs to fix

                                  Method ServiceScanReconciler.Reconcile has 140 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func (r *ServiceScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
                                      log := r.Log
                                  
                                      log.V(8).Info("Something happened to a service", "service", req.Name, "namespace", req.Namespace)
                                  
                                  
                                  Severity: Major
                                  Found in auto-discovery/kubernetes/controllers/service_scan_controller.go - About 4 hrs to fix

                                    Method ServiceScanReconciler.Reconcile has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    func (r *ServiceScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
                                        log := r.Log
                                    
                                        log.V(8).Info("Something happened to a service", "service", req.Name, "namespace", req.Namespace)
                                    
                                    
                                    Severity: Minor
                                    Found in auto-discovery/kubernetes/controllers/service_scan_controller.go - About 4 hrs to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    File zap_context.py has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    #!/usr/bin/env python
                                    
                                    # SPDX-FileCopyrightText: the secureCodeBox authors
                                    #
                                    # SPDX-License-Identifier: Apache-2.0
                                    Severity: Minor
                                    Found in scanners/zap-advanced/scanner/zapclient/context/zap_context.py - About 4 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language