blipit 0.1.0 → 0.1.1
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 +1 -1
- data/lib/blipit/version.rb +1 -1
- data/lib/blipit.rb +9 -0
- 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: 725f1f7935b92f07ead1f9c8dc944077671d90708857ad933b56f3f99898803e
|
|
4
|
+
data.tar.gz: 30cc8ca3193055b99770d4ec0120baa128b3b10ee30c4a379cec1a6ab8cc176f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6808a51c08d76b523c739fdba9b5ed1539ea4a2638daa18a9e4f35c4142ca454d4f8140f5dabeab73f084247107465eaac95b48fb31f7db2b409927aede1533
|
|
7
|
+
data.tar.gz: 316d73b300b658fb392e2af61049fadc48acc6f593dbbed58490019c03d5d48d4ec83358d766bb5a07337a96d2f3100f6ea1c7251e745a2b951b1df3613aa5a9
|
data/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Blipit.add_breadcrumb("cache cleared", category: "cache")
|
|
|
42
42
|
Blipit.capture_security("login_failed", email, outcome: "wrong password", ip: request.remote_ip, user_agent: request.user_agent)
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
`kind` is one of `login_failed`, `login_blocked`, `login_succeeded`, `
|
|
45
|
+
`kind` is one of `login_failed`, `login_blocked`, `login_succeeded`, `password_reset_requested` or `privilege_granted`; any other kind arrives as a plain message. Login attempts need the project's secret key (init with it on the server) and the Scale plan; with the public key ingest refuses them with 403 `security_needs_secret_key`.
|
|
46
46
|
|
|
47
47
|
## Performance
|
|
48
48
|
|
data/lib/blipit/version.rb
CHANGED
data/lib/blipit.rb
CHANGED
|
@@ -4,6 +4,9 @@ require_relative "blipit/version"
|
|
|
4
4
|
module Blipit
|
|
5
5
|
DEFAULT_ENDPOINT = "https://in.blipit.io"
|
|
6
6
|
WARNING_KINDS = %w[login_failed login_blocked].freeze
|
|
7
|
+
PUBLIC_KEY_WARNING = "[blipit] login attempts need the project's secret key (blipit_sk_...). " \
|
|
8
|
+
"This SDK was started with the public key, so capture_security sends nothing. " \
|
|
9
|
+
"Use the secret key on the server."
|
|
7
10
|
|
|
8
11
|
class << self
|
|
9
12
|
def dsn(key, project, endpoint = DEFAULT_ENDPOINT)
|
|
@@ -14,6 +17,7 @@ module Blipit
|
|
|
14
17
|
|
|
15
18
|
def init(key:, project:, environment: nil, release: nil, traces_sample_rate: 0.0, endpoint: DEFAULT_ENDPOINT, **options)
|
|
16
19
|
raise ArgumentError, "Blipit.init needs the project's public key" if key.nil? || key.to_s.empty?
|
|
20
|
+
@public_key = key.to_s.start_with?("blipit_pk_")
|
|
17
21
|
raise ArgumentError, "Blipit.init needs the project id" if project.nil? || project.to_s.empty?
|
|
18
22
|
|
|
19
23
|
Sentry.init do |config|
|
|
@@ -48,6 +52,11 @@ module Blipit
|
|
|
48
52
|
end
|
|
49
53
|
|
|
50
54
|
def capture_security(kind, actor, outcome: nil, actor_id: nil, ip: nil, user_agent: nil, target: nil)
|
|
55
|
+
if @public_key
|
|
56
|
+
warn(PUBLIC_KEY_WARNING) unless @public_key_warned
|
|
57
|
+
@public_key_warned = true
|
|
58
|
+
return
|
|
59
|
+
end
|
|
51
60
|
payload = {
|
|
52
61
|
kind: kind,
|
|
53
62
|
actor: actor,
|