stripe 19.6.0 → 19.6.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2658d175c0e9668ca5effb73396f22b9f19a3df059558de5ae56912db9e9547a
|
|
4
|
+
data.tar.gz: 29e5fb8e31fa57e3011a24117be58d99eb0f06d1385014ba135df1a936abe7db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a55bcb93a02feb6f0f766bf10ef9fde2a30be1535bead833583cbb24e49e9ca791ab0910a02d957f66bb2b1bec5e701ba8e330554a0a9536036cbed79e516e7
|
|
7
|
+
data.tar.gz: e992a203be967077d537facef9323182a643d6004197b7d563a93a98c79fb745283d6b8c23526fae44b0067f5f9f994e5e26e8ff17ac3228cd883a93393aedbf
|
data/lib/stripe/api_requestor.rb
CHANGED
|
@@ -462,13 +462,13 @@ module Stripe
|
|
|
462
462
|
private def execute_request_internal(method, path,
|
|
463
463
|
base_address, params, opts, usage,
|
|
464
464
|
&read_body_chunk_block)
|
|
465
|
+
Util.validate_path!(path)
|
|
466
|
+
|
|
465
467
|
api_mode = Util.get_api_mode(path)
|
|
466
468
|
opts = RequestOptions.merge_config_and_opts(config, opts)
|
|
467
469
|
|
|
468
470
|
raise ArgumentError, "method should be a symbol" \
|
|
469
471
|
unless method.is_a?(Symbol)
|
|
470
|
-
raise ArgumentError, "path should be a string" \
|
|
471
|
-
unless path.is_a?(String)
|
|
472
472
|
|
|
473
473
|
base_url ||= config.base_addresses[base_address]
|
|
474
474
|
|
|
@@ -53,9 +53,12 @@ module Stripe
|
|
|
53
53
|
|
|
54
54
|
# Retrieves the Event that generated this EventNotification.
|
|
55
55
|
def fetch_event
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
# `id` comes from the notification body, so escape it the way generated
|
|
57
|
+
# services do -- otherwise it can inject extra path or query segments.
|
|
58
|
+
path = "/v2/core/events/#{CGI.escape(id)}"
|
|
59
|
+
resp = @client.raw_request(:get, path, opts: { stripe_context: context,
|
|
60
|
+
"Stripe-Request-Trigger" => "event=#{id}", },
|
|
61
|
+
usage: ["fetch_event"])
|
|
59
62
|
@client.deserialize(resp.http_body, api_mode: :v2)
|
|
60
63
|
end
|
|
61
64
|
end
|
data/lib/stripe/util.rb
CHANGED
|
@@ -375,6 +375,38 @@ module Stripe
|
|
|
375
375
|
res.zero?
|
|
376
376
|
end
|
|
377
377
|
|
|
378
|
+
# Asserts that a request path is origin-relative: that it begins with a
|
|
379
|
+
# single "/" and carries no scheme, authority or userinfo.
|
|
380
|
+
#
|
|
381
|
+
# The absolute URL is built by concatenating a base address onto this path,
|
|
382
|
+
# and no base address ends in a slash. A path like "@evil.example/v1/x" or
|
|
383
|
+
# ".evil.example/v1/x" would modify the resulting host and direct the request
|
|
384
|
+
# (including the API key) to a non-Stripe host.
|
|
385
|
+
#
|
|
386
|
+
# Because some relative urls arrive from potentially untrusted sources (like
|
|
387
|
+
# webhook bodies), we have to be a little defensive.
|
|
388
|
+
#
|
|
389
|
+
# So, we require that a path starts with a leading slash and that URI.parse
|
|
390
|
+
# finds no scheme or authority in it.
|
|
391
|
+
def self.validate_path!(path)
|
|
392
|
+
unless path.is_a?(String) && path.start_with?("/") && !path.start_with?("//")
|
|
393
|
+
raise ArgumentError,
|
|
394
|
+
"path must be a string beginning with a single \"/\", got: #{path.inspect}"
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
uri =
|
|
398
|
+
begin
|
|
399
|
+
URI.parse(path)
|
|
400
|
+
rescue URI::InvalidURIError
|
|
401
|
+
raise ArgumentError, "path is not a valid URI: #{path.inspect}"
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
return if uri.scheme.nil? && uri.host.nil? && uri.userinfo.nil?
|
|
405
|
+
|
|
406
|
+
raise ArgumentError,
|
|
407
|
+
"path may not contain a scheme or authority, got: #{path.inspect}"
|
|
408
|
+
end
|
|
409
|
+
|
|
378
410
|
# Returns either v1 or v2 as api_mode based on the given path
|
|
379
411
|
def self.get_api_mode(path)
|
|
380
412
|
if path.start_with?("/v2/")
|
data/lib/stripe/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stripe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 19.6.
|
|
4
|
+
version: 19.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bigdecimal
|