secureCodeBox/secureCodeBox-v2-alpha

View on GitHub

Showing 45 of 45 total issues

Method ScanReconciler.startParser has 140 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 4 hrs to fix

    Function transformNmapScriptSmb has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    function transformNmapScriptSmb(host, script, scriptFindings) {
    // Parse SMB Script Results
    if(script.$.id === 'smb-protocols') {
    console.log ("Found SMB Script Result: " + script.$.output);
    //console.log (script);
    Severity: Minor
    Found in scanners/nmap/parser/parser.js - About 4 hrs to fix

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

    func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *executionv1.ScanType) (*batch.Job, error) {
    filename := filepath.Base(scanType.Spec.ExtractResults.Location)
    resultUploadURL, err := r.PresignedPutURL(scan.UID, filename, defaultPresignDuration)
    if err != nil {
    r.Log.Error(err, "Could not get presigned url from s3 or compatible storage provider")
    Severity: Major
    Found in operator/controllers/execution/scans/scan_reconciler.go - About 4 hrs to fix

      File hook_reconciler.go has 378 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      package scancontrollers
       
      import (
      "context"
      "fmt"
      Severity: Minor
      Found in operator/controllers/execution/scans/hook_reconciler.go - About 3 hrs to fix

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

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

          Function transformNmapScriptSmb has 111 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          function transformNmapScriptSmb(host, script, scriptFindings) {
          // Parse SMB Script Results
          if(script.$.id === 'smb-protocols') {
          console.log ("Found SMB Script Result: " + script.$.output);
          //console.log (script);
          Severity: Major
          Found in scanners/nmap/parser/parser.js - About 3 hrs to fix

            Method ScanReconciler.executeReadAndWriteHooks has 101 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (r *ScanReconciler) executeReadAndWriteHooks(scan *executionv1.Scan) error {
            // Get the first Hook Status which is not completed.
            ctx := context.Background()
            var nonCompletedHook *executionv1.HookStatus
             
             
            Severity: Major
            Found in operator/controllers/execution/scans/hook_reconciler.go - About 3 hrs to fix

              Method ScanReconciler.executeReadAndWriteHooks has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
              Open

              func (r *ScanReconciler) executeReadAndWriteHooks(scan *executionv1.Scan) error {
              // Get the first Hook Status which is not completed.
              ctx := context.Background()
              var nonCompletedHook *executionv1.HookStatus
               
               
              Severity: Minor
              Found in operator/controllers/execution/scans/hook_reconciler.go - About 2 hrs to fix

              Function parseResultFile has 89 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              function parseResultFile(fileContent) {
              return new Promise((resolve, reject) => {
              xml2js.parseString(fileContent, (err, xmlInput) => {
              if (err) {
              reject(new Error('Error converting XML to JSON in xml2js: ' + err));
              Severity: Major
              Found in scanners/nmap/parser/parser.js - About 2 hrs to fix

                Method ScanReconciler.ensureServiceAccountExists has 80 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (r *ScanReconciler) ensureServiceAccountExists(namespace, serviceAccountName, description string, policyRules []rbacv1.PolicyRule) error {
                ctx := context.Background()
                 
                var serviceAccount corev1.ServiceAccount
                err := r.Get(ctx, types.NamespacedName{Name: serviceAccountName, Namespace: namespace}, &serviceAccount)
                Severity: Major
                Found in operator/controllers/execution/scans/serviceaccount.go - About 2 hrs to fix

                  Method ScheduledScanReconciler.Reconcile has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (r *ScheduledScanReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
                  ctx := context.Background()
                  log := r.Log.WithValues("scheduledscan", req.NamespacedName)
                   
                  // get the ScheduledScan
                  Severity: Major
                  Found in operator/controllers/execution/scheduledscan_controller.go - About 2 hrs to fix

                    Method ScanReconciler.startScan has 72 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (r *ScanReconciler) startScan(scan *executionv1.Scan) error {
                    ctx := context.Background()
                    namespacedName := fmt.Sprintf("%s/%s", scan.Namespace, scan.Name)
                    log := r.Log.WithValues("scan_init", namespacedName)
                     
                     
                    Severity: Minor
                    Found in operator/controllers/execution/scans/scan_reconciler.go - About 1 hr to fix

                      Function parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      async function parse(scanResults) {
                      // The first scan always contains the image id a similar format to: "bkimminich/juice-shop:v10.2.0 (alpine 3.11.5)"
                      const [imageScanResult] = scanResults;
                      const [imageId] = imageScanResult.Target.split(" ", 2);
                       
                       
                      Severity: Minor
                      Found in scanners/trivy/parser/parser.js - About 1 hr to fix

                      Function categorize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function categorize({ id }) {
                      if (id === 999957) {
                      return ["X-Frame-Options Header", LOW];
                      } else if (id === 999102) {
                      return ["X-XSS-Protection", LOW];
                      Severity: Minor
                      Found in scanners/nikto/parser/parser.js - About 1 hr to fix

                      Function getCascadingScans has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function getCascadingScans(
                      parentScan: Scan,
                      findings: Array<Finding>,
                      cascadingRules: Array<CascadingRule>
                      ): Array<ExtendedScanSpec> {
                      Severity: Minor
                      Found in hooks/declarative-subsequent-scans/hook.ts - About 1 hr to fix

                      Method ScanReconciler.startReadOnlyHooks has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (r *ScanReconciler) startReadOnlyHooks(scan *executionv1.Scan) error {
                      ctx := context.Background()
                       
                      var scanCompletionHooks executionv1.ScanCompletionHookList
                       
                       
                      Severity: Minor
                      Found in operator/controllers/execution/scans/hook_reconciler.go - About 1 hr to fix

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

                        func (r *ScheduledScanReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
                        ctx := context.Background()
                        log := r.Log.WithValues("scheduledscan", req.NamespacedName)
                         
                        // get the ScheduledScan
                        Severity: Minor
                        Found in operator/controllers/execution/scheduledscan_controller.go - About 1 hr to fix

                        Method ScanReconciler.executeReadAndWriteHooks has 14 return statements (exceeds 4 allowed).
                        Open

                        func (r *ScanReconciler) executeReadAndWriteHooks(scan *executionv1.Scan) error {
                        // Get the first Hook Status which is not completed.
                        ctx := context.Background()
                        var nonCompletedHook *executionv1.HookStatus
                         
                         
                        Severity: Major
                        Found in operator/controllers/execution/scans/hook_reconciler.go - About 1 hr to fix

                          Method ScanReconciler.startScan has 11 return statements (exceeds 4 allowed).
                          Open

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

                            Function transformNMAPScripts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function transformNMAPScripts(hosts) {
                            let scriptFindings = [];
                             
                            for(const host of hosts) {
                             
                             
                            Severity: Minor
                            Found in scanners/nmap/parser/parser.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language