pubnub 6.1.0 → 6.1.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: 71b414f7fd632778c8f35096a7dc3c8fd3c730b827ad2335df6067fd06fc24ac
4
- data.tar.gz: 0d58ad506e63c4979b1c105a14062557ec5a84580ead37882896b6f8636a53e3
3
+ metadata.gz: 2f484475c6f9a486f2f4acb5c1882edb3a5647bd5c3fbfe2a16d521221568488
4
+ data.tar.gz: '09949bfd0ce89c476eb315783549e8fadde4681b3764311cf96576fb566bd79f'
5
5
  SHA512:
6
- metadata.gz: eb9cf2ed6c70458c3fc4d5e784273013f362b95d5328e8c98340df39dbb2290f11376e30bce891ef47d5de576a2b9307a3cfde0e76b8bf49558e742353363c83
7
- data.tar.gz: 33dcaca1439a6729e76a41eb2fb12a7ac58dc8acabace463afd035b3112aa5b8766f5a0cdeb5a095ed5d80a46408de0c2d310955506fc5efed7eb7bd3b4609f3
6
+ metadata.gz: 25cf31e4588c18a6458c9c2ddeb25862b02cd14339cd50ae59b3e9818adc756a05ba1bdfc9bdbaee5587469334b4633dddf9b5216552974d50d1ddebd116fcfa
7
+ data.tar.gz: f52d1c3fdc09ee349f25639d55844829261d514b4963e42f33b3a402cbc71f05381ea33b65216116ecc36fd6bed645827c3731b866a78c474ed7d9bb8230209f
data/.pubnub.yml CHANGED
@@ -1,6 +1,15 @@
1
1
  ---
2
- version: "6.1.0"
2
+ version: "6.1.1"
3
3
  changelog:
4
+ - date: 2026-07-21
5
+ version: v6.1.1
6
+ changes:
7
+ - type: bug
8
+ text: "`Pubnub::Cbor` now enforces a recursion-depth cap, a per-container length cap, and a total input size cap. Malformed or attacker-crafted tokens reaching `Pubnub::Client#parse_token` raise `Pubnub::Cbor::DecodeError` instead of hanging the caller or triggering `SystemStackError`."
9
+ - type: bug
10
+ text: "`Pubnub::Constants::DEFAULT_SSL` flipped from `false` to `true`. Integrators must now opt out explicitly to send traffic in cleartext."
11
+ - type: bug
12
+ text: "The Requested URI debug entry in `Pubnub::Event#uri` now masks the `signature` and `pnsig` query parameter values."
4
13
  - date: 2026-06-15
5
14
  version: v6.1.0
6
15
  changes:
@@ -647,7 +656,7 @@ sdks:
647
656
  - x86-64
648
657
  - distribution-type: package
649
658
  distribution-repository: RubyGems
650
- package-name: pubnub-6.1.0.gem
659
+ package-name: pubnub-6.1.1.gem
651
660
  location: https://rubygems.org/gems/pubnub
652
661
  requires:
653
662
  - name: addressable
@@ -752,8 +761,8 @@ sdks:
752
761
  - x86-64
753
762
  - distribution-type: library
754
763
  distribution-repository: GitHub release
755
- package-name: pubnub-6.1.0.gem
756
- location: https://github.com/pubnub/ruby/releases/download/v6.1.0/pubnub-6.1.0.gem
764
+ package-name: pubnub-6.1.1.gem
765
+ location: https://github.com/pubnub/ruby/releases/download/v6.1.1/pubnub-6.1.1.gem
757
766
  requires:
758
767
  - name: addressable
759
768
  min-version: 2.0.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v6.1.1
2
+ July 21 2026
3
+
4
+ #### Fixed
5
+ - `Pubnub::Cbor` now enforces a recursion-depth cap, a per-container length cap, and a total input size cap. Malformed or attacker-crafted tokens reaching `Pubnub::Client#parse_token` raise `Pubnub::Cbor::DecodeError` instead of hanging the caller or triggering `SystemStackError`.
6
+ - `Pubnub::Constants::DEFAULT_SSL` flipped from `false` to `true`. Integrators must now opt out explicitly to send traffic in cleartext.
7
+ - The Requested URI debug entry in `Pubnub::Event#uri` now masks the `signature` and `pnsig` query parameter values, per the SDK log practices ADR. `auth` and `token` remain visible at DEBUG since they are permitted URL parameters.
8
+
1
9
  ## v6.1.0
2
10
  June 15 2026
3
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pubnub (6.1.0)
4
+ pubnub (6.1.1)
5
5
  addressable (>= 2.0.0)
6
6
  base64
7
7
  concurrent-ruby (~> 1.3.4)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.1.0
1
+ 6.1.1
@@ -12,7 +12,7 @@ Before do |scenario|
12
12
  expect(ENV['SERVER_PORT']).not_to be_nil
13
13
  @pn_configuration = {
14
14
  origin: ENV['SERVER_HOST'] + ":" + ENV['SERVER_PORT'],
15
- isSecure: false,
15
+ ssl: false,
16
16
  }
17
17
  }
18
18
 
data/lib/pubnub/cbor.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  module Pubnub
2
2
  class Cbor
3
+ class DecodeError < StandardError; end
4
+
5
+ MAX_DEPTH = 32
6
+ MAX_CONTAINER_LENGTH = 65_536
7
+ MAX_INPUT_SIZE = 1_048_576
3
8
 
4
9
  private
5
10
 
@@ -43,9 +48,14 @@ module Pubnub
43
48
  end
44
49
  end
45
50
 
51
+ def take_bytes(data, count)
52
+ raise DecodeError, "Truncated CBOR input" if data.size < count
53
+ data.shift(count)
54
+ end
55
+
46
56
  def decode_integer(data, additional)
47
57
  if ADDITIONAL_LENGTH_BYTES.member?(additional)
48
- bytearray_to_i(data.shift(ADDITIONAL_LENGTH_BYTES[additional]))
58
+ bytearray_to_i(take_bytes(data, ADDITIONAL_LENGTH_BYTES[additional]))
49
59
  else
50
60
  additional
51
61
  end
@@ -55,7 +65,10 @@ module Pubnub
55
65
  if additional <= 23
56
66
  additional
57
67
  else
58
- bytes = bytearray_to_i(data.shift(ADDITIONAL_LENGTH_BYTES[additional]))
68
+ raise DecodeError, "Invalid float additional value" unless ADDITIONAL_LENGTH_BYTES.member?(additional)
69
+
70
+ bytes = bytearray_to_i(take_bytes(data, ADDITIONAL_LENGTH_BYTES[additional]))
71
+
59
72
  case (additional)
60
73
  when ADDITIONAL_LENGTH_1B
61
74
  bytes
@@ -98,44 +111,57 @@ module Pubnub
98
111
  result = []
99
112
 
100
113
  loop do
114
+ raise DecodeError, "Truncated CBOR input" if data.empty?
101
115
  byte = data.shift
102
116
  break if byte == INDEFINITE_BREAK
103
117
  result.append(byte)
104
- break if data.empty?
105
118
  end
106
119
  result
107
120
  end
108
121
 
109
- def compute_length(data, additional)
110
- if ADDITIONAL_LENGTH_BYTES.member?(additional)
111
- bytearray_to_i(data.shift(ADDITIONAL_LENGTH_BYTES[additional]))
112
- else
113
- additional
122
+ def compute_container_length(data, additional, min_element_bytes)
123
+ length = if ADDITIONAL_LENGTH_BYTES.member?(additional)
124
+ bytearray_to_i(take_bytes(data, ADDITIONAL_LENGTH_BYTES[additional]))
125
+ else
126
+ additional
127
+ end
128
+
129
+ if length > MAX_CONTAINER_LENGTH
130
+ raise DecodeError, "CBOR container length #{length} exceeds maximum #{MAX_CONTAINER_LENGTH}"
131
+ end
132
+
133
+ if length * min_element_bytes > data.size
134
+ raise DecodeError, "CBOR container length #{length} exceeds remaining input"
114
135
  end
136
+
137
+ length
115
138
  end
116
139
 
117
140
  def decode_string(data, additional)
118
141
  if additional == ADDITIONAL_TYPE_INDEFINITE
119
142
  indefinite_data(data).pack('C*').force_encoding('UTF-8')
120
143
  else
121
- length = compute_length(data, additional)
122
- data.shift(length).pack('C*').force_encoding('UTF-8')
144
+ length = compute_container_length(data, additional, 1)
145
+ take_bytes(data, length).pack('C*').force_encoding('UTF-8')
123
146
  end
124
147
  end
125
148
 
126
- def decode_map(data, additional)
127
- length = compute_length(data, additional)
149
+ def decode_map(data, additional, depth)
150
+ length = compute_container_length(data, additional, 2)
128
151
  result = Hash.new
129
- (1..length).each { result.store(parse_data(data), parse_data(data)) }
152
+ length.times { result.store(parse_data(data, depth), parse_data(data, depth)) }
130
153
  result
131
154
  end
132
155
 
133
- def decode_array(data, additional)
134
- length = compute_length(data, additional)
135
- (1..length).map { parse_data(data) }
156
+ def decode_array(data, additional, depth)
157
+ length = compute_container_length(data, additional, 1)
158
+ Array.new(length) { parse_data(data, depth) }
136
159
  end
137
160
 
138
- def parse_data(data)
161
+ def parse_data(data, depth = 0)
162
+ raise DecodeError, "CBOR nesting depth exceeds #{MAX_DEPTH}" if depth > MAX_DEPTH
163
+ raise DecodeError, "Truncated CBOR input" if data.empty?
164
+
139
165
  byte = data.shift
140
166
 
141
167
  case (byte)
@@ -163,9 +189,9 @@ module Pubnub
163
189
  when TYPE_TEXT_STRING
164
190
  decode_string(data, additional)
165
191
  when TYPE_ARRAY
166
- decode_array(data, additional)
192
+ decode_array(data, additional, depth + 1)
167
193
  when TYPE_HASHMAP
168
- decode_map(data, additional)
194
+ decode_map(data, additional, depth + 1)
169
195
  else
170
196
  nil
171
197
  end
@@ -175,7 +201,11 @@ module Pubnub
175
201
  public
176
202
 
177
203
  def decode(value)
178
- parse_data(value)
204
+ if value.size > MAX_INPUT_SIZE
205
+ raise DecodeError, "CBOR input size #{value.size} exceeds maximum #{MAX_INPUT_SIZE}"
206
+ end
207
+
208
+ parse_data(value.dup)
179
209
  end
180
210
  end
181
211
 
@@ -20,7 +20,7 @@ module Pubnub
20
20
  DEFAULT_TTL = 1440
21
21
  DEFAULT_REGION = '0'.freeze
22
22
  DEFAULT_USE_RANDOM_IV = true
23
- DEFAULT_SSL = false
23
+ DEFAULT_SSL = true
24
24
  REQUEST_MESSAGE_COUNT_THRESHOLD = 0
25
25
  MAXIMUM_HERE_NOW_COUNT = 1000
26
26
 
data/lib/pubnub/event.rb CHANGED
@@ -88,7 +88,7 @@ module Pubnub
88
88
  uri += path
89
89
  uri += '?' + Formatter.params_hash_to_url_params(parameters)
90
90
  uri += "&signature=#{sa_signature}" if sa_signature
91
- Pubnub.logger.debug('Pubnub::Event') { "Requested URI: #{uri}" }
91
+ Pubnub.logger.debug('Pubnub::Event') { "Requested URI: #{uri.gsub(/([?&](?:signature|pnsig)=)[^&#]*/i, '\1***')}" }
92
92
  URI uri
93
93
  end
94
94
 
@@ -1,4 +1,4 @@
1
1
  # Toplevel Pubnub module.
2
2
  module Pubnub
3
- VERSION = '6.1.0'.freeze
3
+ VERSION = '6.1.1'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubnub
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PubNub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-15 00:00:00.000000000 Z
11
+ date: 2026-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable