Showing 943 of 943 total issues
Loofah 2.0.3 is vulnerable (CVE-2018-8048). Upgrade to 2.1.2 Open
loofah (2.0.3)
- Read upRead up
- Exclude checks
Potentially unsafe model attribute in link_to href Open
<%= link_to @organisation.website, @organisation.website, {:target => '_blank'} if @organisation.website.present?%>
- Read upRead up
- Exclude checks
Even though Rails will escape the link provided to link_to
, values starting with javascript:
or data:
are unescaped and dangerous.
Brakeman will warn on if user values are used to provide the HREF value in link_to
or if they are interpolated at the beginning of a string.
The --url-safe-methods
option can be used to specify methods which make URLs safe.
See here for more details.
protect_from_forgery should be configured with 'with: :exception' Open
require 'custom_errors'
- Read upRead up
- Exclude checks
Cross-site request forgery is #5 on the OWASP Top Ten. CSRF allows an attacker to perform actions on a website as if they are an authenticated user.
This warning is raised when no call to protect_from_forgery
is found in ApplicationController
. This method prevents CSRF.
For Rails 4 applications, it is recommended that you use protect_from_forgery :with => :exception
. This code is inserted into newly generated applications. The default is to nil
out the session object, which has been a source of many CSRF bypasses due to session memoization.
See the Ruby Security Guide for details.
rails-html-sanitizer 1.0.3 is vulnerable (CVE-2018-3741). Upgrade to 1.0.4 Open
rails-html-sanitizer (1.0.3)
- Read upRead up
- Exclude checks
Potentially unsafe model attribute in link_to href Open
<h4>Website: <span><%= link_to org.website, org.website, {:target => '_blank'} %></a></span></h4>
- Read upRead up
- Exclude checks
Even though Rails will escape the link provided to link_to
, values starting with javascript:
or data:
are unescaped and dangerous.
Brakeman will warn on if user values are used to provide the HREF value in link_to
or if they are interpolated at the beginning of a string.
The --url-safe-methods
option can be used to specify methods which make URLs safe.
See here for more details.
Method render_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render_error(status, error)
raise error unless Rails.env.production?
Rails.logger.error error.message
error.backtrace.each_with_index { |line, index| Rails.logger.error line; break if index >= 5 }
- Read upRead up
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 build_map_markers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_map_markers(organisations)
::MapMarkerJson.build(organisations) do |org, marker|
marker.lat org.latitude
marker.lng org.longitude
marker.infowindow render_to_string(partial: 'organisations/popup', locals: {org: org})
- Read upRead up
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
Line contains inconsistent indentation Open
$('#toggle_link').click()
- Exclude checks
Line contains inconsistent indentation Open
menu.addClass('open')
- Exclude checks
Line contains inconsistent indentation Open
$('.nav-collapse').collapse('show')
- Exclude checks
Line contains inconsistent indentation Open
menu = $('#menuLogin');
- Exclude checks
Heading (h2) should not be qualified. Open
#cookie-message-inner h2 {
- Exclude checks
Values of 0 shouldn't have units specified. Open
padding-bottom: 0px !important;
- Exclude checks
Don't use IDs in selectors. Open
#footer {
- Exclude checks
Don't use IDs in selectors. Open
#push, #footer {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.nav > li {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.navbar .nav>li>a {
- Exclude checks
Values of 0 shouldn't have units specified. Open
padding-top: 0px !important;
- Exclude checks
Values of 0 shouldn't have units specified. Open
min-height: 0%;
- Exclude checks
Don't use IDs in selectors. Open
#main p, a {
- Exclude checks