booth 0.1.0 → 0.1.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a3e8358a1e1709b852c8dffbdcc2a8054719b2e383ac5227040695fe545f86dd
|
|
4
|
+
data.tar.gz: b3dbe83a20f463048b3033c427890160f2b4f159e2b32bf2285bb5f81d7bff4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4c116542803bbd8c2c7ff0cbe053e5bcff066932f1d375628849e98dadfe26c83f6f705268ebba22d831d425f64fdf103d94ec8b06d015943fdd11542d04c08
|
|
7
|
+
data.tar.gz: 56b567aa1747e0afd048660c3e74319cdf4ff66b198b72a486dc6ea6c0f8b873a0a59f4a08d00ba678248cf198c06f3166ad2c1376805039a266dfc12e8fff82
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# main
|
|
2
2
|
|
|
3
|
+
# 0.1.2
|
|
4
|
+
|
|
5
|
+
- Idempodent impersonation (now respecting unique DB constraints)
|
|
6
|
+
|
|
7
|
+
# 0.1.1
|
|
8
|
+
|
|
9
|
+
- Replace `Booth::Adminland.issue_incognito_token` with `generate_incognito_secret_key`
|
|
10
|
+
|
|
3
11
|
# 0.0.10
|
|
4
12
|
|
|
5
13
|
- Schema: add `booth_sessions.incognito_secret_key` (string, unique) and `booth_sessions.impersonator_session_id` (uuid, FK to self)
|
|
@@ -14,6 +14,7 @@ module Booth
|
|
|
14
14
|
def call
|
|
15
15
|
do_check_impersonator_logged_in
|
|
16
16
|
.on_success { do_find_target_credential }
|
|
17
|
+
.on_success { do_revoke_existing_incognito }
|
|
17
18
|
.on_success { do_create_session }
|
|
18
19
|
.on_success { do_audit }
|
|
19
20
|
.on_success { do_return_key }
|
|
@@ -42,6 +43,24 @@ module Booth
|
|
|
42
43
|
Tron.success :target_credential_found
|
|
43
44
|
end
|
|
44
45
|
|
|
46
|
+
# incognito_credential_id has a unique index (only one session per impersonator).
|
|
47
|
+
# Clear the stale reference on any prior session before creating a new one.
|
|
48
|
+
def do_revoke_existing_incognito
|
|
49
|
+
existing = ::Booth::Models::Session.find_by(
|
|
50
|
+
incognito_credential_id: impersonator_credential_id,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return Tron.success(:no_existing_incognito) unless existing
|
|
54
|
+
|
|
55
|
+
log { "Revoking existing incognito session ##{existing.id}" }
|
|
56
|
+
existing.update!(
|
|
57
|
+
incognito_credential_id: nil,
|
|
58
|
+
revoked_at: Time.current,
|
|
59
|
+
revoke_reason: :incognito_replaced,
|
|
60
|
+
)
|
|
61
|
+
Tron.success :existing_incognito_revoked
|
|
62
|
+
end
|
|
63
|
+
|
|
45
64
|
def do_create_session
|
|
46
65
|
self.secret_key = SecureRandom.hex(32)
|
|
47
66
|
|
|
@@ -55,7 +55,11 @@ module Booth
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def do_revoke_incognito
|
|
58
|
-
current_session.update!(
|
|
58
|
+
current_session.update!(
|
|
59
|
+
revoked_at: Time.current,
|
|
60
|
+
revoke_reason: :incognito_stopped,
|
|
61
|
+
incognito_credential_id: nil,
|
|
62
|
+
)
|
|
59
63
|
Tron.success :incognito_revoked
|
|
60
64
|
end
|
|
61
65
|
|
data/lib/booth/version.rb
CHANGED