datadome_module 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/constants.rb +1 -1
- data/lib/datadome_module.rb +18 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ddfcfecfd9f51f333f9e40f60c5bff1f68d6fa1c0f23e4cf25f7f75bc3ed87b
|
4
|
+
data.tar.gz: 1bfa3743ddd6c69b0eab8f9421e60f32d2da1709410760847c163d2e324bd7ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d694c9960ff4b9969adfa20360699d85d4bb24592bdaa8db8c360b1c1304707da1a55025b76852dde20d483a2d950e664e64ad0a4e5e80d26f221776a82d316
|
7
|
+
data.tar.gz: 7b956519b3558cc669d4e60068788e200d86049c26ad6f38f8740316c5198b27e1039eb26484fb123d3dac64cccf3b697c6395edfce3aacb939a007be873544c
|
data/lib/constants.rb
CHANGED
data/lib/datadome_module.rb
CHANGED
@@ -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
|
-
|
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,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datadome_module
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
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-
|
11
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
description: Used to assess requests with DataDome Protection API.
|
28
28
|
email: support@datadome.co
|
29
29
|
executables: []
|