veracode 1.0.0.alpha9 → 1.0.0.alpha16
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 +5 -5
- data/bin/veracode +12 -0
- data/lib/veracode.rb +96 -57
- data/lib/veracode/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8f9679b127c0fea3a3044f5470c2336d02dcbd3c453df0bdc121827d41ce27c7
|
4
|
+
data.tar.gz: c4a8fb0378e691164646c70f53e8c866b4355fad557daedbc701d4afc05f695b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431b1b21871f274c9c394fff11873bf53730356f5c589aa439f59ab857c6dbcc22e9297d7dbd1f479438eafc0b25ca15cb7cbf5c5dc36f2346246670fd135f40
|
7
|
+
data.tar.gz: fb1c0e34fc6d61955557b439f7b855b977cdaa5431684654a03868021913cd2137f0ad64688f7eeca36e4723ace8024a84434af37d4c6a3dcfd1768a35ab022a
|
data/bin/veracode
CHANGED
@@ -41,6 +41,18 @@ case subcommand
|
|
41
41
|
$options[:jruby] = true
|
42
42
|
end
|
43
43
|
|
44
|
+
opts.on("-O", "--skip-active-record", "Skip ActiveRecord") do
|
45
|
+
$options[:skipactiverecord] = true
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on("-V", "--skip-action-view", "Skip ActionView") do
|
49
|
+
$options[:skipactionview] = true
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on("-S", "--skip-sprockets", "Skip Sprockets") do
|
53
|
+
$options[:skipsprockets] = true
|
54
|
+
end
|
55
|
+
|
44
56
|
# opts.on("--[no-]source", "[Don't] Include source code in archive") do |s|
|
45
57
|
# $options[:archive_source] = s
|
46
58
|
# end
|
data/lib/veracode.rb
CHANGED
@@ -291,7 +291,11 @@ module Veracode
|
|
291
291
|
begin
|
292
292
|
( o.name.nil? ? o.to_s : o.name.to_s )
|
293
293
|
rescue
|
294
|
-
|
294
|
+
begin
|
295
|
+
( o.nil? ? "nil" : o.to_s )
|
296
|
+
rescue
|
297
|
+
"nil"
|
298
|
+
end
|
295
299
|
end
|
296
300
|
when o.is_a?(Method), o.is_a?(UnboundMethod)
|
297
301
|
o.name.to_s
|
@@ -436,14 +440,27 @@ module Veracode
|
|
436
440
|
|
437
441
|
puts " module header" if $options[:verbose]
|
438
442
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
443
|
+
formatted_contents = ""
|
444
|
+
|
445
|
+
begin
|
446
|
+
formatted_contents += ( m.included_modules.count > 0 ?
|
447
|
+
m.included_modules.map {|m| "include #{m.inspect.dump}\n" }.join :
|
448
|
+
""
|
449
|
+
)
|
450
|
+
rescue Exception => e
|
451
|
+
log_error "Error archiving module header #{m.inspect.dump}: #{e.message}"
|
452
|
+
end
|
453
|
+
|
454
|
+
begin
|
455
|
+
formatted_contents += ( m.respond_to?(:singleton_class) && m.singleton_class.included_modules.count > 0 ?
|
456
|
+
m.singleton_class.included_modules.map {|m| "extend #{m.inspect.dump}\n" }.join :
|
457
|
+
""
|
458
|
+
)
|
459
|
+
rescue Exception => e
|
460
|
+
log_error "Error archiving module header #{m.inspect.dump}: #{e.message}"
|
461
|
+
end
|
462
|
+
|
463
|
+
return formatted_contents
|
447
464
|
end
|
448
465
|
|
449
466
|
|
@@ -492,51 +509,63 @@ module Veracode
|
|
492
509
|
# m.respond_to?(:global_variables) was throwing exceptions
|
493
510
|
end
|
494
511
|
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
m.__send__(get_methods, $options[:include_inherited]).
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
512
|
+
begin
|
513
|
+
%w[ public protected private ].each {|p|
|
514
|
+
get_methods = (p + "_instance_methods").to_sym
|
515
|
+
if m.respond_to?(get_methods) && m.__send__(get_methods, $options[:include_inherited]).count > 0
|
516
|
+
m.__send__(get_methods, $options[:include_inherited]).each do |m_symbol|
|
517
|
+
begin
|
518
|
+
method = m.instance_method(m_symbol)
|
519
|
+
formatted_contents += format_method(method, "#{p.to_s}_instance", with_disasm)
|
520
|
+
rescue Exception => e
|
521
|
+
log_error "Error archiving #{p.to_s} instance method #{m_symbol.to_s.dump}: #{e.message}"
|
522
|
+
end
|
504
523
|
end
|
505
524
|
end
|
506
|
-
|
507
|
-
|
525
|
+
}
|
526
|
+
rescue Exception => e
|
527
|
+
# m.respond_to?(get_methods)
|
528
|
+
end
|
508
529
|
|
509
530
|
formatted_contents
|
510
531
|
end
|
511
532
|
|
512
533
|
def self.object_contents(o, with_disasm=true)
|
513
|
-
return "" unless o.is_a?
|
534
|
+
return "" unless !o.nil? && o.is_a?(Object)
|
514
535
|
|
515
536
|
puts " object contents" if $options[:verbose]
|
516
537
|
|
517
538
|
formatted_contents = ""
|
518
|
-
|
519
|
-
|
520
|
-
o.instance_variables.
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
539
|
+
|
540
|
+
begin
|
541
|
+
if o.respond_to?(:instance_variables) && o.instance_variables.count > 0
|
542
|
+
o.instance_variables.each do |v_symbol|
|
543
|
+
begin
|
544
|
+
v = o.instance_variable_get(v_symbol)
|
545
|
+
formatted_contents += format_variable(v_symbol, v, "instance")
|
546
|
+
rescue Exception => e
|
547
|
+
log_error "Error archiving instance variable #{v_symbol.to_s.dump}: #{e.message}"
|
548
|
+
formatted_contents += format_variable(v_symbol, :veracode_nil, "instance")
|
549
|
+
end
|
527
550
|
end
|
528
551
|
end
|
552
|
+
rescue Exception => e
|
553
|
+
log_error "Error getting :instance_variables for object #{o}: #{e.message}"
|
529
554
|
end
|
530
555
|
|
531
|
-
|
532
|
-
o.singleton_methods($options[:include_inherited]).
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
556
|
+
begin
|
557
|
+
if o.respond_to?(:singleton_methods) && o.singleton_methods($options[:include_inherited]).count > 0
|
558
|
+
o.singleton_methods($options[:include_inherited]).each do |m_symbol|
|
559
|
+
begin
|
560
|
+
m = o.method(m_symbol)
|
561
|
+
formatted_contents += format_method(m, "singleton", with_disasm)
|
562
|
+
rescue Exception => e
|
563
|
+
log_error "Error archiving singleton method #{m_symbol.to_s.dump}: #{e.message}"
|
564
|
+
end
|
538
565
|
end
|
539
566
|
end
|
567
|
+
rescue Exception => e
|
568
|
+
log_error "Error getting :singleton_methods for object #{o}: #{e.message}"
|
540
569
|
end
|
541
570
|
|
542
571
|
formatted_contents
|
@@ -546,13 +575,12 @@ module Veracode
|
|
546
575
|
##############################################################################
|
547
576
|
# Archiving Objects
|
548
577
|
def self.archive(objects, with_disasm=true)
|
549
|
-
|
550
578
|
objects = objects - [
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
579
|
+
Veracode,
|
580
|
+
Veracode::ActiveRecord,
|
581
|
+
Veracode::ActiveRecord::Model,
|
582
|
+
Veracode::ActiveRecord::Schema,
|
583
|
+
]
|
556
584
|
|
557
585
|
if $options[:verbose]
|
558
586
|
puts "Archiving #{objects.count.to_s} objects" + (with_disasm ? " with disassembly" : "")
|
@@ -561,20 +589,16 @@ module Veracode
|
|
561
589
|
|
562
590
|
objects.sort_by {|o| safe_name(o) }.each do |o|
|
563
591
|
|
564
|
-
|
565
|
-
|
566
|
-
add_to_archive "#{o.class.to_s.downcase} #{quote(safe_name(o))}\n" +
|
567
|
-
|
568
|
-
( o.is_a?(Class) ? class_header(o) : "") + # superclass
|
569
|
-
( o.is_a?(Module) ? module_header(o) : "") + # included modules
|
570
|
-
|
571
|
-
( o.is_a?(Object) ? object_contents(o, with_disasm) : "") +
|
572
|
-
( o.is_a?(Module) ? module_contents(o, with_disasm) : "") +
|
592
|
+
puts "archiving #{o.class.to_s.downcase} #{quote(safe_name(o))}" if $options[:verbose]
|
573
593
|
|
574
|
-
|
575
|
-
|
594
|
+
add_to_archive "#{o.class.to_s.downcase} #{quote(safe_name(o))}\n" +
|
595
|
+
( o.is_a?(Class) ? class_header(o) : "") + # superclass
|
596
|
+
( o.is_a?(Module) ? module_header(o) : "") + # included modules
|
597
|
+
( (o.is_a?(Object) && !o.nil?) ? object_contents(o, with_disasm) : "") +
|
598
|
+
( o.is_a?(Module) ? module_contents(o, with_disasm) : "") +
|
599
|
+
"end#{o.class.to_s.downcase}\n" +
|
600
|
+
"\n"
|
576
601
|
end
|
577
|
-
|
578
602
|
end
|
579
603
|
|
580
604
|
|
@@ -622,7 +646,11 @@ module Veracode
|
|
622
646
|
|
623
647
|
assigns = {}
|
624
648
|
view = ActionView::Base.new(view_paths, assigns)
|
625
|
-
|
649
|
+
begin
|
650
|
+
controller_view = ApplicationController.new.view_context
|
651
|
+
rescue Exception => e
|
652
|
+
log_error "Unable to get controller view context (#{e.message})"
|
653
|
+
end
|
626
654
|
|
627
655
|
templates.each { |template|
|
628
656
|
puts "Compiling template #{template}" if $options[:verbose]
|
@@ -841,7 +869,17 @@ end
|
|
841
869
|
|
842
870
|
puts "Phase 2 - Load Rails" if $options[:verbose]
|
843
871
|
begin
|
844
|
-
|
872
|
+
if $options[:skipactiverecord] || $options[:skipactionview] || $options[:skipsprockets]
|
873
|
+
require "active_model/railtie"
|
874
|
+
require "active_record/railtie" unless $options[:skipactiverecord]
|
875
|
+
require "action_controller/railtie"
|
876
|
+
require "action_mailer/railtie"
|
877
|
+
require "action_view/railtie" unless $options[:skipactionview]
|
878
|
+
require "sprockets/railtie" unless $options[:skipsprockets]
|
879
|
+
require "rails/test_unit/railtie"
|
880
|
+
else
|
881
|
+
require "rails/all"
|
882
|
+
end
|
845
883
|
rescue Exception => e
|
846
884
|
puts "Unable to require rails: #{e.message}"
|
847
885
|
log_error "Unable to require rails: #{e.message}"
|
@@ -928,6 +966,7 @@ end
|
|
928
966
|
puts "Processing and disassembling #{APP_NAME} classes and modules"
|
929
967
|
archive(@modules - @baseline_modules, true)
|
930
968
|
archive_schema
|
969
|
+
|
931
970
|
end
|
932
971
|
|
933
972
|
## /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.alpha16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Veracode
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -55,10 +55,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: 1.3.1
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.7.8
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Command line tool for preparing your Ruby on Rails app for submission to
|
62
62
|
Veracode
|
63
63
|
test_files: []
|
64
|
-
has_rdoc:
|