secureCodeBox/secureCodeBox

View on GitHub

Showing 195 of 515 total issues

Method ScanReconciler.ensureServiceAccountExists has 88 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

    Function mergeCascadingRuleWithScan has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function mergeCascadingRuleWithScan(scan: Scan, cascadingRule: CascadingRule) {
      const {scanAnnotations, scanLabels} = cascadingRule.spec;
      let {
        env = [],
        volumes = [],
    Severity: Major
    Found in hooks/cascading-scans/hook/hook.ts - About 2 hrs to fix

      Function purgeCascadedRuleFromScan has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function purgeCascadedRuleFromScan(
        scan: Scan,
        cascadedRuleUsedForParentScan?: CascadingRule
      ): Scan {
        // If there was no cascading rule applied to the parent scan, then ignore no purging is necessary.
      Severity: Major
      Found in hooks/cascading-scans/hook/scan-helpers.ts - About 2 hrs to fix

        Function getCascadingScan has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getCascadingScan(
          parentScan: Scan,
          finding: Finding,
          cascadingRule: CascadingRule
        ) {
        Severity: Major
        Found in hooks/cascading-scans/hook/hook.ts - About 2 hrs to fix

          File scope-limiter.ts has 269 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // SPDX-FileCopyrightText: the secureCodeBox authors
          //
          // SPDX-License-Identifier: Apache-2.0
          
          import {Finding, ScopeLimiter, ScopeLimiterAliases} from "./scan-helpers";
          Severity: Minor
          Found in hooks/cascading-scans/hook/scope-limiter.ts - About 2 hrs to fix

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

            // SPDX-FileCopyrightText: the secureCodeBox authors
            //
            // SPDX-License-Identifier: Apache-2.0
            
            const templates = {
            Severity: Minor
            Found in scanners/ssh-audit/parser/parser.js - About 2 hrs to fix

              Function start_spider has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def start_spider(self, url: str, spider_config: collections.OrderedDict):
                      """Starts a ZAP Spider with the given spiders configuration, based on the internal referenced ZAP instance.
              
                      Parameters
                      ----------
              Severity: Minor
              Found in scanners/zap-advanced/scanner/zapclient/spider/zap_spider_ajax.py - About 2 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

              Function _get_active_config_from has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _get_active_config_from(self, configs: collections.OrderedDict, key: str):
                      """Returns the active configuration by matching url or context
              
                      Parameters
                      ----------

              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

              Function parse has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function parse(fileContent) {
                const db = await openDatabase(fileContent);
                const tableExists = await checkIfTableExists(db);
                if (!tableExists) return [];
              
              
              Severity: Major
              Found in scanners/amass/parser/parser.js - About 2 hrs to fix

                File docs.build.js has 266 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: Minor
                Found in documentation/src/docs.build.js - About 2 hrs to fix

                  Method ScanReconciler.processPendingHook has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (r *ScanReconciler) processPendingHook(scan *executionv1.Scan, status *executionv1.HookStatus, jobType string) error {
                      ctx := context.Background()
                      var err error
                  
                      var hookName string
                  Severity: Major
                  Found in operator/controllers/execution/scans/hook_reconciler.go - About 2 hrs to fix

                    Function getPredicatesForEnabledPerNamespace has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func getPredicatesForEnabledPerNamespace(client client.Client, log logr.Logger) predicate.Predicate {
                        return predicate.Funcs{
                            CreateFunc: func(event event.CreateEvent) bool {
                    
                                if val, ok := event.Object.GetAnnotations()["auto-discovery.securecodebox.io/ignore"]; ok && val == "true" {
                    Severity: Minor
                    Found in auto-discovery/kubernetes/pkg/util/filter.go - About 2 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

                    Function analyseCertificateDeployments has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function analyseCertificateDeployments(serverScanResult) {
                      if (serverScanResult?.scan_result?.certificate_info?.result?.certificate_deployments) {
                        const certificateInfos = serverScanResult.scan_result.certificate_info.result.certificate_deployments.map(
                          analyseCertificateDeployment
                        );
                    Severity: Major
                    Found in scanners/sslyze/parser/parser.js - About 2 hrs to fix

                      File VersionedEngagementsStrategy.java has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      // SPDX-FileCopyrightText: the secureCodeBox authors
                      //
                      // SPDX-License-Identifier: Apache-2.0
                      package io.securecodebox.persistence.strategies;
                      
                      

                        Function getExamples has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        async function getExamples(dir) {
                          if (!fs.existsSync(dir)) {
                            return [];
                          }
                        
                        
                        Severity: Major
                        Found in documentation/src/docs.build.js - About 2 hrs to fix

                          File V1ScanStatus.java has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

                            Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            async function parse(findings) {
                              let results = [];
                            
                              Object.keys(findings).forEach((key) => {
                                const domain = key;
                            Severity: Major
                            Found in scanners/typo3scan/parser/parser.js - About 2 hrs to fix

                              Method equals has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                @Override
                                public boolean equals(Object o) {
                                  if (this == o) {
                                    return true;
                                  }

                              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

                              Function parse has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function parse(fileContent) {
                                const hosts = fileContent;
                              
                                if (typeof (hosts) === "string") // empty file
                                  return [];
                              Severity: Major
                              Found in scanners/ssh-scan/parser/parser.js - About 2 hrs to fix

                                Function getTestData has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function getTestData() {
                                  const scan: Scan = {
                                    metadata: {
                                      uid: "09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
                                      name: "demo-scan-1601086432",
                                Severity: Major
                                Found in hooks/notification/hook/Notifiers/RocketChatNotifier.test.ts - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language