publiclab/mapknitter

View on GitHub

Showing 127 of 127 total issues

ReDoS based DoS vulnerability in GlobalID
Open

    globalid (0.4.2)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2023-22799

URL: https://github.com/rails/globalid/releases/tag/v1.0.1

Solution: upgrade to >= 1.0.1

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

          downloadEl.click(function () {
            downloadEl.html('<i class="fa fa-circle-o-notch fa-spin"></i>');

            imgEl[0].onload = function () {
              var height = imgEl.height(),
Severity: Major
Found in app/assets/javascripts/mapknitter/Map.js and 1 other location - About 2 days to fix
app/assets/javascripts/mapknitter/Map.js on lines 443..479

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 398.

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

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

      downloadEl.click(function () {
        downloadEl.html('<i class="fa fa-circle-o-notch fa-spin"></i>');

        imgEl[0].onload = function () {
          var height = imgEl.height(),
Severity: Major
Found in app/assets/javascripts/mapknitter/Map.js and 1 other location - About 2 days to fix
app/assets/javascripts/mapknitter/Map.js on lines 49..85

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 398.

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

File Map.js has 555 lines of code (exceeds 250 allowed). Consider refactoring.
Open

MapKnitter.Map = MapKnitter.Class.extend({

  initialize: function (options) {
    this._zoom = options.zoom || 0;
    this._latlng = L.latLng(options.latlng);
Severity: Major
Found in app/assets/javascripts/mapknitter/Map.js - About 1 day to fix

    Inefficient Regular Expression Complexity in Loofah
    Open

        loofah (2.18.0)
    Severity: Critical
    Found in Gemfile.lock by bundler-audit

    Advisory: CVE-2022-23514

    Criticality: High

    URL: https://github.com/flavorjones/loofah/security/advisories/GHSA-486f-hjj9-9vhh

    Solution: upgrade to >= 2.19.1

    httparty has multipart/form-data request tampering vulnerability
    Open

        httparty (0.20.0)
    Severity: Minor
    Found in Gemfile.lock by bundler-audit

    Advisory:

    Criticality: Medium

    URL: https://github.com/jnunemaker/httparty/security/advisories/GHSA-5pq7-52mg-hr42

    Solution: upgrade to >= 0.21.0

    Uncontrolled Recursion in Loofah
    Open

        loofah (2.18.0)
    Severity: Critical
    Found in Gemfile.lock by bundler-audit

    Advisory: CVE-2022-23516

    Criticality: High

    URL: https://github.com/flavorjones/loofah/security/advisories/GHSA-3x8r-x6xp-q4vm

    Solution: upgrade to >= 2.19.1

    Improper neutralization of data URIs may allow XSS in Loofah
    Open

        loofah (2.18.0)
    Severity: Minor
    Found in Gemfile.lock by bundler-audit

    Advisory: CVE-2022-23515

    Criticality: Medium

    URL: https://github.com/flavorjones/loofah/security/advisories/GHSA-228g-948r-83gx

    Solution: upgrade to >= 2.19.1

    File knitter.js has 349 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Legacy!
    jQuery(document).ready(function($) {
      var Knitter = {
        // start storing a layer_type and layer_url in Map model, use it to switch this:
        openlayers_on: false,
    Severity: Minor
    Found in app/assets/javascripts/knitter.js - About 4 hrs to fix

      Class Map has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Map < ApplicationRecord
        include ActiveModel::Validations
        extend FriendlyId
        friendly_id :name, use: %i(slugged static)
      
      
      Severity: Minor
      Found in app/models/map.rb - About 4 hrs to fix

        Function initialize has 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          initialize: function (options) {
            this._zoom = options.zoom || 0;
            this._latlng = L.latLng(options.latlng);
            this.map_id = options.map_id || 0;
            this.readOnly = options.readOnly;
        Severity: Major
        Found in app/assets/javascripts/mapknitter/Map.js - About 4 hrs to fix

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

                var corners = [
                  L.latLng(wn[0].lat, wn[0].lon),
                  L.latLng(wn[1].lat, wn[1].lon),
                  L.latLng(wn[3].lat, wn[3].lon),
                  L.latLng(wn[2].lat, wn[2].lon),
          Severity: Major
          Found in app/assets/javascripts/mapknitter/Map.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/mapknitter/Map.js on lines 87..92

          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 112.

          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

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

                    var corners = [
                      L.latLng(wn[0].lat, wn[0].lon),
                      L.latLng(wn[1].lat, wn[1].lon),
                      L.latLng(wn[3].lat, wn[3].lon),
                      L.latLng(wn[2].lat, wn[2].lon)
          Severity: Major
          Found in app/assets/javascripts/mapknitter/Map.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/mapknitter/Map.js on lines 481..486

          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 112.

          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

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

            delete_poly: function(id) {
              $.ajax({
                url: "/annotation/delete_poly/"+id+"?back=/map/view/"+$A.map_name,
                type: "GET",
                failure: function(r) { alert('Polygon deletion failed. This may be a bug!') },
          Severity: Major
          Found in app/assets/javascripts/annotations-legacy.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/annotations-legacy.js on lines 135..145

          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 108.

          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

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

            delete_point: function(id) {
              $.ajax({
                url: "/annotation/delete/"+id+"?back=/map/view/"+$A.map_name,
                type: "GET",
                failure: function(r) { alert('Annotation deletion failed. This may be a bug!') },
          Severity: Major
          Found in app/assets/javascripts/annotations-legacy.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/annotations-legacy.js on lines 147..157

          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 108.

          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

          Function start_openlayers has 91 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              start_openlayers: function(layer,tile_url,tile_layer) {
                if (layer == "none") $('map').hide()
                else $('map').show()
                if (!Knitter.openlayers_on) Knitter.init_openlayers(layer)
                // http://isse.cr.usgs.gov/ArcGIS/services/Combined/TNM_Large_Scale_Imagery/MapServer/WMSServer?request=GetCapabilities&service=WMS
          Severity: Major
          Found in app/assets/javascripts/knitter.js - About 3 hrs to fix

            Method openid_authentication has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              def openid_authentication(openid_url, back_to)
                # puts openid_url
                authenticate_with_open_id(openid_url, required: %i(nickname email fullname)) do |result, identity_url, registration|
                  dummy_identity_url = identity_url
                  dummy_identity_url = dummy_identity_url.split('/')
            Severity: Minor
            Found in app/controllers/sessions_controller.rb - About 3 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 geocodeImage has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

              geocodeImage: function (img, fn, id) {
                EXIF.getData(img, function () {
                  var GPS = EXIF.getAllTags(img);
            
                  /* If the lat/lng is available. */
            Severity: Minor
            Found in app/assets/javascripts/mapknitter/Map.js - About 3 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 exports has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function(grunt) {
            
                require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
            
                grunt.initConfig({
            Severity: Major
            Found in app/assets/Gruntfile.js - About 3 hrs to fix

              Function setupCollection has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                setupCollection: function() {
              
                  map._imgGroup = L.distortableCollection({
                    editable: !mapknitter.readOnly,
                    exportOpts: {
              Severity: Major
              Found in app/assets/javascripts/mapknitter/Map.js - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language