veracode 1.0.2 → 1.1.3

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: 76b474d0295eea0d4627632242cae9e9af1e897af7ac846776b035cb58a0c89b
4
- data.tar.gz: 65b8f267cbbba773839d7b6980f6de4c85dfdd2e559d793bcb63edc0c8140a99
3
+ metadata.gz: '08bcc098eb5e5c8b64c1cdfddfaa7dab701d190b2a0740e825a1c986b91ac737'
4
+ data.tar.gz: '08122a15ccd6189ca40dd823d6db2b38a9aba95ec556d8dddd14c4fda6d98fd3'
5
5
  SHA512:
6
- metadata.gz: a29acbc7213e4f7dd56cbbdeb8fb15bdeb35162955b4ad2fa6c3aaabc557cc7ed2523f562e5c97731fe7ebc44224c772342bcf939001ec3a3ef83a0b3a51ddd9
7
- data.tar.gz: 86d3da0ae6a302e1df67008f40203b0d2f1fc8c003c7ac109e808f78a8b17ef1df01f8bb2e9aeebafd4df1628822a09bb33fc077f203278ce39f6619135bddf8
6
+ metadata.gz: a71ea85866f288b9861c99c30d5786014f72ed5691c4353d5ed7f448154df38f1be7e5f399d33a18a8f4192baa7618a465eb34228f856caa8a8ba61b67023a82
7
+ data.tar.gz: 563b9b4090074f5042fcdc3efb0a9a713c2eac8cebf80a531d78c8917478530ead6bf790e1f0a62ebac3c3fc15a1a5548eee4bd3346573dddc22025dc15e2ef4
data/bin/veracode CHANGED
@@ -25,7 +25,7 @@ $options = {
25
25
  :include_inherited => false,
26
26
  :environment => false,
27
27
  :verbose => false,
28
- :jruby => false,
28
+ :skipenvironment => false,
29
29
  :skipactiverecord => false,
30
30
  :skipactionview => false,
31
31
  :skipsprockets => false,
@@ -42,8 +42,8 @@ case subcommand
42
42
  $options[:verbose] = true
43
43
  end
44
44
 
45
- opts.on("-j", "--jruby", "Force JRuby mode") do
46
- $options[:jruby] = true
45
+ opts.on("-E", "--skip-environment", "Skip environment") do
46
+ $options[:skipenvironment] = true
47
47
  end
48
48
 
49
49
  opts.on("-O", "--skip-active-record", "Skip ActiveRecord") do
@@ -70,6 +70,17 @@ case subcommand
70
70
  $options[:snapshot] = true
71
71
  end
72
72
 
73
+ # only print the options that match the documentation in the help center
74
+ opts.on("-h", "--help", "Print help") do
75
+ msg = <<-HELPMSG.strip
76
+ Usage: veracode prepare [options]
77
+ -v, --verbose Run verbosely
78
+ -D, --debug Enable debug output
79
+ HELPMSG
80
+ puts msg
81
+ exit
82
+ end
83
+
73
84
  end.parse!
74
85
 
75
86
  Veracode.prepare
@@ -1,4 +1,4 @@
1
1
  module Veracode
2
- VERSION = '1.0.2'
2
+ VERSION = '1.1.3'
3
3
  ARCHIVE_VERSION = '2020-06-29'
4
4
  end
data/lib/veracode.rb CHANGED
@@ -184,6 +184,7 @@ module Veracode
184
184
  }
185
185
  }
186
186
  else
187
+ Zip.write_zip64_support = true
187
188
  Zip::File.open(@archive_filename, Zip::File::CREATE) { |zf|
188
189
  @manifest.each { |file|
189
190
 
@@ -297,11 +298,13 @@ module Veracode
297
298
  when o.is_a?(Module)
298
299
  begin
299
300
  ( o.name.nil? ? o.to_s : o.name.to_s )
300
- rescue
301
+ rescue Exception => e
301
302
  begin
303
+ log_error "Exception rescued trying to call .name on object. Object: #{o.inspect}. Exception: #{e.inspect}"
302
304
  ( o.nil? ? "nil" : o.to_s )
303
- rescue
304
- ( o == nil ? "nil" : o.to_s ) # in case of monkey patched nil?
305
+ rescue Exception => e
306
+ log_error "Exception rescued trying to call .nil on object. Object: #{o.inspect}. Exception: #{e.inspect}"
307
+ ( o == nil ? "nil" : o.to_s ) # in case of monkey patched nil?
305
308
  end
306
309
  end
307
310
  when o.is_a?(Method), o.is_a?(UnboundMethod)
@@ -309,7 +312,8 @@ module Veracode
309
312
  else
310
313
  o.to_s
311
314
  end
312
- rescue
315
+ rescue Exception => e
316
+ log_error "Exception rescued trying to get safe_name on object. Dropping from archive. Exception: #{e.inspect}"
313
317
  "Veracode" #should result in this being dropped from the archive since we can't get a safe name for it
314
318
  end
315
319
  end
@@ -643,29 +647,33 @@ module Veracode
643
647
 
644
648
  def self.archive_rails6_templates
645
649
  puts "archiving views" if $options[:verbose]
646
- o = @view.compiled_method_container
647
- compiled_views = o.instance_methods - @view_methods
648
- formatted_contents = ""
649
- for m_symbol in compiled_views
650
- begin
651
- m = o.instance_method(m_symbol)
652
- formatted_contents += format_method(m, "public_instance", true)
653
- rescue Exception => e
654
- log_error "Error archiving singleton method #{m_symbol.to_s.dump}: #{e.message}"
650
+ begin
651
+ o = @view.compiled_method_container
652
+ compiled_views = o.instance_methods - @view_methods
653
+ formatted_contents = ""
654
+ for m_symbol in compiled_views
655
+ begin
656
+ m = o.instance_method(m_symbol)
657
+ formatted_contents += format_method(m, "public_instance", true)
658
+ rescue Exception => e
659
+ log_error "Error archiving singleton method #{m_symbol.to_s.dump}: #{e.message}"
660
+ end
655
661
  end
662
+ # fake the module outpput to match what SAF expects from Rails <= 5
663
+ add_to_archive "module \"ActionView::CompiledTemplates\"\n" +
664
+ "extend \"ActiveSupport::Dependencies::ModuleConstMissing\"\n" +
665
+ "extend \"Module::Concerning\"\n" +
666
+ "extend \"ActiveSupport::ToJsonWithActiveSupportEncoder\"\n" +
667
+ "extend \"PP::ObjectMixin\"\n" +
668
+ "extend \"ActiveSupport::Dependencies::Loadable\"\n" +
669
+ "extend \"JSON::Ext::Generator::GeneratorMethods::Object\"\n" +
670
+ "extend \"ActiveSupport::Tryable\"\n" +
671
+ "extend \"Kernel\"\n" +
672
+ formatted_contents +
673
+ "endmodule\n"
674
+ rescue Exception => e
675
+ log_error "Error archiving Rails 6 views: #{e.message}"
656
676
  end
657
- # fake the module outpput to match what SAF expects from Rails <= 5
658
- add_to_archive "module \"ActionView::CompiledTemplates\"\n" +
659
- "extend \"ActiveSupport::Dependencies::ModuleConstMissing\"\n" +
660
- "extend \"Module::Concerning\"\n" +
661
- "extend \"ActiveSupport::ToJsonWithActiveSupportEncoder\"\n" +
662
- "extend \"PP::ObjectMixin\"\n" +
663
- "extend \"ActiveSupport::Dependencies::Loadable\"\n" +
664
- "extend \"JSON::Ext::Generator::GeneratorMethods::Object\"\n" +
665
- "extend \"ActiveSupport::Tryable\"\n" +
666
- "extend \"Kernel\"\n" +
667
- formatted_contents +
668
- "endmodule\n"
669
677
  end
670
678
 
671
679
 
@@ -989,7 +997,11 @@ end
989
997
 
990
998
  glob_require "config/application.rb"
991
999
 
992
- Rails.application.require_environment! unless $options[:jruby]
1000
+ begin
1001
+ Rails.application.require_environment! unless $options[:skipenvironment]
1002
+ rescue Exception => e
1003
+ log_error "Unable to require environment: #{e.message}"
1004
+ end
993
1005
  # Following line will actually kick off IRB
994
1006
  # Rails::Console.start(Rails.application)
995
1007
 
@@ -1075,6 +1087,7 @@ end
1075
1087
  log_error e.message
1076
1088
  log_error e.backtrace.join("\n")
1077
1089
  else
1090
+ puts "Failed to prepare veracode archive. Please see #{@archive_dirname + '/' + @errorlog_filename}."
1078
1091
  raise
1079
1092
  end
1080
1093
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veracode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veracode
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  description: Prepares your Ruby on Rails app for submission to Veracode.
@@ -39,7 +39,7 @@ files:
39
39
  homepage: http://veracode.com/
40
40
  licenses: []
41
41
  metadata: {}
42
- post_install_message:
42
+ post_install_message:
43
43
  rdoc_options: []
44
44
  require_paths:
45
45
  - lib
@@ -54,8 +54,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.1.4
58
- signing_key:
57
+ rubygems_version: 3.1.6
58
+ signing_key:
59
59
  specification_version: 4
60
60
  summary: Command line tool for preparing your Ruby on Rails app for submission to
61
61
  Veracode