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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c18943a93c4707c1d5c8aa2b92925ac997fbd98fc08f9c4c58f9eb485c98f02
4
- data.tar.gz: e38d8c87ca688037a860a3b4af69d54f255f575d6cd3d5ca8b31e8bb0ff1639b
3
+ metadata.gz: 40a7fc87817d5d47fd6ec90066a0f383436cb25f3f50ee835c0372c2a7f895e2
4
+ data.tar.gz: c5a89ddd87c4cc14191d9c69a16c3a0a91790ef8cbc513e35635b30f4a0a2c93
5
5
  SHA512:
6
- metadata.gz: 1f9eead24427fed2fac91181599f75a87a5389b913b5a9a6042b4ebcfb27ffa7af213f76127182d7d05078bde22cbf3e431f414b86ca27ef8490175e761da60c
7
- data.tar.gz: f2a10234aea2f2402da52686c9500e2591d852d9757d267032fda58366650aead11b621eb4d0681819acfdfebd3c0d6010329e60758644dbada17f4106c6654b
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] = filter_pairs(cookie, cookie_obfuscator)
231
+ headers[COOKIE] = obfuscate_cookie(cookie, cookie_obfuscator)
232
232
  end
233
233
 
234
234
  headers.keys.each do |k|
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.38.3"
2
+ VERSION = "0.38.4"
3
3
  end
@@ -5,24 +5,23 @@ module LogjamAgent
5
5
  include Obfuscation
6
6
 
7
7
  test "obfuscates session cookie by default" do
8
- filter = LogjamAgent.cookie_obfuscator
9
- assert_equal "_session=[FILTERED]", filter_pairs("_session=data", filter)
10
- assert_equal "my_session=[FILTERED]", filter_pairs("my_session=mdata", filter)
11
- assert_equal "blabber=1; _session=[FILTERED]", filter_pairs("blabber=1; _session=data", filter)
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]", filter_pairs("_session=my_session; login=foo", filter)
18
- assert_equal "_session=[FILTERED]; my_login=[FILTERED]", filter_pairs("_session=my_session; my_login=foo", filter)
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]", filter_pairs("_session=my_session; login=foo", filter)
24
- assert_equal "_session=[FILTERED]; my_login=foo", filter_pairs("_session=my_session; my_login=foo", filter)
25
- assert_equal "my_session=[FILTERED]; my_login=foo", filter_pairs("my_session=my_session; my_login=foo", filter)
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.3
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-20 00:00:00.000000000 Z
11
+ date: 2023-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport