lib/archive_utilities.rb

Summary

Maintainability
A
35 mins
Test Coverage

Possible command injection
Open

          `cp #{full_filename} #{target_directory}; cd #{target_directory}; gunzip #{filename}`
Severity: Minor
Found in lib/archive_utilities.rb by brakeman

Injection is #1 on the 2010 OWASP Top Ten web security risks. Command injection occurs when shell commands unsafely include user-manipulatable values.

There are many ways to run commands in Ruby:

`ls #{params[:file]}`

system("ls #{params[:dir]}")

exec("md5sum #{params[:input]}")

Brakeman will warn on any method like these that uses user input or unsafely interpolates variables.

See the Ruby Security Guide for details.

Possible command injection
Open

        `tar xf #{full_filename} #{target_directory}`
Severity: Minor
Found in lib/archive_utilities.rb by brakeman

Injection is #1 on the 2010 OWASP Top Ten web security risks. Command injection occurs when shell commands unsafely include user-manipulatable values.

There are many ways to run commands in Ruby:

`ls #{params[:file]}`

system("ls #{params[:dir]}")

exec("md5sum #{params[:input]}")

Brakeman will warn on any method like these that uses user input or unsafely interpolates variables.

See the Ruby Security Guide for details.

Possible command injection
Open

        `unzip #{full_filename} -d #{target_directory}`
Severity: Minor
Found in lib/archive_utilities.rb by brakeman

Injection is #1 on the 2010 OWASP Top Ten web security risks. Command injection occurs when shell commands unsafely include user-manipulatable values.

There are many ways to run commands in Ruby:

`ls #{params[:file]}`

system("ls #{params[:dir]}")

exec("md5sum #{params[:input]}")

Brakeman will warn on any method like these that uses user input or unsafely interpolates variables.

See the Ruby Security Guide for details.

Possible command injection
Open

          `tar xfz #{full_filename} -C #{target_directory}`
Severity: Minor
Found in lib/archive_utilities.rb by brakeman

Injection is #1 on the 2010 OWASP Top Ten web security risks. Command injection occurs when shell commands unsafely include user-manipulatable values.

There are many ways to run commands in Ruby:

`ls #{params[:file]}`

system("ls #{params[:dir]}")

exec("md5sum #{params[:input]}")

Brakeman will warn on any method like these that uses user input or unsafely interpolates variables.

See the Ruby Security Guide for details.

Method has too many lines. [12/10]
Open

    def decompress_under(target_directory)
      case content_type
      when 'application/zip', 'application/x-zip', 'application/x-zip-compressed'
        `unzip #{full_filename} -d #{target_directory}`
      when 'application/x-gtar', 'application/x-tar'
Severity: Minor
Found in lib/archive_utilities.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method decompress_under has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def decompress_under(target_directory)
      case content_type
      when 'application/zip', 'application/x-zip', 'application/x-zip-compressed'
        `unzip #{full_filename} -d #{target_directory}`
      when 'application/x-gtar', 'application/x-tar'
Severity: Minor
Found in lib/archive_utilities.rb - About 35 mins 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

There are no issues that match your filters.

Category
Status