stytch 11.1.2 → 11.1.3
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/lib/stytch/request_helper.rb +23 -0
- data/lib/stytch/version.rb +1 -1
- 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: 64c38f162d9c6b913d4cfebaebf9c3f4921f35cc3fed461fca5e21aee6d38f43
|
|
4
|
+
data.tar.gz: d7efc2b419b61ae252c65992e5b83d4bd915fc511ae08e4d8f090e4ec16fe0f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dcd3ae4d3523ac904d3a3969e286eb68175234f90df1ea4eab5af392e406a70713df3209e64fdeb4955e558733360b3a937279356e5f9251c3326f3ebd0c662c
|
|
7
|
+
data.tar.gz: a2f7a035120e93a76d0f039859db57df6e5070e4df3526520ee6942ce3e620a789af708cb76980b79f1d55417c50ed0d9f4a925eebf9ffb1a7d0a7f06d040ed8
|
|
@@ -5,6 +5,7 @@ require 'uri'
|
|
|
5
5
|
module Stytch
|
|
6
6
|
module RequestHelper
|
|
7
7
|
def get_request(path, headers)
|
|
8
|
+
validate_path!(path)
|
|
8
9
|
@connection.get(
|
|
9
10
|
path,
|
|
10
11
|
nil,
|
|
@@ -13,6 +14,7 @@ module Stytch
|
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def post_request(path, payload, headers)
|
|
17
|
+
validate_path!(path, query: false)
|
|
16
18
|
@connection.post(
|
|
17
19
|
path,
|
|
18
20
|
payload,
|
|
@@ -21,6 +23,7 @@ module Stytch
|
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def put_request(path, payload, headers)
|
|
26
|
+
validate_path!(path, query: false)
|
|
24
27
|
@connection.put(
|
|
25
28
|
path,
|
|
26
29
|
payload,
|
|
@@ -29,6 +32,7 @@ module Stytch
|
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
def delete_request(path, headers)
|
|
35
|
+
validate_path!(path, query: false)
|
|
32
36
|
@connection.delete(
|
|
33
37
|
path,
|
|
34
38
|
nil,
|
|
@@ -47,5 +51,24 @@ module Stytch
|
|
|
47
51
|
end
|
|
48
52
|
request
|
|
49
53
|
end
|
|
54
|
+
|
|
55
|
+
# IDs are interpolated into paths unescaped by the generated clients, so a value like
|
|
56
|
+
# "../x" would reach a different endpoint. Reject traversal and delimiter characters.
|
|
57
|
+
def validate_path!(path, query: true)
|
|
58
|
+
layer = query ? path.split('?', 2).first : path
|
|
59
|
+
5.times do
|
|
60
|
+
raise ArgumentError, "Invalid request path: #{path.inspect}" if unsafe_path_layer?(layer)
|
|
61
|
+
|
|
62
|
+
decoded = URI::DEFAULT_PARSER.unescape(layer)
|
|
63
|
+
return if decoded == layer
|
|
64
|
+
|
|
65
|
+
layer = decoded
|
|
66
|
+
end
|
|
67
|
+
raise ArgumentError, "Invalid request path: #{path.inspect}"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def unsafe_path_layer?(layer)
|
|
71
|
+
layer =~ /[?#\\]|%(2e|2f|5c|3f|23)/i || layer.split('/').any? { |segment| ['.', '..'].include?(segment) }
|
|
72
|
+
end
|
|
50
73
|
end
|
|
51
74
|
end
|
data/lib/stytch/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stytch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 11.1.
|
|
4
|
+
version: 11.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- stytch
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-12-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|