Class: HackerOne::Client::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/hackerone/client/report.rb

Constant Summary collapse

PAYOUT_ACTIVITY_KEY =
"activity-bounty-awarded"

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ Report

Returns a new instance of Report.



8
9
10
# File 'lib/hackerone/client/report.rb', line 8

def initialize(report)
  @report = report
end

Instance Method Details

#classification_labelObject



62
63
64
# File 'lib/hackerone/client/report.rb', line 62

def classification_label
  weakness.to_owasp
end

#created_atObject



20
21
22
# File 'lib/hackerone/client/report.rb', line 20

def created_at
  attributes[:created_at]
end

#idObject



12
13
14
# File 'lib/hackerone/client/report.rb', line 12

def id
  @report[:id]
end

#issue_tracker_reference_urlObject



24
25
26
# File 'lib/hackerone/client/report.rb', line 24

def issue_tracker_reference_url
  attributes[:issue_tracker_reference_url]
end

#payment_totalObject



35
36
37
# File 'lib/hackerone/client/report.rb', line 35

def payment_total
  payments.reduce(0) { |total, payment| total + payment_amount(payment) }
end

#reporterObject



28
29
30
31
32
33
# File 'lib/hackerone/client/report.rb', line 28

def reporter
  relationships
    .fetch(:reporter, {})
    .fetch(:data, {})
    .fetch(:attributes, {})
end

#riskObject

Excludes reports where the payout amount is 0 indicating swag-only or no payout for the issue supplied



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/hackerone/client/report.rb', line 41

def risk
  case payment_total
  when HackerOne::Client.low_range || DEFAULT_LOW_RANGE
    "low"
  when HackerOne::Client.medium_range || DEFAULT_MEDIUM_RANGE
    "medium"
  when HackerOne::Client.high_range || DEFAULT_HIGH_RANGE
    "high"
  when HackerOne::Client.critical_range || DEFAULT_CRITICAL_RANGE
    "critical"
  end
end

#summaryObject



54
55
56
# File 'lib/hackerone/client/report.rb', line 54

def summary
  attributes[:vulnerability_information]
end

#titleObject



16
17
18
# File 'lib/hackerone/client/report.rb', line 16

def title
  attributes[:title]
end

#weaknessObject



58
59
60
# File 'lib/hackerone/client/report.rb', line 58

def weakness
  @weakness ||= Weakness.new relationships[:weakness][:data][:attributes]
end

#writeup_classificationObject

Bounty writeups just use the key, and not the label value.



67
68
69
# File 'lib/hackerone/client/report.rb', line 67

def writeup_classification
  classification_label().split("-").first
end