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 +4 -4
- data/bin/veracode +10 -1
- data/lib/veracode.rb +68 -40
- data/lib/veracode/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5cb7c4ca35c0ba950a80cd3128abe49464b68357d59528a09af7e17998bf2d9
|
4
|
+
data.tar.gz: fea0072496133717cc1f109cfe987eee7ee6099443c6032efd594c823338353f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
426
|
+
begin
|
427
|
+
return "" unless c.is_a? Class
|
423
428
|
|
424
|
-
|
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
|
-
|
427
|
-
|
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
|
-
|
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
|
-
|
902
|
+
# APP_PATH is already set in bin/veracode
|
894
903
|
#require File.expand_path('../../config/boot', __FILE__)
|
895
|
-
|
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
|
-
|
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
|
-
|
941
|
-
|
942
|
-
any_new
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
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
|
-
|
967
|
+
compile_templates
|
949
968
|
|
950
|
-
|
951
|
-
|
969
|
+
self.update
|
970
|
+
self.stats if $options[:verbose]
|
952
971
|
|
953
|
-
|
954
|
-
|
972
|
+
# Ensure compiled templates are fully disassembled in archive
|
973
|
+
@baseline_modules.delete(ActionView::CompiledTemplates)
|
955
974
|
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
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
|
data/lib/veracode/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|