veracodecli 0.2.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: e20391d9109c4c847d695a54997d90f34280a794
4
- data.tar.gz: d985fc3187d985fbcca136c34aa0f7d0922eab64
3
+ metadata.gz: 91feed8d0a8a236cd323f86b4e80ac7381b5bdd6
4
+ data.tar.gz: 4958e1a49885d118e1757c14274ebabe8f6fbfd4
5
5
  SHA512:
6
- metadata.gz: 377363318ba6e589b59c23d80d001fa0c7c1350abb4223006eb7d24085c4e72b76c1f0df80a64e9ede46dce508ef149f6828a9a494ae66297fd2cbe83a310af0
7
- data.tar.gz: 45f6427f37d59966ddad45c93294820da610784eff07b556aa0aa11f88798edad0ae65c7a52127c5091f4786cfcfba270fb6c5b3876d1715aa7b2778e6ddbb78
6
+ metadata.gz: d78b5d7773794e8f431bbbd4978ae83b06c326f72758064322721b6f81ece226f75b0f70e5958d5c436b3c4eaddac23fab010adbbf61d809a2b42e6aa9e43e18
7
+ data.tar.gz: be0de17433dcda301adcc3ba6008275983841c01249c4816d7e6b5f950cc0f4ba89c76e6425c5be239715b0482672cbc9a1742a9134a7dae89c7d5bf603bc18c
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,49 @@
1
+ # rcov generated
2
+ coverage
3
+ coverage.data
4
+
5
+ # rdoc generated
6
+ rdoc
7
+
8
+ # yard generated
9
+ doc
10
+ .yardoc
11
+
12
+ # bundler
13
+ .bundle
14
+
15
+ # jeweler generated
16
+ pkg
17
+
18
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
19
+ #
20
+ # * Create a file at ~/.gitignore
21
+ # * Include files you want ignored
22
+ # * Run: git config --global core.excludesfile ~/.gitignore
23
+ #
24
+ # After doing this, these files will be ignored in all your git projects,
25
+ # saving you from having to 'pollute' every project you touch with them
26
+ #
27
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
28
+ #
29
+ # For MacOS:
30
+ #
31
+ #.DS_Store
32
+
33
+ # For TextMate
34
+ #*.tmproj
35
+ #tmtags
36
+
37
+ # For emacs:
38
+ #*~
39
+ #\#*
40
+ #.\#*
41
+
42
+ # For vim:
43
+ #*.swp
44
+
45
+ # For redcar:
46
+ #.redcar
47
+
48
+ # For rubinius:
49
+ #*.rbc
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'activesupport', '~> 4.2'
4
+ gem 'commander', '~> 4.3'
5
+ gem 'json', '~> 1.8'
6
+ gem 'rest-client', '~> 1.8'
7
+ gem 'settingslogic', '~> 2.0'
8
+ gem 'terminal-announce', '~> 1.0'
9
+
10
+ group :development do
11
+ gem "bundler", "~> 1.0"
12
+ gem "jeweler", "~> 2.0"
13
+ gem "rdoc", "~> 3.12"
14
+ gem "reek", "~> 1.2"
15
+ gem "roodi", "~> 2.1"
16
+ gem "shoulda", "~> 3.5"
17
+ gem "rubocop", "~> 0.32"
18
+ gem "simplecov", "~> 0.10"
19
+ gem "yard", "~> 0.7"
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,144 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (4.2.4)
5
+ i18n (~> 0.7)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.3, >= 0.3.4)
9
+ tzinfo (~> 1.1)
10
+ addressable (2.3.8)
11
+ ast (2.1.0)
12
+ astrolabe (1.3.1)
13
+ parser (~> 2.2)
14
+ builder (3.2.2)
15
+ commander (4.3.5)
16
+ highline (~> 1.7.2)
17
+ contracts (0.12.0)
18
+ descendants_tracker (0.0.4)
19
+ thread_safe (~> 0.3, >= 0.3.1)
20
+ docile (1.1.5)
21
+ domain_name (0.5.25)
22
+ unf (>= 0.0.5, < 1.0.0)
23
+ faraday (0.9.2)
24
+ multipart-post (>= 1.2, < 3)
25
+ git (1.2.9.1)
26
+ github_api (0.12.4)
27
+ addressable (~> 2.3)
28
+ descendants_tracker (~> 0.0.4)
29
+ faraday (~> 0.8, < 0.10)
30
+ hashie (>= 3.4)
31
+ multi_json (>= 1.7.5, < 2.0)
32
+ nokogiri (~> 1.6.6)
33
+ oauth2
34
+ hashie (3.4.3)
35
+ highline (1.7.8)
36
+ http-cookie (1.0.2)
37
+ domain_name (~> 0.5)
38
+ i18n (0.7.0)
39
+ jeweler (2.0.1)
40
+ builder
41
+ bundler (>= 1.0)
42
+ git (>= 1.2.5)
43
+ github_api
44
+ highline (>= 1.6.15)
45
+ nokogiri (>= 1.5.10)
46
+ rake
47
+ rdoc
48
+ json (1.8.3)
49
+ jwt (1.5.2)
50
+ mime-types (2.6.2)
51
+ mini_portile (0.6.2)
52
+ minitest (5.8.2)
53
+ multi_json (1.11.2)
54
+ multi_xml (0.5.5)
55
+ multipart-post (2.0.0)
56
+ netrc (0.10.3)
57
+ nokogiri (1.6.6.2)
58
+ mini_portile (~> 0.6.0)
59
+ oauth2 (1.0.0)
60
+ faraday (>= 0.8, < 0.10)
61
+ jwt (~> 1.0)
62
+ multi_json (~> 1.3)
63
+ multi_xml (~> 0.5)
64
+ rack (~> 1.2)
65
+ parser (2.2.3.0)
66
+ ast (>= 1.1, < 3.0)
67
+ powerpack (0.1.1)
68
+ rack (1.6.4)
69
+ rainbow (2.0.0)
70
+ rake (10.4.2)
71
+ rdoc (3.12.2)
72
+ json (~> 1.4)
73
+ reek (1.2.13)
74
+ ripper_ruby_parser (~> 0.0.7)
75
+ ruby2ruby (~> 1.2.5)
76
+ ruby_parser (~> 2.0)
77
+ sexp_processor (~> 3.0)
78
+ rest-client (1.8.0)
79
+ http-cookie (>= 1.0.2, < 2.0)
80
+ mime-types (>= 1.16, < 3.0)
81
+ netrc (~> 0.7)
82
+ ripper_ruby_parser (0.0.8)
83
+ sexp_processor (~> 3.0)
84
+ roodi (2.1.0)
85
+ ruby_parser
86
+ rubocop (0.32.1)
87
+ astrolabe (~> 1.3)
88
+ parser (>= 2.2.2.5, < 3.0)
89
+ powerpack (~> 0.1)
90
+ rainbow (>= 1.99.1, < 3.0)
91
+ ruby-progressbar (~> 1.4)
92
+ ruby-progressbar (1.7.5)
93
+ ruby2ruby (1.2.5)
94
+ ruby_parser (~> 2.0)
95
+ sexp_processor (~> 3.0)
96
+ ruby_parser (2.3.1)
97
+ sexp_processor (~> 3.0)
98
+ settingslogic (2.0.9)
99
+ sexp_processor (3.2.0)
100
+ shoulda (3.5.0)
101
+ shoulda-context (~> 1.0, >= 1.0.1)
102
+ shoulda-matchers (>= 1.4.1, < 3.0)
103
+ shoulda-context (1.2.1)
104
+ shoulda-matchers (2.8.0)
105
+ activesupport (>= 3.0.0)
106
+ simplecov (0.10.0)
107
+ docile (~> 1.1.0)
108
+ json (~> 1.8)
109
+ simplecov-html (~> 0.10.0)
110
+ simplecov-html (0.10.0)
111
+ terminal-announce (1.0.0)
112
+ bundler
113
+ contracts
114
+ rainbow
115
+ thread_safe (0.3.5)
116
+ tzinfo (1.2.2)
117
+ thread_safe (~> 0.1)
118
+ unf (0.1.4)
119
+ unf_ext
120
+ unf_ext (0.0.7.1)
121
+ yard (0.8.7.6)
122
+
123
+ PLATFORMS
124
+ ruby
125
+
126
+ DEPENDENCIES
127
+ activesupport (~> 4.2)
128
+ bundler (~> 1.0)
129
+ commander (~> 4.3)
130
+ jeweler (~> 2.0)
131
+ json (~> 1.8)
132
+ rdoc (~> 3.12)
133
+ reek (~> 1.2)
134
+ rest-client (~> 1.8)
135
+ roodi (~> 2.1)
136
+ rubocop (~> 0.32)
137
+ settingslogic (~> 2.0)
138
+ shoulda (~> 3.5)
139
+ simplecov (~> 0.10)
140
+ terminal-announce (~> 1.0)
141
+ yard (~> 0.7)
142
+
143
+ BUNDLED WITH
144
+ 1.10.6
data/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # veracodecli
2
2
 
3
+ [![Code Climate](https://codeclimate.com/github/isand3r/veracodecli/badges/gpa.svg)](https://codeclimate.com/github/isand3r/veracodecli)
4
+
3
5
  A ruby cli gem for interacting with the veracode API
4
6
 
5
7
  ## Table of contents
6
8
 
7
9
  - [Installation](#installation)
8
10
  - [Usage](#usage)
9
- - [How To Contribute](#how-to-contribute)
11
+ - [Roadmap](#roadmap)
10
12
  - [License](#license)
11
13
  - [Contributors](#contributors)
12
14
 
@@ -18,21 +20,12 @@ gem install veracodecli
18
20
 
19
21
  ## Usage
20
22
 
21
- 1. Set `VERACODE_USERNAME` and `VERACODE_PASSWORD` environment variables to your API credentials for the veracode API.
22
- 2. To run a scan use `veracodecli scan` _app\_name_ _archive\_path_
23
+ 1. set appropriate configs in `~/veracode_data/config.yml`. The only two that are _required_ are `veracode_username` and `veracode_password` that are your API credentials for veracode
24
+ 2. To run a scan use `veracodecli scan` --app_name _app\_name_ --repo _repo\_url_
23
25
 
24
26
  - `veracodecli help` to see commands
25
27
  - `veracodecli [command] -h` to see command syntax
26
28
 
27
- ## How To Contribute
28
- This gem uses [jeweler](https://github.com/technicalpickles/jeweler) for development. Read about relevant commands at that repo.
29
-
30
- * Fork the project.
31
- * Start a feature/bugfix branch.
32
- * Use `rake install` in the main directory to install the gem on your system.
33
- * Commit and push until you are happy with your contribution.
34
- * Make a pull request to this repo.
35
-
36
29
  ## Roadmap
37
30
  Ideas for future development.
38
31
 
data/Rakefile ADDED
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "veracodecli"
18
+ gem.homepage = "http://github.com/isand3r/veracodecli"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Ruby based CLI for accessing veracode's api}
21
+ gem.description = %Q{Ruby based CLI for accessing veracode's api}
22
+ gem.email = "isaiah.thiessen@telus.com"
23
+ gem.authors = ["isaiah thiessen"]
24
+ gem.files = `git ls-files`.split("\n")
25
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
27
+ gem.require_paths = ['lib']
28
+ # dependencies defined in Gemfile
29
+ end
30
+ Jeweler::RubygemsDotOrgTasks.new
31
+
32
+ require 'rake/testtask'
33
+ Rake::TestTask.new(:test) do |test|
34
+ test.libs << 'lib' << 'test'
35
+ test.pattern = 'test/**/test_*.rb'
36
+ test.verbose = true
37
+ end
38
+
39
+ require 'rubocop/rake_task'
40
+ RuboCop::RakeTask.new(:rubocop) do |task|
41
+ task.patterns = ['lib/**/*.rb']
42
+ task.fail_on_error = false
43
+ end
44
+
45
+ desc "Code coverage detail"
46
+ task :simplecov do
47
+ ENV['COVERAGE'] = "true"
48
+ Rake::Task['test'].execute
49
+ end
50
+
51
+ require 'reek/rake/task'
52
+ Reek::Rake::Task.new do |t|
53
+ t.fail_on_error = true
54
+ t.verbose = false
55
+ t.source_files = 'lib/**/*.rb'
56
+ end
57
+
58
+ require 'roodi'
59
+ require 'roodi_task'
60
+ RoodiTask.new do |t|
61
+ t.verbose = false
62
+ end
63
+
64
+ task :default => :test
65
+
66
+ require 'yard'
67
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/bin/veracodecli CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'commander'
4
4
  require 'veracodecli'
5
+ require_relative '../lib/veracodecli/settings'
5
6
  include VeracodeApiResults
6
7
  include VeracodeApiScan
7
8
  include VeracodeApiBase
@@ -16,19 +17,23 @@ Commander.configure do
16
17
  command :scan do |c|
17
18
  c.syntax = 'veracodecli scan [app_name] [repo] --option [option]'
18
19
  c.description = 'Submits a scan to Veracode.'
19
- c.option '--business_unit NAME', String, 'Business Unit Name'
20
- c.option '--team NAME', String, 'Team Name'
21
- c.option '--business_criticality', String, 'Application business criticality'
22
- c.action do |args,options|
23
- fail 'Specify application Name.' if args.first.nil?
24
- fail 'Specify repo location.' if args[1].nil?
25
- options.default :business_criticality => 'High'
26
- options.default :business_unit => 'TELUS Digital'
27
- directory = "/home/#{ENV['USER']}/veracodecli_data/sast_clone"
28
- VeracodeApiBase.load_config
29
- VeracodeApiBase.get_repo_archive args[1], directory
30
- VeracodeApiMacros.submit_scan_macro args[0], options.business_criticality, options.business_unit, options.team, "#{directory}/sast_upload.tar"
31
- `cd #{directory}; rm -r sast_upload.tar`
20
+ c.option '--business_unit STRING', String, 'Business Unit Name'
21
+ c.option '--team STRING', String, 'Team Name'
22
+ c.option '--business_criticality STRING', String, 'Application business criticality'
23
+ c.option '--app_name STRING', String, 'Name of the app to scan'
24
+ c.option '--repo STRING', String, 'The URL of application repo'
25
+ c.action do |_,options|
26
+ abort 'Missing parameter --repo' unless options.repo
27
+ abort 'Missing parameter --app_name' unless options.app_name
28
+ abort 'Missing parameter --business_unit' unless options.business_unit || defined? Settings.business_unit
29
+ abort 'Missing parameter --team' unless options.team || defined? Settings.team
30
+ abort 'Missing parameter --business_criticality' unless options.business_criticality || defined? Settings.business_criticality
31
+
32
+ business_criticality = options.business_criticality || Settings.business_criticality
33
+ business_unit = options.business_unit || Settings.business_unit
34
+ team = options.team || Settings.team
35
+ VeracodeApiBase.get_repo_archive options.repo
36
+ VeracodeApiMacros.submit_scan_macro options.app_name, business_criticality, business_unit, team
32
37
  end
33
38
  end
34
39
 
@@ -51,7 +56,7 @@ Commander.configure do
51
56
  end
52
57
 
53
58
  command :get_report do |c|
54
- c.syntax = 'veracodecli get-report [app_name]'
59
+ c.syntax = 'veracodecli get_report [app_name]'
55
60
  c.description = 'Downloads the final scan report from Veracode.'
56
61
  c.action do |args|
57
62
  fail 'Specify app_name.' if args.first.nil?
@@ -60,11 +65,16 @@ Commander.configure do
60
65
  end
61
66
 
62
67
  command :get_pdf_report do |c|
63
- c.syntax = 'veracodecli get-pdf [app_name]'
68
+ c.syntax = 'veracodecli get_pdf_report [app_name] --option [option]'
69
+ c.option '--app STRING', String, 'Upload report to slack?'
70
+ c.option '--slack_upload STRING', String, 'Upload report to slack?'
64
71
  c.description = 'Downloads the final scan report in pdf format.'
65
- c.action do |args|
66
- fail 'Specify app_name.' if args.first.nil?
67
- VeracodeApiMacros.get_pdf_macro args.first
72
+ c.action do |args, options|
73
+ abort 'Please specify slack token in config.yml' if ((!defined? Settings.slack_token) && (options.slack_upload.eql? 'yes'))
74
+ abort 'Please specify slack channel in config.yml' if ((!defined? Settings.slack_channel) && (options.slack_upload.eql? 'yes'))
75
+ abort 'Please specify an app' unless options.app
76
+ file = VeracodeApiMacros.get_pdf_macro args.first
77
+ Slack.send_to_slack file if (options.slack_upload.eql? 'yes')
68
78
  end
69
79
  end
70
80
  end
@@ -2,30 +2,20 @@ require 'json'
2
2
  require 'active_support/core_ext/hash'
3
3
  require 'rest-client'
4
4
  require 'yaml'
5
+ require_relative 'settings'
5
6
 
6
7
  module VeracodeApiBase
7
- def check_environment_login_variables
8
- fail 'EnvironmentError: VERACODE_USERNAME or VERACODE_PASSWORD not set in config.' unless !ENV['VERACODE_USERNAME'].nil? || !ENV['VERACODE_PASSWORD'].nil?
9
- end
10
-
11
8
  def veracode_api_request(api_call, api_version: '4.0', **params)
12
- check_environment_login_variables
13
- response = RestClient.get "https://#{ENV['VERACODE_USERNAME']}:#{ENV['VERACODE_PASSWORD']}@analysiscenter.veracode.com/api/#{api_version}/#{api_call}", { params: params }
14
- end
15
-
16
- def get_repo_archive(url, directory)
17
- if !Dir.exists?(directory) then `git clone #{url} #{directory}` end
18
- if Dir.exists?(directory) then `cd #{directory}; git pull; git archive --format=tar -o sast_upload.tar master` else fail 'Repository not found' end
9
+ begin
10
+ RestClient.post "https://#{Settings.veracode_username}:#{Settings.veracode_password}@analysiscenter.veracode.com/api/#{api_version}/#{api_call}", { params: params }
11
+ rescue
12
+ abort '401: Unauthorized. Veracode API call Failed, please check your veracode credentials or whitelisted IPs'
13
+ end
19
14
  end
20
15
 
21
- def load_config
22
- dir = "/home/#{ENV['USER']}/veracodecli_data"
23
- `mkdir #{dir}` unless Dir.exists? dir
24
- fail 'ConfigError: Config File not setup. Please create config.yaml at /home/$USER/veracodecli' unless File.exist?("#{dir}/config.yaml")
25
- config = YAML.load_file "#{dir}/config.yaml"
26
- config.each_key do |key|
27
- ENV[key] = config[key]
28
- end
16
+ def get_repo_archive(url)
17
+ directory = "/tmp/sast_clone"
18
+ `git archive --remote #{url} --format=tar -o #{directory}/sast_upload.tar master`
29
19
  end
30
20
  end
31
21
 
@@ -43,19 +33,19 @@ module VeracodeApiScan
43
33
  app_id
44
34
  end
45
35
 
46
- def create_app_profile(app_name, business_criticality, business_unit, teams)
47
- create_app_response = veracode_api_request 'createapp.do', app_name: app_name, business_criticality: business_criticality, business_unit: business_unit, teams: teams
48
- app_id = create_app_response.body.scan(/app_id=\"(.+)\" app_name=\"#{app_name}\"/)[0][0]
36
+ def create_app_profile(app_name, business_criticality, business_unit, team)
37
+ create_app_response = veracode_api_request 'createapp.do', app_name: app_name, business_criticality: business_criticality, business_unit: business_unit, teams: team
38
+ create_app_response.body.scan(/app_id=\"(.+)\" app_name=\"#{app_name}\"/)[0][0]
49
39
  end
50
40
 
51
41
  def upload_file(app_id, archive_path)
52
42
  # NOTE: curl must be used here because of a bug in the Veracode api. rest-client cannot be used while this bug is present.
53
43
  # NOTE: preferred code: upload_result = veracode_api_request 'uploadfile.do', app_id: app_id, file: "#{archive_path}"
54
- upload_file_response = `curl --url "https://#{ENV['VERACODE_USERNAME']}:#{ENV['VERACODE_PASSWORD']}@analysiscenter.veracode.com/api/4.0/uploadfile.do" -F 'app_id=#{app_id}' -F 'file=@#{archive_path}'`
44
+ `curl --url "https://#{Settings.veracode_username}:#{Settings.veracode_password}@analysiscenter.veracode.com/api/4.0/uploadfile.do" -F 'app_id=#{app_id}' -F 'file=@#{archive_path}'`
55
45
  end
56
46
 
57
47
  def submit_prescan(app_id)
58
- submit_prescan_response = veracode_api_request 'beginprescan.do', app_id: app_id, auto_scan: 'true'
48
+ veracode_api_request 'beginprescan.do', app_id: app_id, auto_scan: 'true'
59
49
  end
60
50
  end
61
51
 
@@ -67,13 +57,13 @@ module VeracodeApiResults
67
57
  build_list.body.scan(/build_id="(.*?)"/).last[0]
68
58
  end
69
59
 
70
- def get_build_status(app_id)
71
- build_info = veracode_api_request 'getbuildinfo.do', app_id: app_id
72
- build_id = build_info.body.scan(/build_id="(.*?)"/)[0][0]
73
- build_status = build_info.body.scan(/status="(.*?)"/).last[0]
74
- puts build_status
75
- build_status
76
- end
60
+ # def get_build_status(app_id)
61
+ # build_info = veracode_api_request 'getbuildinfo.do', app_id: app_id
62
+ # build_id = build_info.body.scan(/build_id="(.*?)"/)[0][0]
63
+ # build_status = build_info.body.scan(/status="(.*?)"/).last[0]
64
+ # puts build_status
65
+ # build_status
66
+ # end
77
67
 
78
68
  def get_prescan_results(app_id)
79
69
  results = veracode_api_request 'getprescanresults.do', app_id: app_id
@@ -84,12 +74,12 @@ module VeracodeApiResults
84
74
 
85
75
  def get_scan_report(build_id)
86
76
  report = veracode_api_request 'detailedreport.do', api_version: '3.0', build_id: build_id
87
- report = report.body
77
+ report.body
88
78
  end
89
79
 
90
80
  def get_scan_report_pdf(build_id)
91
81
  report = veracode_api_request 'detailedreportpdf.do', api_version: '3.0', build_id: build_id
92
- report = report.body
82
+ report.body
93
83
  end
94
84
  end
95
85
 
@@ -97,10 +87,11 @@ module VeracodeApiMacros
97
87
  include VeracodeApiScan
98
88
  include VeracodeApiResults
99
89
 
100
- def submit_scan_macro(app_name, business_criticality, business_unit, teams, archive_path)
90
+ def submit_scan_macro(app_name, business_criticality, business_unit, team)
91
+ archive_path = "/tmp/sast_clone/sast_upload.tar"
101
92
  app_id = get_app_id(app_name)
102
93
  if app_id.nil?
103
- app_id = create_app_profile(app_name, business_criticality, business_unit, teams)
94
+ app_id = create_app_profile(app_name, business_criticality, business_unit, team)
104
95
  end
105
96
  upload_file app_id, archive_path
106
97
  submit_prescan app_id
@@ -109,15 +100,17 @@ module VeracodeApiMacros
109
100
  def get_report_macro(app_name)
110
101
  app_id = get_app_id app_name
111
102
  build_id = get_most_recent_build_id app_id
112
- report = get_scan_report build_id
103
+ p get_scan_report build_id
113
104
  end
114
105
 
115
106
  def get_pdf_macro(app_name)
116
107
  app_id = get_app_id app_name
117
108
  build_id = get_most_recent_build_id app_id
118
109
  report = get_scan_report_pdf build_id
119
- file = File.open "/etc/veracodecli_data/#{build_id}_report.pdf", 'w+'
110
+ file_path = "/tmp/#{build_id}_report.pdf"
111
+ file = File.open file_path, 'w+'
120
112
  file.write report
121
113
  file.close
114
+ return file_path
122
115
  end
123
116
  end
data/lib/veracodecli.rb CHANGED
@@ -1 +1,2 @@
1
1
  require_relative 'veracodecli/api'
2
+ require_relative 'veracodecli/slack'
Binary file
@@ -0,0 +1,99 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: veracodecli 0.1.1 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "veracodecli"
9
+ s.version = "1.0.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["isaiah thiessen"]
14
+ s.date = "2015-10-29"
15
+ s.description = "Ruby based CLI for accessing veracode's api"
16
+ s.email = "isaiah.thiessen@telus.com"
17
+ s.executables = ["veracodecli"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE.txt",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ ".document",
24
+ ".gitignore",
25
+ "Gemfile",
26
+ "Gemfile.lock",
27
+ "LICENSE.txt",
28
+ "README.md",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "bin/veracodecli",
32
+ "lib/veracodecli.rb",
33
+ "lib/veracodecli/api.rb",
34
+ "test/API.rb",
35
+ "test/helper.rb",
36
+ "test/test_veracodecli.rb",
37
+ "veracodecli-0.2.0.gem",
38
+ "veracodecli.gemspec"
39
+ ]
40
+ s.homepage = "http://github.com/isand3r/veracodecli"
41
+ s.licenses = ["MIT"]
42
+ s.rubygems_version = "2.4.6"
43
+ s.summary = "Ruby based CLI for accessing veracode's api"
44
+ s.test_files = ["test/API.rb", "test/helper.rb", "test/test_veracodecli.rb"]
45
+
46
+ if s.respond_to? :specification_version then
47
+ s.specification_version = 4
48
+
49
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<activesupport>, ["~> 4.2"])
51
+ s.add_runtime_dependency(%q<commander>, ["~> 4.3"])
52
+ s.add_runtime_dependency(%q<json>, ["~> 1.8"])
53
+ s.add_runtime_dependency(%q<rest-client>, ["~> 1.8"])
54
+ s.add_runtime_dependency(%q<settingslogic>, ["~> 2.0"])
55
+ s.add_runtime_dependency(%q<terminal-announce>, ["~> 1.0"])
56
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
57
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
58
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_development_dependency(%q<reek>, ["~> 1.2"])
60
+ s.add_development_dependency(%q<roodi>, ["~> 2.1"])
61
+ s.add_development_dependency(%q<shoulda>, ["~> 3.5"])
62
+ s.add_development_dependency(%q<rubocop>, ["~> 0.32"])
63
+ s.add_development_dependency(%q<simplecov>, ["~> 0.10"])
64
+ s.add_development_dependency(%q<yard>, ["~> 0.7"])
65
+ else
66
+ s.add_dependency(%q<activesupport>, ["~> 4.2"])
67
+ s.add_dependency(%q<commander>, ["~> 4.3"])
68
+ s.add_dependency(%q<json>, ["~> 1.8"])
69
+ s.add_dependency(%q<rest-client>, ["~> 1.8"])
70
+ s.add_dependency(%q<settingslogic>, ["~> 2.0"])
71
+ s.add_dependency(%q<terminal-announce>, ["~> 1.0"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
73
+ s.add_dependency(%q<jeweler>, ["~> 2.0"])
74
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
75
+ s.add_dependency(%q<reek>, ["~> 1.2"])
76
+ s.add_dependency(%q<roodi>, ["~> 2.1"])
77
+ s.add_dependency(%q<shoulda>, ["~> 3.5"])
78
+ s.add_dependency(%q<rubocop>, ["~> 0.32"])
79
+ s.add_dependency(%q<simplecov>, ["~> 0.10"])
80
+ s.add_dependency(%q<yard>, ["~> 0.7"])
81
+ end
82
+ else
83
+ s.add_dependency(%q<activesupport>, ["~> 4.2"])
84
+ s.add_dependency(%q<commander>, ["~> 4.3"])
85
+ s.add_dependency(%q<json>, ["~> 1.8"])
86
+ s.add_dependency(%q<rest-client>, ["~> 1.8"])
87
+ s.add_dependency(%q<settingslogic>, ["~> 2.0"])
88
+ s.add_dependency(%q<terminal-announce>, ["~> 1.0"])
89
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
90
+ s.add_dependency(%q<jeweler>, ["~> 2.0"])
91
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
92
+ s.add_dependency(%q<reek>, ["~> 1.2"])
93
+ s.add_dependency(%q<roodi>, ["~> 2.1"])
94
+ s.add_dependency(%q<shoulda>, ["~> 3.5"])
95
+ s.add_dependency(%q<rubocop>, ["~> 0.32"])
96
+ s.add_dependency(%q<simplecov>, ["~> 0.10"])
97
+ s.add_dependency(%q<yard>, ["~> 0.7"])
98
+ end
99
+ end
metadata CHANGED
@@ -1,99 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veracodecli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - isaiah thiessen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-22 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: json
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4.2'
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
- version: '0'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: commander
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ">="
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: '1.8'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ">="
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: '1.8'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rest-client
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ">="
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: '1.8'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ">="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: '1.8'
55
69
  - !ruby/object:Gem::Dependency
56
- name: commander
70
+ name: settingslogic
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: '2.0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: '2.0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: shoulda
84
+ name: terminal-announce
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - ">="
101
+ - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: '0'
103
+ version: '1.0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - ">="
108
+ - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: '0'
110
+ version: '1.0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: yard
112
+ name: jeweler
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - "~>"
88
116
  - !ruby/object:Gem::Version
89
- version: '0.7'
117
+ version: '2.0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
- version: '0.7'
124
+ version: '2.0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: rdoc
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -109,89 +137,89 @@ dependencies:
109
137
  - !ruby/object:Gem::Version
110
138
  version: '3.12'
111
139
  - !ruby/object:Gem::Dependency
112
- name: bundler
140
+ name: reek
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - "~>"
116
144
  - !ruby/object:Gem::Version
117
- version: '1.0'
145
+ version: '1.2'
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
- version: '1.0'
152
+ version: '1.2'
125
153
  - !ruby/object:Gem::Dependency
126
- name: jeweler
154
+ name: roodi
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
157
  - - "~>"
130
158
  - !ruby/object:Gem::Version
131
- version: 2.0.1
159
+ version: '2.1'
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
164
  - - "~>"
137
165
  - !ruby/object:Gem::Version
138
- version: 2.0.1
166
+ version: '2.1'
139
167
  - !ruby/object:Gem::Dependency
140
- name: simplecov
168
+ name: shoulda
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
- - - ">="
171
+ - - "~>"
144
172
  - !ruby/object:Gem::Version
145
- version: '0'
173
+ version: '3.5'
146
174
  type: :development
147
175
  prerelease: false
148
176
  version_requirements: !ruby/object:Gem::Requirement
149
177
  requirements:
150
- - - ">="
178
+ - - "~>"
151
179
  - !ruby/object:Gem::Version
152
- version: '0'
180
+ version: '3.5'
153
181
  - !ruby/object:Gem::Dependency
154
- name: reek
182
+ name: rubocop
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
185
  - - "~>"
158
186
  - !ruby/object:Gem::Version
159
- version: 1.2.8
187
+ version: '0.32'
160
188
  type: :development
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
192
  - - "~>"
165
193
  - !ruby/object:Gem::Version
166
- version: 1.2.8
194
+ version: '0.32'
167
195
  - !ruby/object:Gem::Dependency
168
- name: roodi
196
+ name: simplecov
169
197
  requirement: !ruby/object:Gem::Requirement
170
198
  requirements:
171
199
  - - "~>"
172
200
  - !ruby/object:Gem::Version
173
- version: 2.1.0
201
+ version: '0.10'
174
202
  type: :development
175
203
  prerelease: false
176
204
  version_requirements: !ruby/object:Gem::Requirement
177
205
  requirements:
178
206
  - - "~>"
179
207
  - !ruby/object:Gem::Version
180
- version: 2.1.0
208
+ version: '0.10'
181
209
  - !ruby/object:Gem::Dependency
182
- name: psych
210
+ name: yard
183
211
  requirement: !ruby/object:Gem::Requirement
184
212
  requirements:
185
213
  - - "~>"
186
214
  - !ruby/object:Gem::Version
187
- version: 2.1.0
215
+ version: '0.7'
188
216
  type: :development
189
217
  prerelease: false
190
218
  version_requirements: !ruby/object:Gem::Requirement
191
219
  requirements:
192
220
  - - "~>"
193
221
  - !ruby/object:Gem::Version
194
- version: 2.1.0
222
+ version: '0.7'
195
223
  description: Ruby based CLI for accessing veracode's api
196
224
  email: isaiah.thiessen@telus.com
197
225
  executables:
@@ -201,14 +229,22 @@ extra_rdoc_files:
201
229
  - LICENSE.txt
202
230
  - README.md
203
231
  files:
232
+ - ".document"
233
+ - ".gitignore"
234
+ - Gemfile
235
+ - Gemfile.lock
204
236
  - LICENSE.txt
205
237
  - README.md
238
+ - Rakefile
239
+ - VERSION
206
240
  - bin/veracodecli
207
241
  - lib/veracodecli.rb
208
242
  - lib/veracodecli/api.rb
209
243
  - test/API.rb
210
244
  - test/helper.rb
211
245
  - test/test_veracodecli.rb
246
+ - veracodecli-0.2.0.gem
247
+ - veracodecli.gemspec
212
248
  homepage: http://github.com/isand3r/veracodecli
213
249
  licenses:
214
250
  - MIT