kettle-dev 3.1.31 → 3.1.33

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: 6dc6dbbd0c403410098d97c9bf12d56073b241db96492a3d53272ea581cd1aa1
4
- data.tar.gz: 18cf1fc3df94d8948cc92813e1290a4d8ff7a0f6706b85e4f974695d9f9ea304
3
+ metadata.gz: bd1df5ff35332b6e32cc015b2d501bf6faab0ad35f4aa0fbdd96e0dcc3a5bd39
4
+ data.tar.gz: f29c4bbd741c0067a3351e61196c15a33ffd91e081562010d0da3c9a70e0f9c9
5
5
  SHA512:
6
- metadata.gz: 93ad80b29218697907e1bf20f794a04d3ac3d3b090724514bc8dff3d7c23409a89ba4dd30585b9e12210b6e27f9081d9fe8627d3a4630d2d12eaa62581bf865c
7
- data.tar.gz: 84928f50793695a92073da7ecdce1eb18a83350c8b9e22695126e2ddebdbb7f11f346bf54e8f0c1e72c8f7a4600afc65e45bc009c493047ba3560fc58344a279
6
+ metadata.gz: e145148d99b4d8b962d33a143cc7261a9525651b52748d31b991e258451af9f88a6cf678e38c31f439359d1773e9b58d9b7f5154394bcaa87e0ca9bc8345eb52
7
+ data.tar.gz: e0421b686337c18156e947338a21ef079dd8cbe0b6c928c5c7607f82d03ab79191a25720142f88e8b5bbb115c25ade43cbd5a22261f27d19738794120c65e753
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,28 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [3.1.33] - 2026-11-27
34
+
35
+ - TAG: [v3.1.33][3.1.33t]
36
+ - COVERAGE: 92.25% -- 6038/6545 lines in 50 files
37
+ - BRANCH COVERAGE: 76.31% -- 2307/3023 branches in 50 files
38
+ - 55.92% documented
39
+
40
+ ### Fixed
41
+
42
+ - release interactive command: compute scrubbed prompt text before `scrub_secrets_from_chunk` mutates `@secret_scrub_carryover` (preventing held-back carryover bytes from being re-fed into a cleared prompt buffer) and require a prompt delimiter (`:`/`?`) in `otp_response_prompt?` so RubyGems' intro sentence (`Please enter OTP code.`) and `Code: ` prompt no longer trigger two consecutive OTP requests; also stop `call_with_open3` from waiting on an open TTY stdin after child stdout/stderr close
43
+
44
+ ## [3.1.32] - 2026-11-26
45
+
46
+ - TAG: [v3.1.32][3.1.32t]
47
+ - COVERAGE: 92.07% -- 6013/6531 lines in 50 files
48
+ - BRANCH COVERAGE: 76.16% -- 2300/3020 branches in 50 files
49
+ - 55.92% documented
50
+
51
+ ### Fixed
52
+
53
+ - release: a plain `gem push` that RubyGems rejects for an invalid OTP is retried up to three times, each time asking the secrets provider (and so the user) for a fresh code, instead of aborting after RubyGems' own single re-prompt; only the `bundle exec rake release` path had a kettle-level retry before
54
+
33
55
  ## [3.1.31] - 2026-11-20
34
56
 
35
57
  - TAG: [v3.1.31][3.1.31t]
@@ -4386,7 +4408,11 @@ Please file a bug if you notice a violation of semantic versioning.
4386
4408
  - Selecting will run the selected workflow via `act`
4387
4409
  - This may move to its own gem in the future.
4388
4410
 
4389
- [Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.31...HEAD
4411
+ [Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.33...HEAD
4412
+ [3.1.33]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.32...v3.1.33
4413
+ [3.1.33t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.33
4414
+ [3.1.32]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.31...v3.1.32
4415
+ [3.1.32t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.32
4390
4416
  [3.1.31]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.30...v3.1.31
4391
4417
  [3.1.31t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.31
4392
4418
  [3.1.30]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.29...v3.1.30
data/README.md CHANGED
@@ -1034,7 +1034,7 @@ Thanks for RTFM. ☺️
1034
1034
  [📌gitmoji]: https://gitmoji.dev
1035
1035
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
1036
1036
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
1037
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-6.520-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1037
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-6.545-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1038
1038
  [🔐security]: https://github.com/kettle-dev/kettle-dev/blob/main/SECURITY.md
1039
1039
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
1040
1040
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -51,26 +51,22 @@ module Kettle
51
51
  if reader.equal?(@input)
52
52
  input.write(@input.readpartial(1024))
53
53
  else
54
- chunk = output.readpartial(1024)
54
+ raw_chunk = output.readpartial(1024)
55
55
  # Two views of the same bytes, with independent state.
56
56
  #
57
57
  # Emitted view: holds back a trailing window so a secret
58
58
  # split across chunks can never reach the log; the window
59
59
  # is released by flush_secret_scrub_carryover at stream end.
60
60
  #
61
- # Prompt view: scrubbed but never held back. A child that
62
- # prints its prompt and then blocks on stdin (Gem's OTP
63
- # `Code: ` ask) produces no further output; if the prompt
64
- # tail sat in the emitted view's holdback, detection would
65
- # never fire and the child would deadlock. The prompt view
66
- # therefore scrubs the raw chunk directly (plus the emitted
67
- # view's carryover, read-only, so bytes spanning the
68
- # boundary are still masked) instead of consuming it.
69
- chunk = scrub_secrets_from_chunk(chunk)
70
- prompt_text = scrub_secrets_for_prompt_detection(chunk)
61
+ # Prompt view: computed BEFORE scrub_secrets_from_chunk
62
+ # mutates @secret_scrub_carryover, so boundary secrets are
63
+ # masked without holding back the prompt tail or re-feeding
64
+ # old carryover bytes into a freshly cleared prompt buffer.
65
+ prompt_buffer = append_prompt_text(prompt_buffer, raw_chunk)
66
+ chunk = scrub_secrets_from_chunk(raw_chunk)
71
67
  stdout_str << chunk
72
68
  @output.print(chunk)
73
- prompt_buffer = handle_prompt(input, prompt_text, prompt_buffer: prompt_buffer)
69
+ prompt_buffer = handle_prompt(input, "", prompt_buffer: prompt_buffer)
74
70
  end
75
71
  end
76
72
  end
@@ -99,15 +95,16 @@ module Kettle
99
95
  Open3.popen3(env, *argv) do |input, output, error, wait_thread|
100
96
  readers = [output, error]
101
97
  readers << @input if @forward_stdin && @input.tty?
102
- until readers.empty?
98
+ while readers.include?(output) || readers.include?(error)
103
99
  ready = IO.select(readers)
104
100
  ready.first.each do |reader|
105
101
  if reader.equal?(@input)
106
102
  input.write(@input.readpartial(1024))
107
103
  else
108
104
  begin
109
- chunk = reader.readpartial(1024)
110
- chunk = scrub_secrets_from_chunk(chunk)
105
+ raw_chunk = reader.readpartial(1024)
106
+ prompt_buffer = append_prompt_text(prompt_buffer, raw_chunk)
107
+ chunk = scrub_secrets_from_chunk(raw_chunk)
111
108
  if reader.equal?(output)
112
109
  stdout_str << chunk
113
110
  @output.print(chunk)
@@ -115,7 +112,7 @@ module Kettle
115
112
  stderr_str << chunk
116
113
  @error.print(chunk)
117
114
  end
118
- prompt_buffer = handle_prompt(input, chunk, prompt_buffer: prompt_buffer)
115
+ prompt_buffer = handle_prompt(input, "", prompt_buffer: prompt_buffer)
119
116
  rescue EOFError
120
117
  readers.delete(reader)
121
118
  end
@@ -225,17 +222,33 @@ module Kettle
225
222
  chunk
226
223
  end
227
224
 
228
- # Prompt-detection view: scrubbed, but never holds back a trailing
229
- # window. Reads (never consumes) the emitted view's carryover so bytes
230
- # spanning a chunk boundary are still masked here. Without this view, a
231
- # prompt whose tail falls inside the holdback — a child that blocks on
232
- # stdin and produces no further output — would never be answered, and
233
- # the release would deadlock.
234
- def scrub_secrets_for_prompt_detection(chunk)
235
- return chunk if @written_secrets.empty?
225
+ # Prompt-detection view: appends only the newly scrubbed bytes from
226
+ # raw_chunk to prompt_buffer without holding back a trailing window and
227
+ # without re-emitting carryover bytes that were already processed (or
228
+ # cleared after answering a prompt). Must run before
229
+ # scrub_secrets_from_chunk updates @secret_scrub_carryover.
230
+ def append_prompt_text(prompt_buffer, raw_chunk)
231
+ prompt_buffer = prompt_buffer.to_s.dup
232
+ if @written_secrets.empty?
233
+ prompt_buffer << raw_chunk.to_s
234
+ else
235
+ before = @secret_scrub_carryover
236
+ scrubbed = (before + raw_chunk.to_s).gsub(Regexp.union(@written_secrets), "[SECRET REMOVED]")
237
+ prefix_len = common_prefix_bytesize(before, scrubbed)
238
+ overlap = before.bytesize - prefix_len
239
+ if overlap.positive? && prompt_buffer.end_with?(before)
240
+ prompt_buffer = prompt_buffer.byteslice(0, prompt_buffer.bytesize - overlap).to_s
241
+ end
242
+ prompt_buffer << scrubbed.byteslice(prefix_len, scrubbed.bytesize - prefix_len).to_s
243
+ end
244
+ prompt_buffer.byteslice([prompt_buffer.bytesize - 4096, 0].max, 4096).to_s
245
+ end
236
246
 
237
- buffer = @secret_scrub_carryover + chunk
238
- buffer.gsub(Regexp.union(@written_secrets), "[SECRET REMOVED]")
247
+ def common_prefix_bytesize(left, right)
248
+ limit = [left.bytesize, right.bytesize].min
249
+ index = 0
250
+ index += 1 while index < limit && left.getbyte(index) == right.getbyte(index)
251
+ index
239
252
  end
240
253
 
241
254
  def otp_prompt?(chunk)
@@ -243,7 +256,7 @@ module Kettle
243
256
  end
244
257
 
245
258
  def otp_response_prompt?(chunk)
246
- chunk.match?(/(?:OTP code|one-time password|\bCode:\s*)/i)
259
+ chunk.match?(/(?:OTP code|one-time password|\bCode)\s*[:?]\s*\z/i)
247
260
  end
248
261
 
249
262
  def signing_password_prompt?(chunk)
@@ -30,6 +30,9 @@ module Kettle
30
30
  class ReleaseCLI
31
31
  RUBYGEMS_INVALID_OTP = /Your OTP code is incorrect\. Please check it and retry\./.freeze
32
32
  OTP_RETRY_DELAY_SECONDS = 2
33
+ # Fresh-OTP retries for a plain `gem push` that RubyGems rejects (a mistyped code, a code
34
+ # from the wrong window). Each retry asks the secrets provider again, which re-prompts.
35
+ GEM_PUSH_OTP_RETRIES = 3
33
36
  GITHUB_RELEASE_ASSET_UPLOAD_ATTEMPTS = 3
34
37
  GITHUB_RELEASE_ASSET_UPLOAD_RETRY_DELAY_SECONDS = 1
35
38
  QUIET_ENV = {
@@ -1792,19 +1795,35 @@ module Kettle
1792
1795
  return self.class.run_cmd!(cmd) unless release_secret_command?(cmd) && release_secrets_configured?
1793
1796
 
1794
1797
  keep_release_secrets_alive!("prompt-bearing command")
1795
- puts "$ #{cmd}"
1796
- stdout_str, stderr_str, status = Kettle::Dev::InteractiveReleaseCommand.new(
1797
- secrets_provider: @secrets_provider,
1798
- secret_event_handler: ->(payload) { emit_secret_event(payload) }
1799
- ).call(
1800
- self.class.send(:command_env_for, cmd),
1801
- cmd
1802
- )
1803
- return if status.success?
1798
+ otp_retries = 0
1799
+ stdout_str = stderr_str = status = nil
1800
+ loop do
1801
+ puts "$ #{cmd}"
1802
+ stdout_str, stderr_str, status = Kettle::Dev::InteractiveReleaseCommand.new(
1803
+ secrets_provider: @secrets_provider,
1804
+ secret_event_handler: ->(payload) { emit_secret_event(payload) }
1805
+ ).call(
1806
+ self.class.send(:command_env_for, cmd),
1807
+ cmd
1808
+ )
1809
+ return if status.success?
1804
1810
 
1805
- if gem_release_command?(cmd) && rubygems_invalid_otp?(stdout_str, stderr_str)
1806
- retry_gem_push_after_invalid_otp!
1807
- return
1811
+ if gem_release_command?(cmd) && rubygems_invalid_otp?(stdout_str, stderr_str)
1812
+ retry_gem_push_after_invalid_otp!
1813
+ return
1814
+ end
1815
+ break unless gem_push_command?(cmd) && rubygems_invalid_otp?(stdout_str, stderr_str) &&
1816
+ otp_retries < GEM_PUSH_OTP_RETRIES
1817
+
1818
+ otp_retries += 1
1819
+ puts "RubyGems rejected the OTP; asking for a fresh one (attempt #{otp_retries}/#{GEM_PUSH_OTP_RETRIES})..."
1820
+ emit_secret_event(
1821
+ source: release_secrets_provider_label,
1822
+ action: "otp_retry",
1823
+ status: "started",
1824
+ reason: "RubyGems rejected the OTP for gem push (retry #{otp_retries}/#{GEM_PUSH_OTP_RETRIES})"
1825
+ )
1826
+ sleep(OTP_RETRY_DELAY_SECONDS)
1808
1827
  end
1809
1828
 
1810
1829
  exit_code = status.respond_to?(:exitstatus) ? status.exitstatus : 1
@@ -1826,6 +1845,10 @@ module Kettle
1826
1845
  effective_command_words(cmd).first(4) == ["bundle", "exec", "rake", "release"]
1827
1846
  end
1828
1847
 
1848
+ def gem_push_command?(cmd)
1849
+ effective_command_words(cmd).first(2) == ["gem", "push"]
1850
+ end
1851
+
1829
1852
  def rubygems_invalid_otp?(*output)
1830
1853
  output.any? { |chunk| chunk.to_s.match?(RUBYGEMS_INVALID_OTP) }
1831
1854
  end
@@ -5,7 +5,7 @@ module Kettle
5
5
  # Version namespace for this gem.
6
6
  module Version
7
7
  # Current gem version.
8
- VERSION = "3.1.31"
8
+ VERSION = "3.1.33"
9
9
  end
10
10
  # Current gem version exposed at the traditional constant location.
11
11
  VERSION = Version::VERSION # Traditional Constant Location
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kettle-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.31
4
+ version: 3.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -476,10 +476,10 @@ licenses:
476
476
  - AGPL-3.0-only
477
477
  metadata:
478
478
  homepage_uri: "https://kettle-dev.galtzo.com"
479
- source_code_uri: "https://github.com/kettle-dev/kettle-dev/tree/v3.1.31"
480
- changelog_uri: "https://github.com/kettle-dev/kettle-dev/blob/v3.1.31/CHANGELOG.md"
479
+ source_code_uri: "https://github.com/kettle-dev/kettle-dev/tree/v3.1.33"
480
+ changelog_uri: "https://github.com/kettle-dev/kettle-dev/blob/v3.1.33/CHANGELOG.md"
481
481
  bug_tracker_uri: "https://github.com/kettle-dev/kettle-dev/issues"
482
- documentation_uri: "https://www.rubydoc.info/gems/kettle-dev/3.1.31"
482
+ documentation_uri: "https://www.rubydoc.info/gems/kettle-dev/3.1.33"
483
483
  funding_uri: "https://github.com/sponsors/pboling"
484
484
  wiki_uri: "https://github.com/kettle-dev/kettle-dev/wiki"
485
485
  news_uri: "https://www.railsbling.com/tags/kettle-dev"
@@ -511,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
511
511
  - !ruby/object:Gem::Version
512
512
  version: "0"
513
513
  requirements: []
514
- rubygems_version: 4.1.0
514
+ rubygems_version: 4.1.1
515
515
  specification_version: 4
516
516
  summary: 🍲 A kettle-dev meta tool to streamline development and testing
517
517
  test_files: []
metadata.gz.sig CHANGED
Binary file