rack-graphql 3.8.0 → 3.9.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: 1dae49ce19bfc15635ecbc96b8577aac5670c9ff7c4d8a3d49b89f0e84d416d0
4
- data.tar.gz: a758aacdbf0c85b4292cea6f58c3df71f6ac1c4e9cd7ed78fd509f0c36d6eb0b
3
+ metadata.gz: a0f357c7f34664d705a55ffa4b90709ce68971d6e7d400a6dc8d1ce30d7e46b9
4
+ data.tar.gz: 53ff62e96f121b0f1cf1100464c8304fcc66721796edafcf5e0835321a02c82a
5
5
  SHA512:
6
- metadata.gz: d4b52740f5d98d7b3e6947737700f371040edd5dbb3bf3dabb8f134793a5dedd135edf33bf9d5682bd4dc1b0f164f1b21ea4774159a43e15752c1adc3d7ea682
7
- data.tar.gz: 22be795ea42e466bcb2320c1b5ecfa6a2c78801dadb55e5c64b45849690561c16423fd344db368f8f2adb2bc83ecd4aeed7f8197dc972f345ca98f4db5b7a250
6
+ metadata.gz: 200a45fa61a54367725c2da022d75c5527ff5a4e6b188a5d79f060e7e17e365a35fde87c73590d1f6d19272f694b32cd3a70e45bb3dfe7a87bbbeadbc0675cd2
7
+ data.tar.gz: 90fc7cfc3f0f7e135b9d4d6a4858dbddd294a13570666b8caebe64c41d01f0f91aa8281c96b5f807a8e3a285ceb1e874a8e7e44da8aa9957a1eaa5bf0b46a938
data/.bundler-version CHANGED
@@ -1 +1,2 @@
1
- 2.6.3
1
+ 2.6.9
2
+
@@ -2,5 +2,5 @@
2
2
  <!--- Describe your changes in detail -->
3
3
  <!--- Why is this change required? What problem does it solve? -->
4
4
 
5
- ## Related issue(s) or PR(s)
6
- <!--- GH issue number -->
5
+ ## Related tickets(s), PR(s) or slack message:
6
+ <!--- Ticket/Issue/PR number or URL -->
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.9.0 - 2025-05-29
4
+ - Ability to provide secret scrubber, so sensitive values are not logged
5
+
3
6
  ## 3.8.0 - 2025-02-05
4
7
  - Ruby 3.4 support. Drop ruby 3.2 support.
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-graphql (3.8.0)
4
+ rack-graphql (3.9.0)
5
5
  graphql (~> 2.0)
6
6
  json (>= 2.8.0)
7
7
  rack (>= 2.2.6)
@@ -9,29 +9,31 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- ast (2.4.2)
12
+ ast (2.4.3)
13
13
  awesome_print (1.9.2)
14
14
  base64 (0.2.0)
15
15
  coderay (1.1.3)
16
- diff-lcs (1.5.1)
17
- fiber-storage (1.0.0)
18
- graphql (2.4.9)
16
+ diff-lcs (1.6.2)
17
+ fiber-storage (1.0.1)
18
+ graphql (2.5.7)
19
19
  base64
20
20
  fiber-storage
21
21
  logger
22
- json (2.9.1)
23
- language_server-protocol (3.17.0.4)
24
- logger (1.6.5)
22
+ json (2.12.0)
23
+ language_server-protocol (3.17.0.5)
24
+ lint_roller (1.1.0)
25
+ logger (1.7.0)
25
26
  method_source (1.1.0)
26
- parallel (1.26.3)
27
- parser (3.3.7.1)
27
+ parallel (1.27.0)
28
+ parser (3.3.8.0)
28
29
  ast (~> 2.4.1)
29
30
  racc
31
+ prism (1.4.0)
30
32
  pry (0.15.2)
31
33
  coderay (~> 1.1)
32
34
  method_source (~> 1.0)
33
35
  racc (1.8.1)
34
- rack (3.1.9)
36
+ rack (3.1.15)
35
37
  rack-test (2.2.0)
36
38
  rack (>= 1.3)
37
39
  rainbow (3.1.1)
@@ -41,31 +43,35 @@ GEM
41
43
  rspec-core (~> 3.13.0)
42
44
  rspec-expectations (~> 3.13.0)
43
45
  rspec-mocks (~> 3.13.0)
44
- rspec-core (3.13.2)
46
+ rspec-core (3.13.3)
45
47
  rspec-support (~> 3.13.0)
46
- rspec-expectations (3.13.3)
48
+ rspec-expectations (3.13.4)
47
49
  diff-lcs (>= 1.2.0, < 2.0)
48
50
  rspec-support (~> 3.13.0)
49
- rspec-mocks (3.13.2)
51
+ rspec-mocks (3.13.4)
50
52
  diff-lcs (>= 1.2.0, < 2.0)
51
53
  rspec-support (~> 3.13.0)
52
- rspec-support (3.13.2)
53
- rubocop (1.71.2)
54
+ rspec-support (3.13.3)
55
+ rubocop (1.75.6)
54
56
  json (~> 2.3)
55
- language_server-protocol (>= 3.17.0)
57
+ language_server-protocol (~> 3.17.0.2)
58
+ lint_roller (~> 1.1.0)
56
59
  parallel (~> 1.10)
57
60
  parser (>= 3.3.0.2)
58
61
  rainbow (>= 2.2.2, < 4.0)
59
62
  regexp_parser (>= 2.9.3, < 3.0)
60
- rubocop-ast (>= 1.38.0, < 2.0)
63
+ rubocop-ast (>= 1.44.0, < 2.0)
61
64
  ruby-progressbar (~> 1.7)
62
65
  unicode-display_width (>= 2.4.0, < 4.0)
63
- rubocop-ast (1.38.0)
64
- parser (>= 3.3.1.0)
65
- rubocop-rake (0.6.0)
66
- rubocop (~> 1.0)
67
- rubocop-rspec (3.4.0)
68
- rubocop (~> 1.61)
66
+ rubocop-ast (1.44.1)
67
+ parser (>= 3.3.7.2)
68
+ prism (~> 1.4)
69
+ rubocop-rake (0.7.1)
70
+ lint_roller (~> 1.1)
71
+ rubocop (>= 1.72.1)
72
+ rubocop-rspec (3.6.0)
73
+ lint_roller (~> 1.1)
74
+ rubocop (~> 1.72, >= 1.72.1)
69
75
  ruby-progressbar (1.13.0)
70
76
  unicode-display_width (3.1.4)
71
77
  unicode-emoji (~> 4.0, >= 4.0.4)
@@ -12,7 +12,8 @@ module RackGraphql
12
12
  health_on_root_path: health_route,
13
13
  root_path_app: nil,
14
14
  error_status_code_map: {},
15
- request_epilogue: -> {}
15
+ request_epilogue: -> {},
16
+ secret_scrubber: nil
16
17
  )
17
18
  ::Rack::Builder.new do
18
19
  map '/graphql' do
@@ -25,6 +26,7 @@ module RackGraphql
25
26
  log_exception_backtrace:,
26
27
  error_status_code_map:,
27
28
  request_epilogue:,
29
+ secret_scrubber:
28
30
  )
29
31
  end
30
32
 
@@ -14,7 +14,8 @@ module RackGraphql
14
14
  log_exception_backtrace: RackGraphql.log_exception_backtrace,
15
15
  re_raise_exceptions: false,
16
16
  error_status_code_map: {},
17
- request_epilogue: -> {}
17
+ request_epilogue: -> {},
18
+ secret_scrubber: nil
18
19
  )
19
20
  @schema = schema
20
21
  @app_name = app_name
@@ -24,6 +25,7 @@ module RackGraphql
24
25
  @re_raise_exceptions = re_raise_exceptions
25
26
  @error_status_code_map = error_status_code_map
26
27
  @request_epilogue = request_epilogue || -> {}
28
+ @secret_scrubber = secret_scrubber || ->(value) { value }
27
29
  end
28
30
 
29
31
  def call(env)
@@ -37,7 +39,7 @@ module RackGraphql
37
39
  operation_name = params['operationName']
38
40
  context = context_handler.call(env)
39
41
 
40
- log("Executing with params: #{params.inspect}, operationName: #{operation_name}, variables: #{variables.inspect}")
42
+ log("Executing with params: #{secret_scrubber.call(params)}, operationName: #{operation_name}, variables: #{secret_scrubber.call(variables)}")
41
43
  result = execute(params:, operation_name:, variables:, context:)
42
44
  status_code = response_status(result)
43
45
 
@@ -48,7 +50,7 @@ module RackGraphql
48
50
  ]
49
51
  rescue AmbiguousParamError => e
50
52
  exception_string = dump_exception(e)
51
- log(exception_string)
53
+ log_error(exception_string)
52
54
  env[Rack::RACK_ERRORS].puts(exception_string)
53
55
  env[Rack::RACK_ERRORS].flush
54
56
  [
@@ -62,7 +64,7 @@ module RackGraphql
62
64
  # so they cannot be caught by error tracking rack middlewares.
63
65
  # You can change this behavior via `re_raise_exceptions` argument.
64
66
  exception_string = dump_exception(e)
65
- log(exception_string)
67
+ log_error(exception_string)
66
68
 
67
69
  raise e if re_raise_exceptions
68
70
 
@@ -83,7 +85,7 @@ module RackGraphql
83
85
 
84
86
  attr_reader :schema, :app_name, :logger, :context_handler,
85
87
  :log_exception_backtrace, :error_status_code_map,
86
- :re_raise_exceptions, :request_epilogue
88
+ :re_raise_exceptions, :request_epilogue, :secret_scrubber
87
89
 
88
90
  def post_request?(env)
89
91
  env['REQUEST_METHOD'] == 'POST'
@@ -187,9 +189,11 @@ module RackGraphql
187
189
  end
188
190
 
189
191
  def log(message)
190
- return unless logger
192
+ logger&.info("[rack-graphql] #{message}")
193
+ end
191
194
 
192
- logger.info("[rack-graphql] #{message}")
195
+ def log_error(message)
196
+ logger&.error("[rack-graphql] #{message}")
193
197
  end
194
198
 
195
199
  # Based on https://github.com/rack/rack/blob/master/lib/rack/show_exceptions.rb
@@ -1,3 +1,3 @@
1
1
  module RackGraphql
2
- VERSION = '3.8.0'.freeze
2
+ VERSION = '3.9.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: graphql
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubygems_version: 3.6.3
108
+ rubygems_version: 3.6.9
109
109
  specification_version: 4
110
110
  summary: Rack middleware implementing graphql endpoint.
111
111
  test_files: []