google-cloud-storage 1.56.0 → 1.57.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: 37d818583b06d396a9b237a24187b677bb5261c31e3a139714ef4f8fd868e4ec
4
- data.tar.gz: d8ed3812b144e20a747c79147fd26642a7f8d4c9a5e017e925144f9e33afa717
3
+ metadata.gz: 86a7f1131dc71cb9b5db56afce6c3b9e25a9a21544500367cdcd39ac8eb8ef46
4
+ data.tar.gz: 070b6c33b09fb8af9eb8a59f5d074b3b5929fd6d61233f1cf738ac4b6c0809a2
5
5
  SHA512:
6
- metadata.gz: 519fe7bc2cf869c804bbfac6ce300b300f99f065a594673d36cf344b3cacff1ff1fb4eec086903ddcbc4a4be108c66082f05d539ef9508570d43ec9c678893be
7
- data.tar.gz: a82b8ddd47b64d71c5035491a87021912419213538a0b2105de3facf4a09aac927379b1c980e5612629426cc7e0ec5de3590480fcdc265fb1bdf172f28d1be05
6
+ metadata.gz: 9c6370f20e62e933a41fbab067870c29c4e28bde041c97e53edb7a9e0280d1a029bf8d6ce238877cf14114b202535e7c9d0407192dbbfb4af8d071d9a3c3f575
7
+ data.tar.gz: 7da8c7b4afed6c3b0504c33c14bac1ce04a43e3740119af18c7c30c4eca540287da4e59798f6358f4e15098ab1476c09dcd9377c988ed063f47ff5846689eb84
data/AUTHENTICATION.md CHANGED
@@ -28,6 +28,12 @@ providing **Project ID** and **Service Account Credentials** directly in code.
28
28
 
29
29
  **Credentials** are discovered in the following order:
30
30
 
31
+ > [!WARNING]
32
+ > If you accept a credential configuration (JSON file or Hash) from an
33
+ > external source for authentication to Google Cloud, you must validate it before
34
+ > providing it to a Google API client library. Providing an unvalidated credential
35
+ > configuration to Google APIs can compromise the security of your systems and data.
36
+
31
37
  1. Specify credentials in method arguments
32
38
  2. Specify credentials in configuration
33
39
  3. Discover credentials path in environment variables
@@ -81,11 +87,17 @@ The **Project ID** and the path to the **Credentials JSON** file can be configur
81
87
  instead of placing them in environment variables or providing them as arguments.
82
88
 
83
89
  ```ruby
90
+ require "googleauth"
84
91
  require "google/cloud/storage"
85
92
 
93
+ credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
94
+ json_key_io: ::File.open("/path/to/keyfile.json"),
95
+ scope: "https://www.googleapis.com/auth/devstorage.full_control"
96
+ )
97
+
86
98
  Google::Cloud::Storage.configure do |config|
87
99
  config.project_id = "my-project-id"
88
- config.credentials = "path/to/keyfile.json"
100
+ config.credentials = credentials
89
101
  end
90
102
 
91
103
  storage = Google::Cloud::Storage.new
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Release History
2
2
 
3
+ ### 1.57.1 (2025-11-04)
4
+
5
+ #### Documentation
6
+
7
+ * add warning about loading unvalidated credentials ([#31776](https://github.com/googleapis/google-cloud-ruby/issues/31776))
8
+
9
+ ### 1.57.0 (2025-08-15)
10
+
11
+ #### Features
12
+
13
+ * Require Ruby 3.1 or later ([#30765](https://github.com/googleapis/google-cloud-ruby/issues/30765))
14
+ * Support for using Faraday for HTTP requests ([#30759](https://github.com/googleapis/google-cloud-ruby/issues/30759))
15
+
3
16
  ### 1.56.0 (2025-04-21)
4
17
 
5
18
  #### Features
data/OVERVIEW.md CHANGED
@@ -14,11 +14,17 @@ your code or via environment variables. Read more about the options for
14
14
  connecting in the {file:AUTHENTICATION.md Authentication Guide}.
15
15
 
16
16
  ```ruby
17
+ require "googleauth"
17
18
  require "google/cloud/storage"
18
19
 
20
+ credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
21
+ json_key_io: ::File.open("/path/to/keyfile.json"),
22
+ scope: "https://www.googleapis.com/auth/devstorage.full_control"
23
+ )
24
+
19
25
  storage = Google::Cloud::Storage.new(
20
26
  project_id: "my-project",
21
- credentials: "/path/to/keyfile.json"
27
+ credentials: credentials
22
28
  )
23
29
 
24
30
  bucket = storage.bucket "my-bucket"
@@ -531,14 +537,23 @@ created and owns the topic.)
531
537
  require "google/cloud/pubsub"
532
538
  require "google/cloud/storage"
533
539
 
534
- pubsub = Google::Cloud::Pubsub.new
540
+ pubsub = Google::Cloud::PubSub.new
535
541
  storage = Google::Cloud::Storage.new
536
542
 
537
- topic = pubsub.create_topic "my-topic"
538
- topic.policy do |p|
539
- p.add "roles/pubsub.publisher",
540
- "serviceAccount:#{storage.service_account_email}"
541
- end
543
+ topic_admin = pubsub.topic_admin
544
+ topic_path = pubsub.topic_path "my-topic"
545
+ topic = topic_admin.create_topic name: topic_path
546
+
547
+ policy = {
548
+ bindings: [
549
+ {
550
+ role: "roles/pubsub.publisher",
551
+ members: ["serviceAccount:#{storage.service_account_email}"]
552
+ }
553
+ ]
554
+ }
555
+
556
+ pubsub.iam.set_iam_policy resource: topic_path, policy: policy
542
557
 
543
558
  bucket = storage.bucket "my-bucket"
544
559
 
@@ -352,7 +352,7 @@ module Google
352
352
  def auth! if_metageneration_match: nil
353
353
  update_predefined_acl! "authenticatedRead", if_metageneration_match: if_metageneration_match
354
354
  end
355
- alias authenticatedRead! auth!
355
+ alias authenticatedRead! auth! # rubocop:disable Naming/MethodName
356
356
  alias auth_read! auth!
357
357
  alias authenticated! auth!
358
358
  alias authenticated_read! auth!
@@ -390,7 +390,7 @@ module Google
390
390
  def project_private! if_metageneration_match: nil
391
391
  update_predefined_acl! "projectPrivate", if_metageneration_match: if_metageneration_match
392
392
  end
393
- alias projectPrivate! project_private!
393
+ alias projectPrivate! project_private! # rubocop:disable Naming/MethodName
394
394
 
395
395
  ##
396
396
  # Convenience method to apply the `publicRead` predefined ACL
@@ -408,7 +408,7 @@ module Google
408
408
  def public! if_metageneration_match: nil
409
409
  update_predefined_acl! "publicRead", if_metageneration_match: if_metageneration_match
410
410
  end
411
- alias publicRead! public!
411
+ alias publicRead! public! # rubocop:disable Naming/MethodName
412
412
  alias public_read! public!
413
413
 
414
414
  # Convenience method to apply the `publicReadWrite` predefined ACL
@@ -426,7 +426,7 @@ module Google
426
426
  def public_write! if_metageneration_match: nil
427
427
  update_predefined_acl! "publicReadWrite", if_metageneration_match: if_metageneration_match
428
428
  end
429
- alias publicReadWrite! public_write!
429
+ alias publicReadWrite! public_write! # rubocop:disable Naming/MethodName
430
430
 
431
431
  protected
432
432
 
@@ -718,7 +718,7 @@ module Google
718
718
  def auth! if_metageneration_match: nil
719
719
  update_predefined_default_acl! "authenticatedRead", if_metageneration_match: if_metageneration_match
720
720
  end
721
- alias authenticatedRead! auth!
721
+ alias authenticatedRead! auth! # rubocop:disable Naming/MethodName
722
722
  alias auth_read! auth!
723
723
  alias authenticated! auth!
724
724
  alias authenticated_read! auth!
@@ -739,7 +739,7 @@ module Google
739
739
  def owner_full! if_metageneration_match: nil
740
740
  update_predefined_default_acl! "bucketOwnerFullControl", if_metageneration_match: if_metageneration_match
741
741
  end
742
- alias bucketOwnerFullControl! owner_full!
742
+ alias bucketOwnerFullControl! owner_full! # rubocop:disable Naming/MethodName
743
743
 
744
744
  ##
745
745
  # Convenience method to apply the default `bucketOwnerRead`
@@ -757,7 +757,7 @@ module Google
757
757
  def owner_read! if_metageneration_match: nil
758
758
  update_predefined_default_acl! "bucketOwnerRead", if_metageneration_match: if_metageneration_match
759
759
  end
760
- alias bucketOwnerRead! owner_read!
760
+ alias bucketOwnerRead! owner_read! # rubocop:disable Naming/MethodName
761
761
 
762
762
  ##
763
763
  # Convenience method to apply the default `private`
@@ -792,7 +792,7 @@ module Google
792
792
  def project_private! if_metageneration_match: nil
793
793
  update_predefined_default_acl! "projectPrivate", if_metageneration_match: if_metageneration_match
794
794
  end
795
- alias projectPrivate! project_private!
795
+ alias projectPrivate! project_private! # rubocop:disable Naming/MethodName
796
796
 
797
797
  ##
798
798
  # Convenience method to apply the default `publicRead`
@@ -810,7 +810,7 @@ module Google
810
810
  def public! if_metageneration_match: nil
811
811
  update_predefined_default_acl! "publicRead", if_metageneration_match: if_metageneration_match
812
812
  end
813
- alias publicRead! public!
813
+ alias publicRead! public! # rubocop:disable Naming/MethodName
814
814
  alias public_read! public!
815
815
 
816
816
  protected
@@ -25,18 +25,29 @@ module Google
25
25
  # Storage API.
26
26
  #
27
27
  # @example
28
+ # # The recommended way to provide credentials is to use the `make_creds` method
29
+ # # on the appropriate credentials class for your environment.
30
+ #
31
+ # require "googleauth"
28
32
  # require "google/cloud/storage"
29
33
  #
30
- # keyfile = "/path/to/keyfile.json"
31
- # creds = Google::Cloud::Storage::Credentials.new keyfile
34
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
35
+ # json_key_io: ::File.open("/path/to/keyfile.json"),
36
+ # scope: "https://www.googleapis.com/auth/devstorage.full_control"
37
+ # )
32
38
  #
33
39
  # storage = Google::Cloud::Storage.new(
34
40
  # project_id: "my-project",
35
- # credentials: creds
41
+ # credentials: credentials
36
42
  # )
37
43
  #
38
44
  # storage.project_id #=> "my-project"
39
45
  #
46
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
47
+ # external source for authentication to Google Cloud, you must validate it before
48
+ # providing it to a Google API client library. Providing an unvalidated credential
49
+ # configuration to Google APIs can compromise the security of your systems and data.
50
+ #
40
51
  class Credentials < Google::Auth::Credentials
41
52
  SCOPE = ["https://www.googleapis.com/auth/devstorage.full_control"].freeze
42
53
  PATH_ENV_VARS = [
@@ -335,7 +335,7 @@ module Google
335
335
  if_metageneration_match: if_metageneration_match,
336
336
  if_metageneration_not_match: if_metageneration_not_match
337
337
  end
338
- alias authenticatedRead! auth!
338
+ alias authenticatedRead! auth! # rubocop:disable Naming/MethodName
339
339
  alias auth_read! auth!
340
340
  alias authenticated! auth!
341
341
  alias authenticated_read! auth!
@@ -382,7 +382,7 @@ module Google
382
382
  if_metageneration_match: if_metageneration_match,
383
383
  if_metageneration_not_match: if_metageneration_not_match
384
384
  end
385
- alias bucketOwnerFullControl! owner_full!
385
+ alias bucketOwnerFullControl! owner_full! # rubocop:disable Naming/MethodName
386
386
 
387
387
  ##
388
388
  # Convenience method to apply the `bucketOwnerRead` predefined ACL
@@ -426,7 +426,7 @@ module Google
426
426
  if_metageneration_match: if_metageneration_match,
427
427
  if_metageneration_not_match: if_metageneration_not_match
428
428
  end
429
- alias bucketOwnerRead! owner_read!
429
+ alias bucketOwnerRead! owner_read! # rubocop:disable Naming/MethodName
430
430
 
431
431
  ##
432
432
  # Convenience method to apply the `private` predefined ACL
@@ -513,7 +513,7 @@ module Google
513
513
  if_metageneration_match: if_metageneration_match,
514
514
  if_metageneration_not_match: if_metageneration_not_match
515
515
  end
516
- alias projectPrivate! project_private!
516
+ alias projectPrivate! project_private! # rubocop:disable Naming/MethodName
517
517
 
518
518
  ##
519
519
  # Convenience method to apply the `publicRead` predefined ACL
@@ -557,7 +557,7 @@ module Google
557
557
  if_metageneration_match: if_metageneration_match,
558
558
  if_metageneration_not_match: if_metageneration_not_match
559
559
  end
560
- alias publicRead! public!
560
+ alias publicRead! public! # rubocop:disable Naming/MethodName
561
561
  alias public_read! public!
562
562
 
563
563
  protected
@@ -168,10 +168,10 @@ module Google
168
168
  # puts binding.role
169
169
  # end
170
170
  #
171
- def each &block
171
+ def each(&)
172
172
  return enum_for :each unless block_given?
173
173
 
174
- @bindings.each(&block)
174
+ @bindings.each(&)
175
175
  end
176
176
 
177
177
  ##
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.56.0".freeze
19
+ VERSION = "1.57.1".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -42,9 +42,12 @@ module Google
42
42
  # @param [String] project_id Project identifier for the Storage service
43
43
  # you are connecting to. If not present, the default project for the
44
44
  # credentials is used.
45
- # @param [String, Hash, Google::Auth::Credentials] credentials The path to
46
- # the keyfile as a String, the contents of the keyfile as a Hash, or a
47
- # Google::Auth::Credentials object. (See {Storage::Credentials})
45
+ # @param [Google::Auth::Credentials] credentials A Google::Auth::Credentials
46
+ # object. (See {Storage::Credentials})
47
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of
48
+ # credentials is deprecated. Providing an unvalidated credential
49
+ # configuration to Google APIs can compromise the security of your
50
+ # systems and data.
48
51
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
49
52
  # the set of resources and operations that the connection can access.
50
53
  # See [Using OAuth 2.0 to Access Google
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.56.0
4
+ version: 1.57.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
8
8
  - Chris Smith
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-21 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: google-apis-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0.18'
34
+ - - "<"
32
35
  - !ruby/object:Gem::Version
33
- version: '0.13'
36
+ version: '2'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0.18'
44
+ - - "<"
39
45
  - !ruby/object:Gem::Version
40
- version: '0.13'
46
+ version: '2'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: google-apis-iamcredentials_v1
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +134,14 @@ dependencies:
128
134
  requirements:
129
135
  - - "~>"
130
136
  - !ruby/object:Gem::Version
131
- version: 1.30.0
137
+ version: 1.31.1
132
138
  type: :development
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
135
141
  requirements:
136
142
  - - "~>"
137
143
  - !ruby/object:Gem::Version
138
- version: 1.30.0
144
+ version: 1.31.1
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: minitest
141
147
  requirement: !ruby/object:Gem::Requirement
@@ -331,14 +337,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
331
337
  requirements:
332
338
  - - ">="
333
339
  - !ruby/object:Gem::Version
334
- version: 3.0.0
340
+ version: 3.1.0
335
341
  required_rubygems_version: !ruby/object:Gem::Requirement
336
342
  requirements:
337
343
  - - ">="
338
344
  - !ruby/object:Gem::Version
339
345
  version: '0'
340
346
  requirements: []
341
- rubygems_version: 3.6.5
347
+ rubygems_version: 3.6.9
342
348
  specification_version: 4
343
349
  summary: API Client library for Google Cloud Storage
344
350
  test_files: []