semian 0.20.0 → 0.21.0

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: bd8decd384592d21ffffd5d5300099c9bf7a0971e7a385fb84288bd2661fa165
4
- data.tar.gz: 3cd2627d985a29ab04a8b28f27bd0f12756f182a6919b86f5ae1821751f3ccf5
3
+ metadata.gz: 81f8b86816bb4e9de0850867f80de644ff8ce7f7fcfa6798d28ad772a83ea25f
4
+ data.tar.gz: 153aa759abfa028a208893c328aa525d514caa6901cf2fa9ad6b4f0e86987b63
5
5
  SHA512:
6
- metadata.gz: f14a28ea47bf2ffd290ae0d01535361a5a13e3f85debcad18c0801c367a13dc3bbc0e23280bf339c9c9cd098ec7a0d03eaf3c853d11c57911d2fe561750112f2
7
- data.tar.gz: fbde9d094a74317531b55df4075b63b9cc69337a44fdf6212f8ca2c350c2d2084b3b6a8b4cc0762b70ae4ac574fbd0b0c13decd378f191394b07fb6553fb0293
6
+ metadata.gz: e73bcfd0fd395b7b1f2acf729a769e73e77c9329508a2290fe3f0f175fa0ee779a1d8c2a40ad5131322a2823898230cc71e9043eb29bc064d22f6f894a8e7fc9
7
+ data.tar.gz: 9d80a9be09e0afc14d21bcf26dcdae7de60a0c0e9abe766fc6a17c13f0ae3eb9b5cede85ac47d482c6520d700ec0fca4e33ece4b0bed100f61aa03a3f61a20af
@@ -91,11 +91,7 @@ module Semian
91
91
  end
92
92
 
93
93
  # TODO: share this with Mysql2
94
- QUERY_ALLOWLIST = Regexp.union(
95
- %r{\A(?:/\*.*?\*/)?\s*ROLLBACK}i,
96
- %r{\A(?:/\*.*?\*/)?\s*COMMIT}i,
97
- %r{\A(?:/\*.*?\*/)?\s*RELEASE\s+SAVEPOINT}i,
98
- )
94
+ QUERY_ALLOWLIST = %r{\A(?:/\*.*?\*/)?\s*(ROLLBACK|COMMIT|RELEASE\s+SAVEPOINT)}i
99
95
 
100
96
  def query_allowlisted?(sql, *)
101
97
  QUERY_ALLOWLIST.match?(sql)
data/lib/semian/mysql2.rb CHANGED
@@ -37,11 +37,7 @@ module Semian
37
37
  DEFAULT_HOST = "localhost"
38
38
  DEFAULT_PORT = 3306
39
39
 
40
- QUERY_WHITELIST = Regexp.union(
41
- %r{\A(?:/\*.*?\*/)?\s*ROLLBACK}i,
42
- %r{\A(?:/\*.*?\*/)?\s*COMMIT}i,
43
- %r{\A(?:/\*.*?\*/)?\s*RELEASE\s+SAVEPOINT}i,
44
- )
40
+ QUERY_ALLOWLIST = %r{\A(?:/\*.*?\*/)?\s*(ROLLBACK|COMMIT|RELEASE\s+SAVEPOINT)}i
45
41
 
46
42
  class << self
47
43
  # The naked methods are exposed as `raw_query` and `raw_connect` for instrumentation purpose
@@ -114,7 +110,7 @@ module Semian
114
110
  end
115
111
 
116
112
  def query_whitelisted?(sql, *)
117
- QUERY_WHITELIST =~ sql
113
+ QUERY_ALLOWLIST =~ sql
118
114
  rescue ArgumentError
119
115
  # The above regexp match can fail if the input SQL string contains binary
120
116
  # data that is not recognized as a valid encoding, in which case we just
@@ -42,13 +42,11 @@ module Semian
42
42
  end
43
43
 
44
44
  module RedisV5Client
45
- private
46
-
47
45
  def translate_error!(error)
48
46
  redis_error = translate_error_class(error.class)
49
47
  if redis_error < ::Semian::AdapterError
50
48
  redis_error = redis_error.new(error.message)
51
- redis_error.semian_identifier = semian_identifier
49
+ redis_error.semian_identifier = error.semian_identifier
52
50
  end
53
51
  raise redis_error, error.message, error.backtrace
54
52
  end
@@ -56,4 +54,4 @@ module Semian
56
54
  end
57
55
 
58
56
  ::Redis.prepend(Semian::RedisV5)
59
- ::Redis::Client.prepend(Semian::RedisV5Client)
57
+ ::Redis::Client.singleton_class.prepend(Semian::RedisV5Client)
data/lib/semian/redis.rb CHANGED
@@ -4,7 +4,8 @@ require "semian/adapter"
4
4
  require "redis"
5
5
 
6
6
  if Redis::VERSION >= "5"
7
- gem "redis", ">= 5.0.3"
7
+ gem "redis", ">= 5.0.7"
8
+ gem "redis-client", ">= 0.19.0"
8
9
  require "semian/redis/v5"
9
10
  return
10
11
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Semian
4
- VERSION = "0.20.0"
4
+ VERSION = "0.21.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Francis
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-10-26 00:00:00.000000000 Z
13
+ date: 2023-12-07 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |2
16
16
  A Ruby C extention that is used to control access to shared resources
@@ -60,7 +60,7 @@ licenses:
60
60
  metadata:
61
61
  allowed_push_host: https://rubygems.org
62
62
  bug_tracker_uri: https://github.com/Shopify/semian/issues
63
- changelog_uri: https://github.com/Shopify/semian/blob/master/CHANGELOG.md
63
+ changelog_uri: https://github.com/Shopify/semian/blob/main/CHANGELOG.md
64
64
  documentation_uri: https://github.com/Shopify/semian
65
65
  homepage_uri: https://github.com/Shopify/semian
66
66
  source_code_uri: https://github.com/Shopify/semian
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.4.21
82
+ rubygems_version: 3.4.22
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Bulkheading for Ruby with SysV semaphores