google-apis-core 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e29025436ed278972d36fc429f233b081edc5d40fa68921b71ae65758ece231
4
- data.tar.gz: 2a41e0145da41d66e0455f58b4ba0213ea4468b7d9ed94d4fcdcfba1bc8895f2
3
+ metadata.gz: 0c4ade0959657cd3bff8601534b1f50e10335061306f94f19a1a5f0d31243378
4
+ data.tar.gz: 97c094fd9c168d9e1bad64607dd4acc9ab3c9e748018b7173246bd76a52505dc
5
5
  SHA512:
6
- metadata.gz: '0540862757c8e96b73c1378544d3aac273f446f16ef430e3c5a9c36859ead4a1542502e896603ec9b5a92f119c3c2b11b2fc1e376fd0e838d93787d8d71d73f4'
7
- data.tar.gz: c6ffa51666f75b6de32ab113e36eb9774a0c77d8050e9b6f8d18ca6a9acbd5b3f1c84413339b8d58dfe8b7eefd8bf8b758b3d1fdb238e015c8a5ae41c8ebd701
6
+ metadata.gz: 38718b83507b48984c0808da6c550092a7d4988574595b8eb769f3303352b1b51af520e323179836289f3c5524f780ea393df25c26f15555d636786788255336
7
+ data.tar.gz: 967b026074f0a0d016621f78649e41b3d47c04fd7f2da8a14564897d21bfe9cc25aa207fe6612a00a97c044d31a9505018140ca4cf94bd4fc45d1709d0e0d38d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 0.9.4 (2023-01-07)
4
+
5
+ #### Bug Fixes
6
+
7
+ * Recursively redact unsafe payloads from logs ([#13189](https://github.com/googleapis/google-api-ruby-client/issues/13189))
8
+
3
9
  ### 0.9.3 (2023-01-04)
4
10
 
5
11
  #### Bug Fixes
@@ -264,7 +264,7 @@ module Google
264
264
  # @return [Object] result if no block given
265
265
  # @yield [result, nil] if block given
266
266
  def success(result, &block)
267
- logger.debug { sprintf('Success - %s', safe_object_representation(result)) }
267
+ logger.debug { sprintf('Success - %s', safe_pretty_representation(result)) }
268
268
  block.call(result, nil) if block_given?
269
269
  result
270
270
  end
@@ -317,7 +317,7 @@ module Google
317
317
  header: request_header,
318
318
  follow_redirect: true)
319
319
  logger.debug { @http_res.status }
320
- logger.debug { safe_response_representation @http_res }
320
+ logger.debug { safe_single_line_representation @http_res }
321
321
  response = process_response(@http_res.status.to_i, @http_res.header, @http_res.body)
322
322
  success(response)
323
323
  rescue => e
@@ -351,21 +351,37 @@ module Google
351
351
  "Google::Apis::SecretmanagerV1beta1::SecretPayload"
352
352
  ]
353
353
 
354
- def safe_object_representation obj
355
- name = obj.class.name
356
- if UNSAFE_CLASS_NAMES.include? name
357
- "#<#{name} (fields redacted)>"
358
- else
359
- PP.pp(obj, "")
354
+ module RedactingPPMethods
355
+ def pp_object obj
356
+ return super unless UNSAFE_CLASS_NAMES.include? obj.class.name
357
+ object_address_group obj do
358
+ text "(fields redacted)"
359
+ end
360
360
  end
361
361
  end
362
362
 
363
- def safe_response_representation http_res
364
- if respond_to?(:response_class) && response_class.is_a?(Class) &&
365
- UNSAFE_CLASS_NAMES.include?(response_class.name)
366
- return "#<#{http_res.class.name} (fields redacted)>"
367
- end
368
- http_res.inspect
363
+ class RedactingPP < PP
364
+ include RedactingPPMethods
365
+ end
366
+
367
+ class RedactingSingleLine < PP::SingleLine
368
+ include RedactingPPMethods
369
+ end
370
+
371
+ def safe_pretty_representation obj
372
+ out = ""
373
+ printer = RedactingPP.new out, 79
374
+ printer.guard_inspect_key { printer.pp obj }
375
+ printer.flush
376
+ out << "\n"
377
+ end
378
+
379
+ def safe_single_line_representation obj
380
+ out = ""
381
+ printer = RedactingSingleLine.new out
382
+ printer.guard_inspect_key { printer.pp obj }
383
+ printer.flush
384
+ out
369
385
  end
370
386
 
371
387
  def opencensus_begin_span
@@ -16,7 +16,7 @@ module Google
16
16
  module Apis
17
17
  module Core
18
18
  # Core version
19
- VERSION = "0.9.3".freeze
19
+ VERSION = "0.9.4".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-apis-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-04 00:00:00.000000000 Z
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: representable
@@ -186,7 +186,7 @@ licenses:
186
186
  metadata:
187
187
  bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
188
188
  changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core/CHANGELOG.md
189
- documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.9.3
189
+ documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.9.4
190
190
  source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core
191
191
  post_install_message:
192
192
  rdoc_options: []
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
203
  - !ruby/object:Gem::Version
204
204
  version: '0'
205
205
  requirements: []
206
- rubygems_version: 3.3.14
206
+ rubygems_version: 3.4.2
207
207
  signing_key:
208
208
  specification_version: 4
209
209
  summary: Common utility and base classes for legacy Google REST clients