console1984 0.1.24 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/protections.yml +1 -0
- data/db/migrate/20210517203931_create_console1984_tables.rb +2 -2
- data/lib/console1984/sessions_logger/database.rb +14 -7
- data/lib/console1984/shield.rb +1 -1
- data/lib/console1984/username/env_resolver.rb +1 -1
- data/lib/console1984/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae616ba0dfd26e12332979ccfc257574e793b642eac5200dc8843bddef9ea93b
|
4
|
+
data.tar.gz: 0053d020cc2fbabf8a23abea84a782b1ccb56259d0d5311f14c3df6213c4a1cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd28b4796bc61df05d5181c290369dd2dceb1e39a69800e8ff8a102d0c766a09d769ebfa3ac007aaada02182432db20cf4b15dbc3a460d698cbb7724b432a1a4
|
7
|
+
data.tar.gz: 2915547dca0d396e2186998c337c5af983447992b637f80803e99c25f917bdf55794c9b635f4616f6150aa8b3c6dcea2e591df5b2099886811683ef8d4192425
|
data/config/protections.yml
CHANGED
@@ -2,7 +2,7 @@ class CreateConsole1984Tables < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :console1984_sessions do |t|
|
4
4
|
t.text :reason
|
5
|
-
t.references :user, null: false
|
5
|
+
t.references :user, null: false, index: false
|
6
6
|
t.timestamps
|
7
7
|
|
8
8
|
t.index :created_at
|
@@ -19,7 +19,7 @@ class CreateConsole1984Tables < ActiveRecord::Migration[7.0]
|
|
19
19
|
create_table :console1984_commands do |t|
|
20
20
|
t.text :statements
|
21
21
|
t.references :sensitive_access
|
22
|
-
t.references :session, null: false
|
22
|
+
t.references :session, null: false, index: false
|
23
23
|
t.timestamps
|
24
24
|
|
25
25
|
t.index [ :session_id, :created_at, :sensitive_access_id ], name: "on_session_and_sensitive_chronologically"
|
@@ -5,7 +5,7 @@ class Console1984::SessionsLogger::Database
|
|
5
5
|
attr_reader :current_session, :current_sensitive_access
|
6
6
|
|
7
7
|
def start_session(username, reason)
|
8
|
-
|
8
|
+
silence_logging_and_ensure_connected do
|
9
9
|
user = Console1984::User.find_or_create_by!(username: username)
|
10
10
|
@current_session = user.sessions.create!(reason: reason)
|
11
11
|
end
|
@@ -17,7 +17,7 @@ class Console1984::SessionsLogger::Database
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def start_sensitive_access(justification)
|
20
|
-
|
20
|
+
silence_logging_and_ensure_connected do
|
21
21
|
@current_sensitive_access = current_session.sensitive_accesses.create! justification: justification
|
22
22
|
end
|
23
23
|
end
|
@@ -27,7 +27,7 @@ class Console1984::SessionsLogger::Database
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def before_executing(statements)
|
30
|
-
|
30
|
+
silence_logging_and_ensure_connected do
|
31
31
|
@before_commands_count = @current_session.commands.count
|
32
32
|
record_statements statements
|
33
33
|
end
|
@@ -37,7 +37,7 @@ class Console1984::SessionsLogger::Database
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def suspicious_commands_attempted(statements)
|
40
|
-
|
40
|
+
silence_logging_and_ensure_connected do
|
41
41
|
sensitive_access = start_sensitive_access "Suspicious commands attempted"
|
42
42
|
Console1984::Command.last.update! sensitive_access: sensitive_access
|
43
43
|
end
|
@@ -48,13 +48,20 @@ class Console1984::SessionsLogger::Database
|
|
48
48
|
@current_session.commands.create! statements: Array(statements).join("\n"), sensitive_access: current_sensitive_access
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def silence_logging_and_ensure_connected(&block)
|
52
52
|
if Console1984.debug
|
53
|
-
block
|
53
|
+
ensure_connected(&block)
|
54
54
|
else
|
55
55
|
Console1984::IncinerationJob.logger.silence do
|
56
|
-
Console1984::Base.logger.silence
|
56
|
+
Console1984::Base.logger.silence do
|
57
|
+
ensure_connected(&block)
|
58
|
+
end
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
62
|
+
|
63
|
+
def ensure_connected(&block)
|
64
|
+
Console1984::Command.connection.reconnect! unless Console1984::Command.connection.active?
|
65
|
+
block.call
|
66
|
+
end
|
60
67
|
end
|
data/lib/console1984/shield.rb
CHANGED
data/lib/console1984/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: console1984
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge Manrubia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|