veracode 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37b1dcba1a6fdef908b9fa09163803ffa0ba23628ff38df4332fd493563e6188
4
- data.tar.gz: 5f483a6af098af454f785f676f6f7903f4b05aefef51a202cc0e5fd7ae779a97
3
+ metadata.gz: 2748dd2d1f9ca4ad77e27e5135143f3e310f2b78722d095439126afe3aa5a433
4
+ data.tar.gz: 6a15bb00abca2f8471d0a535bcd812bd9ae8366e60998b211236981ad5aff5fc
5
5
  SHA512:
6
- metadata.gz: b8bc512ac4a431b7f77dabd12b4a703fbc93faf112db48d0c5782c3555a6f113ce0cbbaab25db645807ab5cae83afd28faf9acf80b31137dba784a885e7d69ca
7
- data.tar.gz: 3b5e57faad8593402d64558d77750abaf498efe30654e14a8a17ca1646868b60ec455cc077cd886d109a1fafb80672e4aa74cc79f13124df849cf279101e675d
6
+ metadata.gz: abd794f9d29c5e9d226af29e0de4425a0beea89677396698e01955043ca0054b964718dc662c7bab6dfdddf3e60f7988fe9dc5e5b7bd494c8846eb0517994b79
7
+ data.tar.gz: 9132bf0aa6955ca63449dadcd4965e36fda893940f995d652aa59d1f34d5be43506c00c1f2ab89359db7d9212b10c2d3f55a80f99f548438a539339aaef4d7b5
@@ -1,4 +1,4 @@
1
1
  module Veracode
2
- VERSION = '1.1.5'
2
+ VERSION = '1.1.7'
3
3
  ARCHIVE_VERSION = '2020-06-29'
4
4
  end
data/lib/veracode.rb CHANGED
@@ -292,6 +292,7 @@ module Veracode
292
292
 
293
293
  def self.safe_name(o)
294
294
  begin
295
+ restore_original_class_method(o)
295
296
  case
296
297
  when o == ActiveSupport::TimeWithZone
297
298
  "ActiveSupport::TimeWithZone"
@@ -317,6 +318,23 @@ module Veracode
317
318
  "Veracode" #should result in this being dropped from the archive since we can't get a safe name for it
318
319
  end
319
320
  end
321
+
322
+ # Some Ruby devs override the `class` method.
323
+ # This is bad practice but is still done sometimes.
324
+ # For example: https://github.com/faker-ruby/faker/blob/v2.2.1/lib/faker/games/heroes_of_the_storm.rb#L11-L13
325
+ # This messes with our ability to get the class name.
326
+ # So we detect this and if it is overriden we restore the original method from `Kernel`
327
+ def self.restore_original_class_method(obj)
328
+ original_class_method = Kernel.instance_method(:class)
329
+
330
+ class_method_owner = obj.method(:class).owner
331
+
332
+ if class_method_owner != Kernel
333
+ obj.define_singleton_method(:class) do
334
+ original_class_method.bind(self).call
335
+ end
336
+ end
337
+ end
320
338
 
321
339
  def self.quote(o)
322
340
  o.to_s.dump
@@ -492,7 +510,17 @@ module Veracode
492
510
 
493
511
  formatted_contents = ""
494
512
 
495
- m.constants($options[:include_inherited]).each do |c_symbol|
513
+ constants_method = m.method(:constants)
514
+ original_constants_method = Module.instance_method(:constants)
515
+
516
+ if constants_method != original_constants_method
517
+ puts " constants method has been overridden, fall back to original method" if $options[:verbose]
518
+ constants = original_constants_method.bind(m).call($options[:include_inherited])
519
+ else
520
+ constants = m.constants($options[:include_inherited])
521
+ end
522
+
523
+ constants.each do |c_symbol|
496
524
  begin
497
525
  c = m.const_get(c_symbol) if m.const_defined? c_symbol
498
526
  formatted_contents += format_constant(c_symbol, c)
@@ -1088,7 +1116,7 @@ end
1088
1116
  log_error e.message
1089
1117
  log_error e.backtrace.join("\n")
1090
1118
  else
1091
- puts "Failed to prepare veracode archive. Please see #{@archive_dirname + '/' + @errorlog_filename}."
1119
+ puts "Failed to prepare veracode archive. Please see #{@errorlog_filename}."
1092
1120
  raise
1093
1121
  end
1094
1122
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veracode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veracode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-16 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip