hackerone-client 0.22.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +18 -1
- data/lib/hackerone/client/asset.rb +60 -0
- data/lib/hackerone/client/organization.rb +34 -0
- data/lib/hackerone/client/program.rb +15 -2
- data/lib/hackerone/client/report.rb +1 -1
- data/lib/hackerone/client/structured_scope.rb +20 -2
- data/lib/hackerone/client/version.rb +1 -1
- data/lib/hackerone/client.rb +3 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2fdab8aa46e47e1103a2fdb1dc78c42689e8c1c2635133bbf46a1dcec8ac039
|
4
|
+
data.tar.gz: 7326e1a37eda609ae45617ef9a100e3d6fa57bff8b6a40d77e622104b889e471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e48cb154448b6cc74b3a2a9b57febe3b773ea49ad5e802617ad611a7fa5df4453ded6b708dddb418a478195eaba9064df0572a8227e1cfcc0adfe1dfe627dc3
|
7
|
+
data.tar.gz: 345710ef1635331f860ec6bc561ddaed4de35303983851c1f4d80077e665253a2e1465574e3d54c6b887a70e74b8f2b6fee3a4c1ff0317ccde24f2d345398b51
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## [0.23.0] - 2024-08-09
|
2
|
+
|
3
|
+
[Add Asset and Organization resources](https://github.com/github/hackerone-client/pull/10) (@jeffgran-dox)
|
4
|
+
|
1
5
|
## [0.22.0] - 2024-01-10
|
2
6
|
|
3
7
|
[Update Faraday API call and deprecate support for Ruby <2.6](https://github.com/github/hackerone-client/pull/2) (@maclarel)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Hackerone::Client
|
2
2
|
|
3
|
-
A limited client library for interacting with HackerOne in Ruby. Currently
|
3
|
+
A limited client library for interacting with HackerOne in Ruby. Currently supports a few operations:
|
4
4
|
|
5
5
|
```ruby
|
6
6
|
client = HackerOne::Client::Api.new("github")
|
@@ -57,6 +57,23 @@ program.update_policy(policy: "Please submit valid vulnerabilities")
|
|
57
57
|
|
58
58
|
# Gets a program's balance
|
59
59
|
program.balance
|
60
|
+
|
61
|
+
# Gets a list of structured scopes
|
62
|
+
program.structured_scopes
|
63
|
+
|
64
|
+
# Gets an organization for a program
|
65
|
+
program.organization
|
66
|
+
|
67
|
+
# Gets assets for an organization
|
68
|
+
program.organization.assets
|
69
|
+
|
70
|
+
# Updates an asset for an organization
|
71
|
+
asset = program.organization.assets[0]
|
72
|
+
asset.update(
|
73
|
+
attributes: {
|
74
|
+
description: "This is the new description"
|
75
|
+
}
|
76
|
+
)
|
60
77
|
```
|
61
78
|
|
62
79
|
## State change hooks
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HackerOne
|
4
|
+
module Client
|
5
|
+
class Asset
|
6
|
+
include ResourceHelper
|
7
|
+
|
8
|
+
DELEGATES = [
|
9
|
+
:asset_type,
|
10
|
+
:identifier,
|
11
|
+
:description,
|
12
|
+
:coverage,
|
13
|
+
:max_severity,
|
14
|
+
:confidentiality_requirement,
|
15
|
+
:integrity_requirement,
|
16
|
+
:availability_requirement,
|
17
|
+
:created_at,
|
18
|
+
:updated_at,
|
19
|
+
:archived_at,
|
20
|
+
:reference,
|
21
|
+
:state,
|
22
|
+
]
|
23
|
+
|
24
|
+
delegate *DELEGATES, to: :attributes
|
25
|
+
|
26
|
+
attr_reader :organization
|
27
|
+
|
28
|
+
def initialize(asset, organization)
|
29
|
+
@asset = asset
|
30
|
+
@organization = organization
|
31
|
+
end
|
32
|
+
|
33
|
+
def id
|
34
|
+
@asset[:id]
|
35
|
+
end
|
36
|
+
|
37
|
+
def update(attributes:)
|
38
|
+
body = {
|
39
|
+
type: "asset",
|
40
|
+
attributes: attributes
|
41
|
+
}
|
42
|
+
make_put_request("organizations/#{organization.id}/assets/#{id}", request_body: body)
|
43
|
+
end
|
44
|
+
|
45
|
+
def programs
|
46
|
+
relationships.programs[:data].map { |p| Program.new(p) }
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def relationships
|
52
|
+
OpenStruct.new(@asset[:relationships])
|
53
|
+
end
|
54
|
+
|
55
|
+
def attributes
|
56
|
+
OpenStruct.new(@asset[:attributes])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HackerOne
|
4
|
+
module Client
|
5
|
+
class Organization
|
6
|
+
include ResourceHelper
|
7
|
+
|
8
|
+
delegate :handle, :created_at, :updated_at, to: :attributes
|
9
|
+
|
10
|
+
def initialize(org)
|
11
|
+
@organization = org
|
12
|
+
end
|
13
|
+
|
14
|
+
def id
|
15
|
+
@organization[:id]
|
16
|
+
end
|
17
|
+
|
18
|
+
def assets(page_number: 1, page_size: 100)
|
19
|
+
make_get_request(
|
20
|
+
"organizations/#{id}/assets",
|
21
|
+
params: { page: { number: page_number, size: page_size } }
|
22
|
+
).map do |asset_data|
|
23
|
+
Asset.new(asset_data, self)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def attributes
|
30
|
+
OpenStruct.new(@organization[:attributes])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -51,6 +51,15 @@ module HackerOne
|
|
51
51
|
groups.find { |group| group.name == groupname }
|
52
52
|
end
|
53
53
|
|
54
|
+
def structured_scopes(page_number: 1, page_size: 100)
|
55
|
+
make_get_request(
|
56
|
+
"programs/#{id}/structured_scopes",
|
57
|
+
params: { page: { number: page_number, size: page_size } }
|
58
|
+
).map do |data|
|
59
|
+
StructuredScope.new(data, self)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
54
63
|
def update_policy(policy:)
|
55
64
|
body = {
|
56
65
|
type: "program-policy",
|
@@ -83,8 +92,6 @@ module HackerOne
|
|
83
92
|
BillingBalance.new(response_body).balance
|
84
93
|
end
|
85
94
|
|
86
|
-
private
|
87
|
-
|
88
95
|
def members
|
89
96
|
@members ||= relationships.members[:data].map { |member_data| Member.new(member_data) }
|
90
97
|
end
|
@@ -93,6 +100,12 @@ module HackerOne
|
|
93
100
|
@groups ||= relationships.groups[:data].map { |group_data| Group.new(group_data) }
|
94
101
|
end
|
95
102
|
|
103
|
+
def organization
|
104
|
+
@organization ||= Organization.new(relationships.organization[:data])
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
96
109
|
def relationships
|
97
110
|
# Relationships are only included in the /programs/:id call,
|
98
111
|
# which is why we need to do a separate call here.
|
@@ -108,7 +108,7 @@ module HackerOne
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def structured_scope
|
111
|
-
StructuredScope.new(relationships[:structured_scope].fetch(:data, {}))
|
111
|
+
StructuredScope.new(relationships[:structured_scope].fetch(:data, {}), program)
|
112
112
|
end
|
113
113
|
|
114
114
|
# Excludes reports where the payout amount is 0 indicating swag-only or no
|
@@ -3,17 +3,27 @@
|
|
3
3
|
module HackerOne
|
4
4
|
module Client
|
5
5
|
class StructuredScope
|
6
|
+
include ResourceHelper
|
7
|
+
|
6
8
|
DELEGATES = [
|
7
9
|
:asset_identifier,
|
8
10
|
:asset_type,
|
11
|
+
:availability_requirement,
|
12
|
+
:confidentiality_requirement,
|
9
13
|
:eligible_for_bounty,
|
10
14
|
:eligible_for_submission,
|
11
|
-
:instruction
|
15
|
+
:instruction,
|
16
|
+
:integrity_requirement,
|
17
|
+
:max_severity,
|
18
|
+
:reference
|
12
19
|
]
|
13
20
|
|
14
21
|
delegate *DELEGATES, to: :attributes
|
15
22
|
|
16
|
-
|
23
|
+
attr_reader :program
|
24
|
+
|
25
|
+
def initialize(scope, program = nil)
|
26
|
+
@program = program
|
17
27
|
@scope = scope
|
18
28
|
end
|
19
29
|
|
@@ -21,6 +31,14 @@ module HackerOne
|
|
21
31
|
@scope[:id]
|
22
32
|
end
|
23
33
|
|
34
|
+
def update(attributes:)
|
35
|
+
body = {
|
36
|
+
type: "structured-scope",
|
37
|
+
attributes: attributes
|
38
|
+
}
|
39
|
+
make_put_request("programs/#{program.id}/structured_scopes/#{id}", request_body: body)
|
40
|
+
end
|
41
|
+
|
24
42
|
private
|
25
43
|
|
26
44
|
def attributes
|
data/lib/hackerone/client.rb
CHANGED
@@ -4,10 +4,13 @@ require "faraday"
|
|
4
4
|
require "json"
|
5
5
|
require "active_support"
|
6
6
|
require "active_support/core_ext/numeric/time"
|
7
|
+
require "ostruct"
|
7
8
|
require_relative "client/version"
|
8
9
|
require_relative "client/report"
|
9
10
|
require_relative "client/activity"
|
10
11
|
require_relative "client/program"
|
12
|
+
require_relative "client/organization"
|
13
|
+
require_relative "client/asset"
|
11
14
|
require_relative "client/reporter"
|
12
15
|
require_relative "client/member"
|
13
16
|
require_relative "client/user"
|
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.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Matatall
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email:
|
113
113
|
- neil.matatall@gmail.com
|
114
114
|
executables: []
|
@@ -172,12 +172,14 @@ files:
|
|
172
172
|
- lib/hackerone/client.rb
|
173
173
|
- lib/hackerone/client/activity.rb
|
174
174
|
- lib/hackerone/client/address.rb
|
175
|
+
- lib/hackerone/client/asset.rb
|
175
176
|
- lib/hackerone/client/attachment.rb
|
176
177
|
- lib/hackerone/client/billing_balance.rb
|
177
178
|
- lib/hackerone/client/bounty.rb
|
178
179
|
- lib/hackerone/client/group.rb
|
179
180
|
- lib/hackerone/client/incremental/activities.rb
|
180
181
|
- lib/hackerone/client/member.rb
|
182
|
+
- lib/hackerone/client/organization.rb
|
181
183
|
- lib/hackerone/client/program.rb
|
182
184
|
- lib/hackerone/client/report.rb
|
183
185
|
- lib/hackerone/client/reporter.rb
|
@@ -191,7 +193,7 @@ homepage: https://github.com/github/hackerone-client
|
|
191
193
|
licenses:
|
192
194
|
- MIT
|
193
195
|
metadata: {}
|
194
|
-
post_install_message:
|
196
|
+
post_install_message:
|
195
197
|
rdoc_options: []
|
196
198
|
require_paths:
|
197
199
|
- lib
|
@@ -206,8 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
208
|
- !ruby/object:Gem::Version
|
207
209
|
version: '0'
|
208
210
|
requirements: []
|
209
|
-
rubygems_version: 3.0.
|
210
|
-
signing_key:
|
211
|
+
rubygems_version: 3.0.3.1
|
212
|
+
signing_key:
|
211
213
|
specification_version: 4
|
212
214
|
summary: A limited client for the HackerOne API
|
213
215
|
test_files: []
|