veracode 1.1.4 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 869ea455d7ba3870c7314f3bfd8000f694aaea5108e710294da2fcbdb53e8675
4
- data.tar.gz: 2758e1b03929fc63f8acf4864f248d857ae0ccdb93974c183ce16c8117a8e1f0
3
+ metadata.gz: 5cd6b5054a777beb3edbe568783105295ef5d2aba60403bc80afee04a53b3348
4
+ data.tar.gz: 3c47c2749ce2038a316571e9f529b47ad0f19bdb3dcf45658783ad38e8783cfe
5
5
  SHA512:
6
- metadata.gz: 11250e90a90dd1ffb4f56a4012504e0c75a1e91236b96531f06d4c158e328e3b558ce00899dd00d9caed08d32495476cb48211da04d1c2a21820b5def3c9a9f6
7
- data.tar.gz: f669ec46f4756f9dcbe0bfd53163988d2c3d0fec7f6aa4b5d367e26628455e7fb7a2dc9d8dcb87ea7c2848e547ab6453fcd2b7b72d345533c3aec70247519296
6
+ metadata.gz: 0240d159fe34cb8516a19b1ec8e5cb0920dd5dcd777606a2dc7ce3553367d925424781f42a99e1a5b65d297a45a16a3196cb35db019673d51c45921e0abbd117
7
+ data.tar.gz: ec7c3e0a1d0f3350c6cdd6f10f5c7200469598a05ccee43453ac432082894ea7be8ee203531159045048bfebb383679f5694db38554ee85fbd4753e766cea360
data/bin/veracode CHANGED
@@ -4,10 +4,10 @@ require 'optparse'
4
4
  $:.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
5
5
  $:.unshift Dir.pwd
6
6
 
7
- if File.exists?('Gemfile.lock')
7
+ if File.exist?('Gemfile.lock')
8
8
  rails_version = File.open('Gemfile.lock').grep(/^\s*rails\s*\(=\s*[34]/)
9
9
  else
10
- rails_version = File.exists?("script/rails") #fallback for rails 3.0
10
+ rails_version = File.exist?("script/rails") #fallback for rails 3.0
11
11
  end
12
12
  unless rails_version
13
13
  $stderr.puts "Current directory #{File.basename(Dir.pwd).dump} does not appear to be a Rails 3/4 application."
@@ -1,4 +1,4 @@
1
1
  module Veracode
2
- VERSION = '1.1.4'
2
+ VERSION = '1.1.6'
3
3
  ARCHIVE_VERSION = '2020-06-29'
4
4
  end
data/lib/veracode.rb CHANGED
@@ -39,7 +39,7 @@ module Veracode
39
39
  @expanded_app_dir = Dir.getwd
40
40
 
41
41
  def self.init
42
- if Gem::Dependency.new('', '~> 2.2.0').match?('', RUBY_VERSION)
42
+ if Gem::Dependency.new('', '~> 2.2.0').match?('', RUBY_VERSION.dup)
43
43
  $stderr.puts "Ruby 2.2 is not supported, please consult the compilation guide for all supported Ruby versions"
44
44
  exit
45
45
  end
@@ -48,7 +48,7 @@ module Veracode
48
48
  @archive_dirname = File.join("tmp","veracode-#{@run_id}")
49
49
  @required_libs.merge(["pathname", "set", "zlib", "zip/zip", "veracode"])
50
50
 
51
- if !Dir.exists?("tmp")
51
+ if !Dir.exist?("tmp")
52
52
  begin
53
53
  Dir.mkdir("tmp")
54
54
  rescue Exception => e
@@ -57,7 +57,7 @@ module Veracode
57
57
  end
58
58
  end
59
59
 
60
- while Dir.exists?(@archive_dirname)
60
+ while Dir.exist?(@archive_dirname)
61
61
  @run_id = Time.now.strftime("%Y%m%d%H%M%S")
62
62
  @archive_dirname = File.join("tmp","veracode-#{@run_id}")
63
63
  end
@@ -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
@@ -866,7 +884,7 @@ module Veracode
866
884
  def self.require_libs(lib_paths)
867
885
  for lib_path in lib_paths
868
886
  dirsToProcess = [Pathname(lib_path)]
869
- until dirsToProcess.count == 0 || !Dir.exists?(dirsToProcess[0])
887
+ until dirsToProcess.count == 0 || !Dir.exist?(dirsToProcess[0])
870
888
  currentDir = dirsToProcess.delete_at(0)
871
889
  for child in currentDir.children
872
890
  if child.directory?
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.4
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veracode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-22 00:00:00.000000000 Z
11
+ date: 2024-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip