hackerone-client 0.2.1 → 0.2.2

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: eae8f2a0596bfea4752e9fb67a56da8dea4901a9
4
- data.tar.gz: b891bace9cba415e442d4c6cdbfb095e29da0a6b
3
+ metadata.gz: 0c7e4199e1bbc78495265cca78fdb4629735c76d
4
+ data.tar.gz: 5ce2ab8e327c38de8768d32f76c2517561699a82
5
5
  SHA512:
6
- metadata.gz: f667e613c0300b4c883b235b6f419c746f6145a0e95c7cf1c7273d71fced66f8f20f57a4299ff43d9346b0ad88da992b0bbf0c45cf140118a1cdb989126e45a9
7
- data.tar.gz: 67528f88aba28f56c2a8d30dae45f6441e1e39309906521fad94809721bab05612db096fa9ca6b2583fd7be1c1dc17dc61dec20cf45e57141896a374e9b67516
6
+ metadata.gz: 146c0dcbcd81b41221403ba196c44d6b657309010848fa16112a9e673dda32652291688132ab11cee1276431e45784e0b47becf71528f9a78162ffb65b52900f
7
+ data.tar.gz: 0c4db1c49523cb51ab96e3ee66fe95e0406e48641939c594d8b00c6be54457a840443c785a2daa54277c1a6aa89b20e9df88741bbe2d5908441d05e931a0a969
@@ -1,5 +1,5 @@
1
1
  module Hackerone
2
2
  module Client
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -3,12 +3,30 @@ module HackerOne
3
3
  class Weakness
4
4
  class << self
5
5
  def extract_cwe_number(cwe)
6
+ return if cwe.nil?
6
7
  fail StandardError::ArgumentError unless cwe.upcase.start_with?('CWE-')
7
8
 
8
9
  cwe.split('CWE-').last.to_i
9
10
  end
10
11
  end
11
12
 
13
+ CLASSIFICATION_MAPPING = {
14
+ "None Applicable" => "A0-Other",
15
+ "Denial of Service" => "A0-Other",
16
+ "Memory Corruption" => "A0-Other",
17
+ "Cryptographic Issue" => "A0-Other",
18
+ "Privilege Escalation" => "A0-Other",
19
+ "UI Redressing (Clickjacking)" => "A0-Other",
20
+ "Command Injection" => "A1-Injection",
21
+ "Remote Code Execution" => "A1-Injection",
22
+ "SQL Injection" => "A1-Injection",
23
+ "Authentication" => "A2-AuthSession",
24
+ "Cross-Site Scripting (XSS)" => "A3-XSS",
25
+ "Information Disclosure" => "A6-DataExposure",
26
+ "Cross-Site Request Forgery (CSRF)" => "A8-CSRF",
27
+ "Unvalidated / Open Redirect" => "A10-Redirects"
28
+ }
29
+
12
30
  OWASP_TOP_10_2013_TO_CWE = {
13
31
  'A1-Injection' => [77, 78, 88, 89, 90, 91, 564],
14
32
  'A2-AuthSession' =>
@@ -30,9 +48,11 @@ module HackerOne
30
48
  end
31
49
 
32
50
  def to_owasp
33
- OWASP_TOP_10_2013_TO_CWE.map do |owasp, cwes|
51
+ from_cwe = OWASP_TOP_10_2013_TO_CWE.map do |owasp, cwes|
34
52
  owasp if cwes.include?(self.class.extract_cwe_number(to_cwe))
35
- end.compact.first || OWASP_DEFAULT
53
+ end.compact.first
54
+
55
+ from_cwe || CLASSIFICATION_MAPPING[@attributes[:name]] || OWASP_DEFAULT
36
56
  end
37
57
 
38
58
  def to_cwe
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackerone-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Matatall
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-18 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler