labml icon indicating copy to clipboard operation
labml copied to clipboard

superclass mismatch for class Mark

Open akimd opened this issue 4 years ago • 2 comments

Background

Brakeman version: 4.10.0 Rails version: 6.0.3.4 Ruby version: 2.5.7p206

Link to Rails application code: private, sorry.

Issue

What problem are you seeing?

In my logs, I have two errors:

  "errors": [
    {
      "error": "undefined method `force_encoding' for #<Brakeman::FilePath:0x000055b662474f50> While processing /home/solutions/reference_dev/reference_dev/app/views/commandes/test_model.html.erb",
      "location": "/opt/ruby-2.5.7/lib/ruby/gems/2.5.0/gems/brakeman-4.10.0/bundle/ruby/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser_extras.rb:604:in `literal_concat'"
    },
    {
      "error": "superclass mismatch for class Mark",
      "location": "/opt/ruby-2.5.7/lib/ruby/2.5.0/psych/parser.rb:34:in `<class:Parser>'"
    }
  ],

I have created #1542 for the first error. This issue is about the Mark stuff. It appears to be related to Psych, and is already the topic of issues elsewhere (e.g., https://github.com/rubocop-hq/rubocop/issues/6781).

Cheers!

akimd avatar Jan 07 '21 12:01 akimd

This looks like an issue with a particular version of Ruby? 2.5 is EOL next month.

presidentbeef avatar Feb 11 '21 01:02 presidentbeef

I'm seeing the latter error w/ ruby 2.6 and the latest released version of brakeman

#!/usr/bin/env ruby
# This binstub ensures that you are running the latest version of Brakeman.

require "bundler/inline"

gemfile do
  source "https://gems.myorg.com"
  gem "brakeman", Gem.latest_version_for("brakeman")

  # Brakeman will throw some false positives when analyzing coffeescript inside haml
  # files unless we include the coffee-script gem to allow it to parse correctly

  gem 'coffee-script'
end

load Gem.bin_path("brakeman", "brakeman")

/opt/rh/rh-ruby26/root/usr/lib64/ruby/psych.so: warning: already initialized constant Psych::Parser::UTF8

/opt/rh/rh-ruby26/root/usr/lib64/ruby/psych.so: warning: already initialized constant Psych::Parser::UTF16LE

/opt/rh/rh-ruby26/root/usr/lib64/ruby/psych.so: warning: already initialized constant Psych::Parser::UTF16BE

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:7: warning: already initialized constant Psych::ClassLoader::BIG_DECIMAL

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:7: warning: previous definition of BIG_DECIMAL was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:8: warning: already initialized constant Psych::ClassLoader::COMPLEX

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:8: warning: previous definition of COMPLEX was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:9: warning: already initialized constant Psych::ClassLoader::DATE

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:9: warning: previous definition of DATE was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:10: warning: already initialized constant Psych::ClassLoader::DATE_TIME

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:10: warning: previous definition of DATE_TIME was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:11: warning: already initialized constant Psych::ClassLoader::EXCEPTION

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:11: warning: previous definition of EXCEPTION was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:12: warning: already initialized constant Psych::ClassLoader::OBJECT

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:12: warning: previous definition of OBJECT was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:13: warning: already initialized constant Psych::ClassLoader::PSYCH_OMAP

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:13: warning: previous definition of PSYCH_OMAP was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:14: warning: already initialized constant Psych::ClassLoader::PSYCH_SET

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:14: warning: previous definition of PSYCH_SET was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:15: warning: already initialized constant Psych::ClassLoader::RANGE

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:15: warning: previous definition of RANGE was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:16: warning: already initialized constant Psych::ClassLoader::RATIONAL

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:16: warning: previous definition of RATIONAL was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:17: warning: already initialized constant Psych::ClassLoader::REGEXP

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:17: warning: previous definition of REGEXP was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:18: warning: already initialized constant Psych::ClassLoader::STRUCT

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:18: warning: previous definition of STRUCT was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:19: warning: already initialized constant Psych::ClassLoader::SYMBOL

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:19: warning: previous definition of SYMBOL was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/class_loader.rb:65: warning: already initialized constant Psych::ClassLoader::CACHE

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/class_loader.rb:65: warning: previous definition of CACHE was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/scalar_scanner.rb:9: warning: already initialized constant Psych::ScalarScanner::TIME

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/scalar_scanner.rb:9: warning: previous definition of TIME was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/scalar_scanner.rb:12: warning: already initialized constant Psych::ScalarScanner::FLOAT

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/scalar_scanner.rb:12: warning: previous definition of FLOAT was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/scalar_scanner.rb:17: warning: already initialized constant Psych::ScalarScanner::INTEGER

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/scalar_scanner.rb:17: warning: previous definition of INTEGER was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/stream.rb:13: warning: already initialized constant Psych::Nodes::Stream::ANY

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/stream.rb:13: warning: previous definition of ANY was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/stream.rb:16: warning: already initialized constant Psych::Nodes::Stream::UTF8

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/stream.rb:16: warning: previous definition of UTF8 was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/stream.rb:19: warning: already initialized constant Psych::Nodes::Stream::UTF16LE

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/stream.rb:19: warning: previous definition of UTF16LE was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/stream.rb:22: warning: already initialized constant Psych::Nodes::Stream::UTF16BE

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/stream.rb:22: warning: previous definition of UTF16BE was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/sequence.rb:43: warning: already initialized constant Psych::Nodes::Sequence::ANY

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/sequence.rb:43: warning: previous definition of ANY was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/sequence.rb:46: warning: already initialized constant Psych::Nodes::Sequence::BLOCK

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/sequence.rb:46: warning: previous definition of BLOCK was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/sequence.rb:49: warning: already initialized constant Psych::Nodes::Sequence::FLOW

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/sequence.rb:49: warning: previous definition of FLOW was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/scalar.rb:10: warning: already initialized constant Psych::Nodes::Scalar::ANY

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/scalar.rb:10: warning: previous definition of ANY was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/scalar.rb:13: warning: already initialized constant Psych::Nodes::Scalar::PLAIN

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/scalar.rb:13: warning: previous definition of PLAIN was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/scalar.rb:16: warning: already initialized constant Psych::Nodes::Scalar::SINGLE_QUOTED

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/scalar.rb:16: warning: previous definition of SINGLE_QUOTED was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/scalar.rb:19: warning: already initialized constant Psych::Nodes::Scalar::DOUBLE_QUOTED

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/scalar.rb:19: warning: previous definition of DOUBLE_QUOTED was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/scalar.rb:22: warning: already initialized constant Psych::Nodes::Scalar::LITERAL

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/scalar.rb:22: warning: previous definition of LITERAL was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/scalar.rb:25: warning: already initialized constant Psych::Nodes::Scalar::FOLDED

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/scalar.rb:25: warning: previous definition of FOLDED was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/mapping.rb:17: warning: already initialized constant Psych::Nodes::Mapping::ANY

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/mapping.rb:17: warning: previous definition of ANY was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/mapping.rb:20: warning: already initialized constant Psych::Nodes::Mapping::BLOCK

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/mapping.rb:20: warning: previous definition of BLOCK was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/nodes/mapping.rb:23: warning: already initialized constant Psych::Nodes::Mapping::FLOW

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/nodes/mapping.rb:23: warning: previous definition of FLOW was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/visitors/visitor.rb:11: warning: already initialized constant Psych::Visitors::Visitor::DISPATCH

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/visitors/visitor.rb:11: warning: previous definition of DISPATCH was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/visitors/to_ruby.rb:334: warning: already initialized constant Psych::Visitors::ToRuby::SHOVEL

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/visitors/to_ruby.rb:334: warning: previous definition of SHOVEL was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/handler.rb:27: warning: already initialized constant Psych::Handler::OPTIONS

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/handler.rb:27: warning: previous definition of OPTIONS was here

/opt/rh/rh-ruby26/root/usr/share/ruby/psych/handler.rb:30: warning: already initialized constant Psych::Handler::EVENTS

/opt/rh/rh-ruby26/root/usr/share/gems/gems/psych-3.1.0/lib/psych/handler.rb:30: warning: previous definition of EVENTS was here


== Brakeman Report ==


Application Path: /workdir

Rails Version: 6.1.3

Brakeman Version: 5.0.0

Scan Date: 2021-03-25 16:40:21 +0000

Duration: 0.247887663 seconds

Checks Run: BasicAuth, BasicAuthTimingAttack, CSRFTokenForgeryCVE, ContentTag, CookieSerialization, CreateWith, CrossSiteScripting, DefaultRoutes, Deserialize, DetailedExceptions, DigestDoS, DynamicFinders, EscapeFunction, Evaluation, Execute, FileAccess, FileDisclosure, FilterSkipping, ForgerySetting, HeaderDoS, I18nXSS, JRubyXML, JSONEncoding, JSONEntityEscape, JSONParsing, LinkTo, LinkToHref, MailTo, MassAssignment, MimeTypeDoS, ModelAttrAccessible, ModelAttributes, ModelSerialize, NestedAttributes, NestedAttributesBypass, NumberToCurrency, PageCachingCVE, PermitAttributes, QuoteTableName, Redirect, RegexDoS, Render, RenderDoS, RenderInline, ResponseSplitting, RouteDoS, SQL, SQLCVEs, SSLVerify, SafeBufferManipulation, SanitizeMethods, SelectTag, SelectVulnerability, Send, SendFile, SessionManipulation, SessionSettings, SimpleFormat, SingleQuotes, SkipBeforeFilter, SprocketsPathTraversal, StripTags, SymbolDoSCVE, TemplateInjection, TranslateBug, UnsafeReflection, UnsafeReflectionMethods, ValidationRegex, VerbConfusion, WithoutProtection, XMLDoS, YAMLParsing


== Overview ==


Controllers: 4

Models: 1

Templates: 0

Errors: 1

Security Warnings: 0


== Warning Types ==



== Errors ==


Error: superclass mismatch for class Mark

Location: /opt/rh/rh-ruby26/root/usr/share/ruby/psych/parser.rb:34:in `<class:Parser>'


No warnings found


script returned exit code 7

BobbyMcWho avatar Mar 25 '21 16:03 BobbyMcWho