datadome_module 1.1.0 → 1.1.1

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: ddcdafc8d1dc67d5820375afd61d2c14492245b14df2d52537176ed7baa7c52c
4
- data.tar.gz: d657d8a0738e8ba53f5b3a34a57794a0827357ae1061fe72f2295e10895ab7d9
3
+ metadata.gz: 5ddfcfecfd9f51f333f9e40f60c5bff1f68d6fa1c0f23e4cf25f7f75bc3ed87b
4
+ data.tar.gz: 1bfa3743ddd6c69b0eab8f9421e60f32d2da1709410760847c163d2e324bd7ee
5
5
  SHA512:
6
- metadata.gz: d973f4d93db659e56d72896712a9bfddfcbaff2b0c4df1c70117d5b15d6e57ccfa6625e890899f0a7d8022692f1a0afd5e0502652ac152e4c4d503822294526f
7
- data.tar.gz: 8b7ca8e955384b9e335d251c2fe9a8f301f5a241f30843a67407c573a03642aa05d2fce840ace443ecd4501ee69992109d15e290cba976a4d23080a21dbe62c9
6
+ metadata.gz: 9d694c9960ff4b9969adfa20360699d85d4bb24592bdaa8db8c360b1c1304707da1a55025b76852dde20d483a2d950e664e64ad0a4e5e80d26f221776a82d316
7
+ data.tar.gz: 7b956519b3558cc669d4e60068788e200d86049c26ad6f38f8740316c5198b27e1039eb26484fb123d3dac64cccf3b697c6395edfce3aacb939a007be873544c
data/lib/constants.rb CHANGED
@@ -1,4 +1,4 @@
1
- MODULE_VERSION = '1.1.0'
1
+ MODULE_VERSION = '1.1.1'
2
2
  MODULE_NAME = 'datadome_module'
3
3
 
4
4
  VALIDATE_REQUEST_PATH = '/validate-request'
@@ -24,7 +24,24 @@ class DataDomeModule
24
24
  return assessment_result.response_array unless assessment_result.legitimate_request?
25
25
 
26
26
  status, headers, payload = @app.call(env)
27
- headers = headers.merge(assessment_result.headers)
27
+
28
+ # Merge the headers from DataDome with the original headers
29
+ headers = headers.merge(assessment_result.headers) do |key, request_header_val, datadome_header_val|
30
+ if key.downcase == "set-cookie" && request_header_val
31
+ # Handle the merge for cookies when the protected request has at least one cookie
32
+ # If the original request contains one cookie, ensure it's in an array format for uniform handling
33
+ request_header_val = [request_header_val] unless request_header_val.is_a?(Array)
34
+
35
+ # Remove any cookies that start with 'datadome=' from the original request's cookies
36
+ request_header_val.reject! { |cookie| cookie.downcase.start_with?("datadome=") }
37
+
38
+ # Return the cookies merged with the new value of the datadome cookie
39
+ [datadome_header_val, *request_header_val]
40
+ else
41
+ # For DataDome headers other than 'Set-Cookie', return the value.
42
+ datadome_header_val
43
+ end
44
+ end
28
45
 
29
46
  [status, headers, payload]
30
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadome_module
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DataDome
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-24 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday