Module: VeracodeApiScan
Instance Method Summary
collapse
#check_environment_login_variables, #veracode_api_request, #write, #xml_to_json
Instance Method Details
#submit_scan(hostname, archive_path) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/veracodecli/api.rb', line 48
def submit_scan(hostname, archive_path)
app_id = validate_existance of: hostname
upload_result = `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}'`
puts upload_result
prescan_submission_result = veracode_api_request 'beginprescan.do', app_id: app_id, auto_scan: 'true'
puts prescan_submission_result
puts "Submit complete for #{app_id}"
end
|
#validate_existance(of:) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/veracodecli/api.rb', line 33
def validate_existance(of:)
puts "Validating records for #{of}"
app_list = veracode_api_request 'getapplist.do', include_user_info: 'true'
if app_list.include? "#{of}"
puts 'Record found, submitting'
return app_list.scan(/app_id=\"(.+)\" app_name=\"#{of}\"/)[0][0]
else
puts 'Record not found, creating one'
create_app_result = veracode_api_request 'createapp.do', app_name: of, description: "Static Scanning profile for #{of}.", business_criticality: 'High', business_unit: 'TELUS Digital', web_application: 'true', teams: "#{ENV['VERACODE_TEAM']}"
app_id = create_app_result.scan(/app_id=\"(.+)\" app_name=\"#{of}\"/)[0][0]
puts "Record successfully created, app_id is #{app_id}"
return app_id
end
end
|