google-cloud-storage 1.57.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: 2ba3f85cab0b6bd616c783973578f6f3610d23bd9679e74a42f77eda3e5b7b20
4
- data.tar.gz: c5399ac6a4e32d290f3c112ee435696d176c4afe329213acbca36cc629a1f647
3
+ metadata.gz: 86a7f1131dc71cb9b5db56afce6c3b9e25a9a21544500367cdcd39ac8eb8ef46
4
+ data.tar.gz: 070b6c33b09fb8af9eb8a59f5d074b3b5929fd6d61233f1cf738ac4b6c0809a2
5
5
  SHA512:
6
- metadata.gz: 3655fcc4fe59d97a956c1dd4ab3d98abdcf406261b2bb4d30a3c300d4c64aa37d2c7262c99484befa1538758ba4240b5e0a51d0ed753066a850db3d82a74b9ea
7
- data.tar.gz: 9f0c4e40ecc8f906259d2a2c027b419c464519b65b83309e574f5cd4f7bc9eae55dd5c0735798e96be8b5696af75e315f1ee299dc4e91cba374c6119b3258e78
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,11 @@
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
+
3
9
  ### 1.57.0 (2025-08-15)
4
10
 
5
11
  #### 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"
@@ -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 = [
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.57.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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.57.0
4
+ version: 1.57.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore