loggable_activity 0.1.46 → 0.1.47
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 +9 -1
- data/GETTING-STARTED.md +6 -0
- data/README.md +2 -0
- data/lib/loggable_activity/activity.rb +2 -0
- data/lib/loggable_activity/encryption.rb +1 -1
- data/lib/loggable_activity/encryption_key.rb +3 -3
- data/lib/loggable_activity/version.rb +1 -1
- 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: 769f6634b248e3b70df41eb296770debee95b28e4e80f16f5c1b548f594dfde2
|
4
|
+
data.tar.gz: 9edc8cbb35e16e0738e747ddb3cd8b953929a3cb4524ea623d118fed8bf38022
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd00a44dff499dd739c210a6d15ebf30b8a281f6f20006922f39cb0411f939be982abd1b4c82bc39257237ea804422b358f5ba2b63a9d7531a0a3164fdf37240
|
7
|
+
data.tar.gz: 0f2e77814f90963fb65c322cc28e3be34faf62d079e7c7bfce98d80700d5a6c31fea40761e1ee62e85e2e0ae7b16852e1ff822374d684cdc029460a62ee2c82f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
- nothing so far
|
3
|
+
|
4
|
+
## [0.1.47] - 2024-02-16
|
5
|
+
### Breaking change
|
6
|
+
- Updated encryption_key to be 32 bytes
|
7
|
+
- Updated README.md
|
8
|
+
- Updated GETTING_STARTED.md
|
9
|
+
- Added PULL_REQUEST_TEMPLATE.md
|
10
|
+
## [0.1.46] - 2024-02-16
|
11
|
+
- Fixed spelling error in EncryptionKey
|
3
12
|
## [0.1.43] - 2024-02-15
|
4
13
|
- Updated README.md and GETTING-STARTED.md
|
5
14
|
## [0.1.39] - 2024-02-12
|
@@ -7,6 +16,5 @@
|
|
7
16
|
## [0.1.38] - 2024-02-12
|
8
17
|
- Removed dependency on awesome print
|
9
18
|
## [0.1.35] - 2024-02-11
|
10
|
-
|
11
19
|
- Initial release
|
12
20
|
|
data/GETTING-STARTED.md
CHANGED
@@ -78,3 +78,9 @@ Then an `LoggableActivity::Activity` is created. You can inspect it from the ter
|
|
78
78
|
puts activity = Loggable::Activity.last
|
79
79
|
puts activity.attrs
|
80
80
|
```
|
81
|
+
|
82
|
+
## For developers
|
83
|
+
If you want to contribute to the development and try it out in the process
|
84
|
+
- 1 Down the demo project from [demo project on github](https://github.com/maxgronlund/LoggableActivityDemoApp)
|
85
|
+
- 2 Update the Gemfile in the demo project so it points to your localhost.
|
86
|
+
- 3 you can now build and test you version of the gem `$ gem build loggable_activity.gemspec`
|
data/README.md
CHANGED
@@ -5,6 +5,8 @@ Secure protect data and log how it is handled
|
|
5
5
|
- Prepare for General Data Protection Regulation (GDPR) compliance.
|
6
6
|
- Handles activities that involves more than one table in the DB.
|
7
7
|
|
8
|
+
### Important!
|
9
|
+
This project is under development and not ready for production. There might be breaking changes, so please consult the CHANGELOG.md
|
8
10
|
### What it is not
|
9
11
|
- An error logging system
|
10
12
|
- A paper trails system with rollback.
|
@@ -260,11 +260,13 @@ module LoggableActivity
|
|
260
260
|
|
261
261
|
def record_key
|
262
262
|
return nil if record.nil?
|
263
|
+
|
263
264
|
LoggableActivity::EncryptionKey.for_record(record)&.key
|
264
265
|
end
|
265
266
|
|
266
267
|
def actor_key
|
267
268
|
return nil if actor.nil?
|
269
|
+
|
268
270
|
LoggableActivity::EncryptionKey.for_record(actor)&.key
|
269
271
|
end
|
270
272
|
|
@@ -41,7 +41,7 @@ module LoggableActivity
|
|
41
41
|
# "my secret data"
|
42
42
|
#
|
43
43
|
def self.decrypt(data, encryption_key)
|
44
|
-
return
|
44
|
+
return '' if data.nil?
|
45
45
|
return I18n.t('loggable.activity.deleted') if encryption_key.nil?
|
46
46
|
|
47
47
|
cipher = OpenSSL::Cipher.new('AES-128-CBC').decrypt
|
@@ -9,7 +9,7 @@ module LoggableActivity
|
|
9
9
|
# Associations
|
10
10
|
belongs_to :record, polymorphic: true, optional: true
|
11
11
|
belongs_to :parent_key, class_name: 'LoggableActivity::EncryptionKey', optional: true,
|
12
|
-
|
12
|
+
foreign_key: 'parent_key_id'
|
13
13
|
|
14
14
|
# Marks the encryption key as deleted by updating the key to nil.
|
15
15
|
def mark_as_deleted
|
@@ -90,7 +90,7 @@ module LoggableActivity
|
|
90
90
|
#
|
91
91
|
def self.create_encryption_key(record_type, record_id, parent_key = nil)
|
92
92
|
if parent_key
|
93
|
-
create(record_type:, record_id:, key: random_key, parent_key:
|
93
|
+
create(record_type:, record_id:, key: random_key, parent_key:)
|
94
94
|
else
|
95
95
|
create(record_type:, record_id:, key: random_key)
|
96
96
|
end
|
@@ -107,7 +107,7 @@ module LoggableActivity
|
|
107
107
|
# "a8f4774e7f42eb253045a4db7de7b79e"
|
108
108
|
#
|
109
109
|
def self.random_key
|
110
|
-
SecureRandom.hex(
|
110
|
+
SecureRandom.hex(32)
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|