Skip to content

Commit c3dbbe3

Browse files
authored
Fix bugcrowd (#208)
Co-authored-by: arkadiyt <>
1 parent c7c6012 commit c3dbbe3

1 file changed

Lines changed: 1 addition & 51 deletions

File tree

lib/bounty-targets/bugcrowd.rb

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -50,63 +50,13 @@ def directory_index
5050
end
5151

5252
def parse_program(program_link)
53-
return parse_engagement(program_link) if program_link.start_with?('https://bugcrowd.com/engagements/')
54-
55-
uri = URI(program_link)
56-
response = ::SsrfFilter.get(uri).body
57-
document = ::Nokogiri::HTML(response)
58-
59-
name = document.css('h1.bc-panel__title').inner_text.strip
60-
raise StandardError, 'Bugcrowd program came back blank' if name.empty?
61-
62-
allows_disclosure = document.css('div.bc-panel__main').all? do |node|
63-
node.inner_text !~ /This program does not allow disclosure/
64-
end
65-
66-
safe_harbor = document.css('.bc-stat__title').find do |node|
67-
node.inner_text =~ /safe harbor/i
68-
end
69-
safe_harbor_value = case safe_harbor&.inner_text&.strip
70-
when 'Safe harbor'
71-
'full'
72-
when 'Partial safe harbor'
73-
'partial'
74-
else
75-
'none'
76-
end
77-
78-
max_payout = document.css('.bc-program-card__reward')
79-
max_payout_amount = max_payout.inner_text.strip.match(/\A.* – \$([0-9,]+).*per vulnerability\Z/m)
80-
max_payout_amount = if max_payout_amount.nil?
81-
0
82-
else
83-
max_payout_amount[1].gsub(',', '').to_i
84-
end
85-
86-
uri.path += '/target_groups.json'
87-
groups = ::JSON.parse(::SsrfFilter.get(uri).body)['groups'] || {}
88-
{
89-
name: name,
90-
url: program_link,
91-
allows_disclosure: allows_disclosure,
92-
managed_by_bugcrowd: true, # Bugcrowd seems to have removed the flag for this / all programs are managed
93-
safe_harbor: safe_harbor_value,
94-
max_payout: max_payout_amount,
95-
targets: {
96-
in_scope: scopes_to_hashes(uri, groups.select { |group| group['in_scope'] == true }),
97-
out_of_scope: scopes_to_hashes(uri, groups.select { |group| group['in_scope'] == false })
98-
}
99-
}
100-
end
101-
102-
def parse_engagement(program_link)
10353
uri = URI(program_link)
10454
response = ::SsrfFilter.get(uri).body
10555
document = ::Nokogiri::HTML(response)
10656

10757
brief_url = ::JSON.parse(document.css('div[data-react-class="ResearcherEngagementBrief"]')
10858
.attr('data-api-endpoints').value)['engagementBriefApi']['getBriefVersionDocument']
109-
brief = ::JSON.parse(::SsrfFilter.get(URI("https://bugcrowd.com/#{brief_url}.json")).body)
59+
brief = ::JSON.parse(::SsrfFilter.get(URI("https://#{uri.host}/#{brief_url}.json")).body)
11060
data = brief['data']['brief']
11161
brief_scope = brief['data']['scope']
11262
{

0 commit comments

Comments
 (0)