fingerly 0.1.0 → 0.2.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/README.md +11 -3
- data/lib/fingerly/client.rb +6 -1
- data/lib/fingerly/models.rb +12 -11
- data/lib/fingerly/version.rb +1 -1
- data/sig/fingerly.rbs +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2259bc6d79895434264b410f747d6061e08a2593ddcdbe38c87dc7e4ace8f813
|
|
4
|
+
data.tar.gz: e66d6a3ecf9ef426b41bcdf14caee81d16987531a46f00daae9f4079398ac795
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 693a750304fe02ff1347a1095162cfec457d02f70d80ade14a4e89cfa2d8fc6542e15e9f892b26b8fd9b0c80bbe62e9c07abb7361037e8681ea30289311f43b3
|
|
7
|
+
data.tar.gz: b87b732144d0e575e9fc77628115159f851cdbb900226514f2654488bb1d761299d62426fecc4142d8230207435a7d386442301d259e53d57b2c3e006eade5d2
|
data/README.md
CHANGED
|
@@ -147,6 +147,10 @@ end
|
|
|
147
147
|
`event.raw` keeps the response body exactly as it arrived, so a field the API
|
|
148
148
|
adds later is reachable without a gem upgrade.
|
|
149
149
|
|
|
150
|
+
`event.project_id` is the UUID string of the Fingerly project the event
|
|
151
|
+
belongs to, on both `events.get` and `events.list` rows; it is `nil` when an
|
|
152
|
+
older server does not send it.
|
|
153
|
+
|
|
150
154
|
## Read an event you just identified
|
|
151
155
|
|
|
152
156
|
An event is usually readable as soon as identification answers. If it is
|
|
@@ -181,7 +185,9 @@ Apply your own policy to the server's verdict. A pending event (`pending?`)
|
|
|
181
185
|
is not a verdict: retry after `retry_after` seconds or verify asynchronously,
|
|
182
186
|
rather than refusing the action. Do not authorize an action using scores or
|
|
183
187
|
visitor identifiers supplied by the browser. Tags correlate events; they do
|
|
184
|
-
not replace your application's authentication or replay protection.
|
|
188
|
+
not replace your application's authentication or replay protection. A tag must
|
|
189
|
+
never hold a personal identifier, such as a user ID, email, install ID or
|
|
190
|
+
advertising ID, because the server keeps tags in long-lived rollups.
|
|
185
191
|
|
|
186
192
|
## Webhooks
|
|
187
193
|
|
|
@@ -221,7 +227,9 @@ Malformed or missing input is a false result, never an exception, and a body
|
|
|
221
227
|
that is not valid UTF-8 verifies rather than raising on concatenation.
|
|
222
228
|
|
|
223
229
|
`WebhookEvent#data` stays a plain `Hash`, so a new event type needs no gem
|
|
224
|
-
upgrade.
|
|
230
|
+
upgrade. `identification.completed` and `visitor.suspect` deliveries carry the
|
|
231
|
+
event's project as `data["project_id"]`; `identification.refused` carries it
|
|
232
|
+
only when the refused request named a known key.
|
|
225
233
|
|
|
226
234
|
## Same-origin proxy
|
|
227
235
|
|
|
@@ -317,7 +325,7 @@ the server's or the load balancer's own limit as well. Falcon streams the body,
|
|
|
317
325
|
so there the proxy stops reading at the limit. Only the content type, the
|
|
318
326
|
visitor metadata Fingerly needs, and an `Idempotency-Key` are forwarded;
|
|
319
327
|
customer cookies and authorization headers never are. The proxy reports itself
|
|
320
|
-
upstream as `ruby/0.
|
|
328
|
+
upstream as `ruby/0.2.0` in `x-fingerly-proxy-version`, which the dashboard
|
|
321
329
|
shows per proxy.
|
|
322
330
|
|
|
323
331
|
When Fingerly cannot be reached, the visitor gets a gateway error rather than
|
data/lib/fingerly/client.rb
CHANGED
|
@@ -187,7 +187,12 @@ module Fingerly
|
|
|
187
187
|
# past retention.
|
|
188
188
|
# @raise [TimeoutError] if the request exceeds the client timeout
|
|
189
189
|
def get(request_id)
|
|
190
|
-
|
|
190
|
+
# URL parsers resolve a dot segment even when it is percent-encoded, so
|
|
191
|
+
# escaping cannot keep these in the path: "." and the empty id would name
|
|
192
|
+
# the list route, and ".." a route above it, secret key attached.
|
|
193
|
+
if ["", ".", ".."].include?(request_id.to_s)
|
|
194
|
+
raise ConfigurationError, "request_id is not a Fingerly request id"
|
|
195
|
+
end
|
|
191
196
|
|
|
192
197
|
Event.new(@client.get("/events/#{Events.escape(request_id)}"))
|
|
193
198
|
end
|
data/lib/fingerly/models.rb
CHANGED
|
@@ -33,12 +33,14 @@ module Fingerly
|
|
|
33
33
|
# the distinction at the call site.
|
|
34
34
|
class Event
|
|
35
35
|
# Fields copied straight from the response, in the order the API documents
|
|
36
|
-
# them. Anything not listed stays reachable through {#raw}.
|
|
36
|
+
# them. Anything not listed stays reachable through {#raw}. +project_id+
|
|
37
|
+
# is the UUID string of the Fingerly project the event belongs to, and nil
|
|
38
|
+
# when an older server does not send it.
|
|
37
39
|
STRING_FIELDS = %w[
|
|
38
|
-
request_id visitor_id state environment platform sdk_platform
|
|
39
|
-
origin url_host url_path tag
|
|
40
|
-
asn_name anonymity_network agent agent_version os
|
|
41
|
-
suspect_level
|
|
40
|
+
request_id project_id visitor_id state environment platform sdk_platform
|
|
41
|
+
sdk_version origin url_host url_path tag ip_network country_code
|
|
42
|
+
country_name asn asn_name anonymity_network agent agent_version os
|
|
43
|
+
device_kind visitor_kind suspect_level
|
|
42
44
|
].freeze
|
|
43
45
|
|
|
44
46
|
STRING_FIELDS.each { |name| attr_reader name.to_sym }
|
|
@@ -50,12 +52,12 @@ module Fingerly
|
|
|
50
52
|
# @return [Array<EventTrigger>] the signal groups behind the score; never
|
|
51
53
|
# nil, and empty when nothing fired
|
|
52
54
|
attr_reader :triggers
|
|
53
|
-
# @return [Hash, nil] the archived
|
|
54
|
-
#
|
|
55
|
+
# @return [Hash, nil] an allow-listed view of the archived request, when
|
|
56
|
+
# one was kept: schema, request id, time, SDK, network, IP
|
|
57
|
+
# classification and city-level location, risk, attestation and
|
|
58
|
+
# velocity. It holds no raw signals, user agent or address, and its
|
|
59
|
+
# contents are not a public contract.
|
|
55
60
|
attr_reader :document
|
|
56
|
-
# @return [Hash, nil] the deferred report attached to this request, when
|
|
57
|
-
# one arrived. Also opaque.
|
|
58
|
-
attr_reader :deferred_signals
|
|
59
61
|
# @return [Hash] the response body exactly as it arrived, so a field the
|
|
60
62
|
# API adds after this SDK was released needs no upgrade
|
|
61
63
|
attr_reader :raw
|
|
@@ -68,7 +70,6 @@ module Fingerly
|
|
|
68
70
|
@has_document = payload["has_document"] ? true : false
|
|
69
71
|
@triggers = Array(payload["triggers"]).map { |item| EventTrigger.new(item) }.freeze
|
|
70
72
|
@document = payload["document"]
|
|
71
|
-
@deferred_signals = payload["deferred_signals"]
|
|
72
73
|
@raw = payload
|
|
73
74
|
freeze
|
|
74
75
|
end
|
data/lib/fingerly/version.rb
CHANGED
data/sig/fingerly.rbs
CHANGED
|
@@ -50,6 +50,7 @@ module Fingerly
|
|
|
50
50
|
STRING_FIELDS: Array[String]
|
|
51
51
|
|
|
52
52
|
attr_reader request_id: String?
|
|
53
|
+
attr_reader project_id: String?
|
|
53
54
|
attr_reader visitor_id: String?
|
|
54
55
|
attr_reader state: String?
|
|
55
56
|
attr_reader environment: String?
|
|
@@ -60,7 +61,7 @@ module Fingerly
|
|
|
60
61
|
attr_reader url_host: String?
|
|
61
62
|
attr_reader url_path: String?
|
|
62
63
|
attr_reader tag: String?
|
|
63
|
-
attr_reader
|
|
64
|
+
attr_reader ip_network: String?
|
|
64
65
|
attr_reader country_code: String?
|
|
65
66
|
attr_reader country_name: String?
|
|
66
67
|
attr_reader asn: String?
|
|
@@ -77,7 +78,6 @@ module Fingerly
|
|
|
77
78
|
attr_reader suspect_score: Integer?
|
|
78
79
|
attr_reader triggers: Array[EventTrigger]
|
|
79
80
|
attr_reader document: Hash[String, untyped]?
|
|
80
|
-
attr_reader deferred_signals: Hash[String, untyped]?
|
|
81
81
|
attr_reader raw: Hash[String, untyped]
|
|
82
82
|
|
|
83
83
|
def initialize: (Hash[String, untyped]) -> void
|