logjam_agent 0.38.3 → 0.38.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logjam_agent/obfuscation.rb +4 -0
- data/lib/logjam_agent/rack/logger.rb +1 -1
- data/lib/logjam_agent/version.rb +1 -1
- data/test/obfuscator_test.rb +9 -10
- 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: 40a7fc87817d5d47fd6ec90066a0f383436cb25f3f50ee835c0372c2a7f895e2
|
4
|
+
data.tar.gz: c5a89ddd87c4cc14191d9c69a16c3a0a91790ef8cbc513e35635b30f4a0a2c93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 239cf4fda9b20bf22e65d5d7454f642f453cf34b4e5f4adcade67d7dae2233d6e596c35f70fbd9a9f4c68cf4f2e847a80a7f310002719d5f9a9852633f8cfe95
|
7
|
+
data.tar.gz: d376a763eee26ec914c930afeb9379119c2f4a6b03e28aa45d1ff8110f5119f4974dc899054f952d647141db84f70e37620312ef29887b00ea3eb2bffe284723
|
@@ -16,6 +16,10 @@ module LogjamAgent
|
|
16
16
|
@cookie_obfuscator ||= ParameterFilter.new(obfuscated_cookies)
|
17
17
|
end
|
18
18
|
|
19
|
+
def obfuscate_cookie(cookie, filter = cookie_obfuscator)
|
20
|
+
filter_pairs(cookie, filter)
|
21
|
+
end
|
22
|
+
|
19
23
|
begin
|
20
24
|
# rails 6.1 and higher
|
21
25
|
require "active_support/parameter_filter"
|
@@ -228,7 +228,7 @@ module LogjamAgent
|
|
228
228
|
end
|
229
229
|
|
230
230
|
if (cookie = headers[COOKIE]) && obfuscated_cookies.present?
|
231
|
-
headers[COOKIE] =
|
231
|
+
headers[COOKIE] = obfuscate_cookie(cookie, cookie_obfuscator)
|
232
232
|
end
|
233
233
|
|
234
234
|
headers.keys.each do |k|
|
data/lib/logjam_agent/version.rb
CHANGED
data/test/obfuscator_test.rb
CHANGED
@@ -5,24 +5,23 @@ module LogjamAgent
|
|
5
5
|
include Obfuscation
|
6
6
|
|
7
7
|
test "obfuscates session cookie by default" do
|
8
|
-
|
9
|
-
assert_equal "
|
10
|
-
assert_equal "
|
11
|
-
assert_equal "blabber=1; _session=[FILTERED]",
|
12
|
-
assert_equal "blabber=1; _session=[FILTERED]; blubber=2", filter_pairs("blabber=1; _session=data; blubber=2", filter)
|
8
|
+
assert_equal "_session=[FILTERED]", obfuscate_cookie("_session=data")
|
9
|
+
assert_equal "my_session=[FILTERED]", obfuscate_cookie("my_session=mdata")
|
10
|
+
assert_equal "blabber=1; _session=[FILTERED]", obfuscate_cookie("blabber=1; _session=data")
|
11
|
+
assert_equal "blabber=1; _session=[FILTERED]; blubber=2", obfuscate_cookie("blabber=1; _session=data; blubber=2")
|
13
12
|
end
|
14
13
|
|
15
14
|
test "obfuscates with complex regex" do
|
16
15
|
filter = ParameterFilter.new([/(login|_session)\z/])
|
17
|
-
assert_equal "_session=[FILTERED]; login=[FILTERED]",
|
18
|
-
assert_equal "_session=[FILTERED]; my_login=[FILTERED]",
|
16
|
+
assert_equal "_session=[FILTERED]; login=[FILTERED]", obfuscate_cookie("_session=my_session; login=foo", filter)
|
17
|
+
assert_equal "_session=[FILTERED]; my_login=[FILTERED]", obfuscate_cookie("_session=my_session; my_login=foo", filter)
|
19
18
|
end
|
20
19
|
|
21
20
|
test "obfuscates with exact matches" do
|
22
21
|
filter = ParameterFilter.new([/\A(login|.*_session)\z/])
|
23
|
-
assert_equal "_session=[FILTERED]; login=[FILTERED]",
|
24
|
-
assert_equal "_session=[FILTERED]; my_login=foo",
|
25
|
-
assert_equal "my_session=[FILTERED]; my_login=foo",
|
22
|
+
assert_equal "_session=[FILTERED]; login=[FILTERED]", obfuscate_cookie("_session=my_session; login=foo", filter)
|
23
|
+
assert_equal "_session=[FILTERED]; my_login=foo", obfuscate_cookie("_session=my_session; my_login=foo", filter)
|
24
|
+
assert_equal "my_session=[FILTERED]; my_login=foo", obfuscate_cookie("my_session=my_session; my_login=foo", filter)
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logjam_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.38.
|
4
|
+
version: 0.38.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|