veracode 1.0.0.alpha16 → 1.0.0.alpha17

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: 8f9679b127c0fea3a3044f5470c2336d02dcbd3c453df0bdc121827d41ce27c7
4
- data.tar.gz: c4a8fb0378e691164646c70f53e8c866b4355fad557daedbc701d4afc05f695b
3
+ metadata.gz: e5cb7c4ca35c0ba950a80cd3128abe49464b68357d59528a09af7e17998bf2d9
4
+ data.tar.gz: fea0072496133717cc1f109cfe987eee7ee6099443c6032efd594c823338353f
5
5
  SHA512:
6
- metadata.gz: 431b1b21871f274c9c394fff11873bf53730356f5c589aa439f59ab857c6dbcc22e9297d7dbd1f479438eafc0b25ca15cb7cbf5c5dc36f2346246670fd135f40
7
- data.tar.gz: fb1c0e34fc6d61955557b439f7b855b977cdaa5431684654a03868021913cd2137f0ad64688f7eeca36e4723ace8024a84434af37d4c6a3dcfd1768a35ab022a
6
+ metadata.gz: 955ceacaea17f867fbbacbeb50607cdf71c4392474e71d73c5a3ba2c585139fef63ea6b73cc1fd6713a078e76c2855465f65a9a567d066a654989a3fdac9caf7
7
+ data.tar.gz: 0700d727fe2b5a19ebec8ba118e6d4438473e3234ffbd3fa26520f7cce054fd9fd5cd5c20d1d09e550bbcb417708cccf1019ad24a784f3e6b59a8fbea30de1a9
data/bin/veracode CHANGED
@@ -23,8 +23,13 @@ require 'veracode/version'
23
23
  $options = {
24
24
  :archive_source => true,
25
25
  :include_inherited => false,
26
- :jruby => false,
27
26
  :environment => false,
27
+ :verbose => false,
28
+ :jruby => false,
29
+ :skipactiverecord => false,
30
+ :skipactionview => false,
31
+ :skipsprockets => false,
32
+ :snapshot => false
28
33
  }
29
34
 
30
35
  subcommand = ARGV.shift
@@ -61,6 +66,10 @@ case subcommand
61
66
  $DEBUG = true
62
67
  end
63
68
 
69
+ opts.on("--debug-snapshot", "Generate a snapshot of the prepare state for Veracode debugging.") do
70
+ $options[:snapshot] = true
71
+ end
72
+
64
73
  end.parse!
65
74
 
66
75
  Veracode.prepare
data/lib/veracode.rb CHANGED
@@ -202,7 +202,11 @@ module Veracode
202
202
  exit
203
203
  end
204
204
 
205
- puts "Please upload #{@archive_filename}"
205
+ if $options[:snapshot]
206
+ puts "Please provide #{@archive_filename} to veracode for further investigation."
207
+ else
208
+ puts "Please upload #{@archive_filename}"
209
+ end
206
210
  end
207
211
 
208
212
  def self.cleanup
@@ -419,20 +423,25 @@ module Veracode
419
423
  ##############################################################################
420
424
  # Archiving Headers
421
425
  def self.class_header(c)
422
- return "" unless c.is_a? Class
426
+ begin
427
+ return "" unless c.is_a? Class
423
428
 
424
- puts " class header" if $options[:verbose]
429
+ puts " class header" if $options[:verbose]
430
+
431
+ case
432
+ when c.superclass.nil? # this should only happen for BasicObject
433
+ return ""
434
+ when c.superclass.name.nil? # in case the parent is anonymous
435
+ name = c.superclass.to_s.dump
436
+ else
437
+ name = c.superclass.name.dump
438
+ end
425
439
 
426
- case
427
- when c.superclass.nil? # this should only happen for BasicObject
440
+ "superclass #{name}\n"
441
+ rescue Exception => e
442
+ log_error e.message
428
443
  return ""
429
- when c.superclass.name.nil? # in case the parent is anonymous
430
- name = c.superclass.to_s.dump
431
- else
432
- name = c.superclass.name.dump
433
444
  end
434
-
435
- "superclass #{name}\n"
436
445
  end
437
446
 
438
447
  def self.module_header(m)
@@ -647,7 +656,7 @@ module Veracode
647
656
  assigns = {}
648
657
  view = ActionView::Base.new(view_paths, assigns)
649
658
  begin
650
- controller_view = ApplicationController.new.view_context
659
+
651
660
  rescue Exception => e
652
661
  log_error "Unable to get controller view context (#{e.message})"
653
662
  end
@@ -890,9 +899,9 @@ end
890
899
 
891
900
  ## Imitate script/rails
892
901
  # APP_PATH = File.expand_path('config/application')
893
- # APP_PATH is already set in bin/veracode
902
+ # APP_PATH is already set in bin/veracode
894
903
  #require File.expand_path('../../config/boot', __FILE__)
895
- glob_require "config/boot.rb"
904
+ glob_require "config/boot.rb"
896
905
  #require 'rails/commands'
897
906
  # this will trigger the console to be launched
898
907
  # ARGV.clear
@@ -901,7 +910,16 @@ end
901
910
  # require 'rails/commands'
902
911
 
903
912
  ## Imitate rails/commands when console
904
- cond_require 'rails/commands/console.rb'
913
+ if Gem::Version.new(Rails.version) >= Gem::Version.new("5.1.0")
914
+ cond_require 'rails/command.rb'
915
+ cond_require 'rails/command/actions.rb'
916
+ cond_require 'rails/command/base.rb'
917
+ cond_require 'rails/command/behavior.rb'
918
+ cond_require 'rails/command/environment_argument.rb'
919
+ cond_require 'rails/commands/console/console_command.rb'
920
+ else
921
+ cond_require 'rails/commands/console.rb'
922
+ end
905
923
  # require APP_PATH # => config/application.rb
906
924
 
907
925
  glob_require "config/application.rb"
@@ -937,36 +955,46 @@ end
937
955
 
938
956
  puts "Phase 3 - Imitate Rails" if $options[:verbose]
939
957
 
940
- any_new = true
941
- while any_new
942
- any_new = false
943
- any_new |= glob_require "lib/**/*.rb"
944
- any_new |= glob_require "app/**/*.rb"
945
- puts "new successful requires? #{any_new.to_s}" if $options[:verbose]
946
- end
958
+ begin
959
+ any_new = true
960
+ while any_new
961
+ any_new = false
962
+ any_new |= glob_require "lib/**/*.rb"
963
+ any_new |= glob_require "app/**/*.rb"
964
+ puts "new successful requires? #{any_new.to_s}" if $options[:verbose]
965
+ end
947
966
 
948
- compile_templates
967
+ compile_templates
949
968
 
950
- self.update
951
- self.stats if $options[:verbose]
969
+ self.update
970
+ self.stats if $options[:verbose]
952
971
 
953
- # Ensure compiled templates are fully disassembled in archive
954
- @baseline_modules.delete(ActionView::CompiledTemplates)
972
+ # Ensure compiled templates are fully disassembled in archive
973
+ @baseline_modules.delete(ActionView::CompiledTemplates)
955
974
 
956
- if $options[:environment]
957
- puts "Processing and disassembling environment"
958
- archive(@modules.reject {|o| safe_name(o) =~ /^#<(Class|Module):0x[0-9a-f]+>/i }
959
- .reject {|o| safe_name(o) =~ /^Veracode/ }
960
- .reject {|o| safe_name(o) =~ /^EmptyRails/ }
961
- .reject {|o| safe_name(o) =~ /^ActionView::CompiledTemplates$/ }, false)
962
- else
963
- puts "Processing Ruby and Rails classes and modules"
964
- archive(@baseline_modules, false)
965
- add_to_archive "\n# Phase 3 - App disassembly\n"
966
- puts "Processing and disassembling #{APP_NAME} classes and modules"
967
- archive(@modules - @baseline_modules, true)
968
- archive_schema
975
+ if $options[:environment]
976
+ puts "Processing and disassembling environment"
977
+ archive(@modules.reject {|o| safe_name(o) =~ /^#<(Class|Module):0x[0-9a-f]+>/i }
978
+ .reject {|o| safe_name(o) =~ /^Veracode/ }
979
+ .reject {|o| safe_name(o) =~ /^EmptyRails/ }
980
+ .reject {|o| safe_name(o) =~ /^ActionView::CompiledTemplates$/ }, false)
981
+ else
982
+ puts "Processing Ruby and Rails classes and modules"
983
+ archive(@baseline_modules, false)
984
+ add_to_archive "\n# Phase 3 - App disassembly\n"
985
+ puts "Processing and disassembling #{APP_NAME} classes and modules"
986
+ archive(@modules - @baseline_modules, true)
987
+ archive_schema
969
988
 
989
+ end
990
+
991
+ rescue Exception => e
992
+ if $options[:snapshot]
993
+ log_error e.message
994
+ log_error e.backtrace.join("\n")
995
+ else
996
+ raise
997
+ end
970
998
  end
971
999
 
972
1000
  ## /phase 3 - require app
@@ -1,4 +1,4 @@
1
1
  module Veracode
2
- VERSION = '1.0.0.alpha16'
2
+ VERSION = '1.0.0.alpha17'
3
3
  ARCHIVE_VERSION = '2012-07-04'
4
4
  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.0.0.alpha16
4
+ version: 1.0.0.alpha17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veracode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-24 00:00:00.000000000 Z
11
+ date: 2019-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip