Showing 73 of 94 total issues

Update packaged libxml2 (2.9.12 → 2.9.13) and libxslt (1.1.34 → 1.1.35)
Open

    nokogiri (1.12.5)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2021-30560

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-fq42-c5rg-92c2

Solution: upgrade to >= 1.13.2

Out-of-bounds Write in zlib affects Nokogiri
Open

    nokogiri (1.12.5)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2018-25032

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-v6gp-9mmm-c6p5

Solution: upgrade to >= 1.13.4

Denial of Service (DoS) in Nokogiri on JRuby
Open

    nokogiri (1.12.5)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-24839

Criticality: High

URL: https://github.com/sparklemotion/nekohtml/security/advisories/GHSA-9849-p7jc-9rmv

Solution: upgrade to >= 1.13.4

Improper Handling of Unexpected Data Type in Nokogiri
Open

    nokogiri (1.12.5)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-29181

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xh29-r2w5-wx8m

Solution: upgrade to >= 1.13.6

Integer Overflow or Wraparound in libxml2 affects Nokogiri
Open

    nokogiri (1.12.5)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory:

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-cgx6-hpwq-fhv5

Solution: upgrade to >= 1.13.5

Update bundled libxml2 to v2.10.3 to resolve multiple CVEs
Open

    nokogiri (1.12.5)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Inefficient Regular Expression Complexity in Nokogiri
Open

    nokogiri (1.12.5)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-24836

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-crjr-9rc5-ghw8

Solution: upgrade to >= 1.13.4

XML Injection in Xerces Java affects Nokogiri
Open

    nokogiri (1.12.5)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-23437

Criticality: Medium

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xxx9-3xcr-gjj3

Solution: upgrade to >= 1.13.4

File engine.rb has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'json'
require 'net/http'

ANNOUNCE_URL = 'https://scc.suse.com/connect/subscriptions/systems'.freeze
ACTIVATE_PRODUCT_URL = 'https://scc.suse.com/connect/systems/products'.freeze
Severity: Minor
Found in engines/scc_proxy/lib/scc_proxy/engine.rb - About 3 hrs to fix

    Method scc_check_subscription_expiration has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
    Open

        def scc_check_subscription_expiration(headers, login, system_token, logger)
          auth = headers['HTTP_AUTHORIZATION'] if headers.include?('HTTP_AUTHORIZATION')
          uri = URI.parse(SYSTEMS_ACTIVATIONS_URL)
          http = Net::HTTP.new(uri.host, uri.port)
          http.use_ssl = true
    Severity: Minor
    Found in engines/scc_proxy/lib/scc_proxy/engine.rb - 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

    Method try_copying_from_cache has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
    Open

      def try_copying_from_cache(files, ignore_errors: false)
        # We need to verify if the cached copy is still relevant
        # Create a HTTP/HTTPS HEAD request if possible, return nil if not
        cache_requests = files.map { |file| [file, cache_head_request(file)] }.to_h
        available_in_cache = cache_requests.compact.values
    Severity: Minor
    Found in lib/rmt/downloader.rb - 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

    File products_controller_spec.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'rails_helper'
    
    # rubocop:disable RSpec/NestedGroups
    
    describe Api::Connect::V3::Systems::ProductsController, type: :request do

      Method in_alpha_or_beta? has a Cognitive Complexity of 22 (exceeds 10 allowed). Consider refactoring.
      Open

        def in_alpha_or_beta?
          products = []
          unless errored_repos_id.empty?
            products = Product.joins(:repositories).where(
              'repositories.id' => errored_repos_id
      Severity: Minor
      Found in lib/rmt/cli/mirror.rb - 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

      Method handle_exceptions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def handle_exceptions
            yield
          rescue RMT::Deduplicator::HardlinkException => e
            raise RMT::CLI::Error.new(
              _('Could not create deduplication hardlink: %{error}.') % { error: e.message },
      Severity: Minor
      Found in lib/rmt/cli/base.rb - About 2 hrs to fix

        Method scc_check_subscription_expiration has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def scc_check_subscription_expiration(headers, login, system_token, logger)
              auth = headers['HTTP_AUTHORIZATION'] if headers.include?('HTTP_AUTHORIZATION')
              uri = URI.parse(SYSTEMS_ACTIVATIONS_URL)
              http = Net::HTTP.new(uri.host, uri.port)
              http.use_ssl = true
        Severity: Minor
        Found in engines/scc_proxy/lib/scc_proxy/engine.rb - About 1 hr to fix

          Method authenticate_system has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring.
          Open

                  def authenticate_system(skip_on_duplicated: false)
                    authenticate_or_request_with_http_basic('RMT API') do |login, password|
                      @systems = System.get_by_credentials(login, password)
                      if @systems.present?
                        # Return now if we just detected duplicates and we were told to skip on
          Severity: Minor
          Found in engines/scc_proxy/lib/scc_proxy/engine.rb - About 1 hr 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

          Method clean has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def clean
              base_directory = RMT::DEFAULT_MIRROR_DIR
          
              repos_to_delete = Repository.where(mirroring_enabled: false).map do |repo|
                repository_dir = File.join(base_directory, repo.local_path)
          Severity: Minor
          Found in lib/rmt/cli/repos.rb - About 1 hr to fix

            Method try_copying_from_cache has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def try_copying_from_cache(files, ignore_errors: false)
                # We need to verify if the cached copy is still relevant
                # Create a HTTP/HTTPS HEAD request if possible, return nil if not
                cache_requests = files.map { |file| [file, cache_head_request(file)] }.to_h
                available_in_cache = cache_requests.compact.values
            Severity: Minor
            Found in lib/rmt/downloader.rb - About 1 hr to fix

              Method get_system has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
              Open

                      def get_system(systems)
                        return nil if systems.blank?
              
                        byos_systems_with_token = systems.select { |system| system.proxy_byos && system.system_token }
              
              
              Severity: Minor
              Found in engines/scc_proxy/lib/scc_proxy/engine.rb - About 1 hr 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      context 'when SCC request fails' do
                        before do
                          stub_request(:get, scc_systems_activations_url).to_return(status: 401, body: [body_expired].to_json, headers: {})
                          expect(URI).to receive(:encode_www_form).with({ byos: true })
                          allow(File).to receive(:directory?)
              engines/zypper_auth/spec/requests/strict_authentication/authentication_controller_spec.rb on lines 163..173

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 55.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language