google-cloud-pubsub 3.0.2 → 3.0.3

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: c47519bfe64a6b8c705b8f6d0f3d89453cabf39bec693e5031fca85fd406c5f1
4
- data.tar.gz: 438769cf4b54c421b353436f9c1f89fb8c6621bb0dfcb02fe02f9fe7b3f4e239
3
+ metadata.gz: a7ddb29c5a0b1ae4716f853f703725e8d8fd0902a978b3ab0141a933b3b4664c
4
+ data.tar.gz: 530004ebcdeac8a4be673a7a40ce7dae3e7771fb8102eb0878336046f7ca6063
5
5
  SHA512:
6
- metadata.gz: 863a808c566bf8c2667387915ab89643f1e587bf6acf572d8ca2ecd4670a2adc9f47ed4fc2de633f91f345abce0ae03b3f7fe9ddaf11bfb9152b0bc556d61d7a
7
- data.tar.gz: 67ccab46b9cdb3c52065e6585f870f49cc0e6892205bde6ec76a314a6570cd00c847d628764e86dbf5088cb4320f5c1ed4bfe68b2f5f6c21938766d410d0f1dc
6
+ metadata.gz: cd222027aab9e9b54f90bac0f1a6aa2269129da691bdea4f620c7133c15f003241a1f118ea8ae4fbb52f21fcbb1cbcfa0c2cabae1e26c330df61507a84316c14
7
+ data.tar.gz: 2d386aea9fe41bb823653d594c6073342187c4fa9ba4651daaf30ea5c45050bdef08f84451c82efc5894ab2471b91db06f315de4276ebad6f1a23c942d965331
data/AUTHENTICATION.md CHANGED
@@ -46,6 +46,12 @@ code.
46
46
 
47
47
  **Credentials** are discovered in the following order:
48
48
 
49
+ > [!WARNING]
50
+ > If you accept a credential configuration (JSON file or Hash) from an
51
+ > external source for authentication to Google Cloud, you must validate it before
52
+ > providing it to a Google API client library. Providing an unvalidated credential
53
+ > configuration to Google APIs can compromise the security of your systems and data.
54
+
49
55
  1. Specify credentials in method arguments
50
56
  2. Specify credentials in configuration
51
57
  3. Discover credentials path in environment variables
@@ -100,11 +106,16 @@ The **Project ID** and the path to the **Credentials JSON** file can be configur
100
106
  instead of placing them in environment variables or providing them as arguments.
101
107
 
102
108
  ```ruby
109
+ require "googleauth"
103
110
  require "google/cloud/pubsub"
104
111
 
112
+ credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
113
+ json_key_io: ::File.open("/path/to/keyfile.json")
114
+ )
115
+
105
116
  Google::Cloud::PubSub.configure do |config|
106
117
  config.project_id = "my-project-id"
107
- config.credentials = "path/to/keyfile.json"
118
+ config.credentials = credentials
108
119
  end
109
120
 
110
121
  client = Google::Cloud::PubSub.new
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 3.0.3 (2025-11-04)
4
+
5
+ #### Documentation
6
+
7
+ * add warning about loading unvalidated credentials ([#32121](https://github.com/googleapis/google-cloud-ruby/issues/32121))
8
+
3
9
  ### 3.0.2 (2025-08-12)
4
10
 
5
11
  #### Bug Fixes
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "3.0.2".freeze
19
+ VERSION = "3.0.3".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
@@ -43,9 +43,24 @@ module Google
43
43
  # @param [String] project_id Project identifier for the Pub/Sub service
44
44
  # you are connecting to. If not present, the default project for the
45
45
  # credentials is used.
46
- # @param [String, Hash, Google::Auth::Credentials] credentials The path to
47
- # the keyfile as a String, the contents of the keyfile as a Hash, or a
48
- # Google::Auth::Credentials object. (See {PubSub::Credentials})
46
+ # @param [Google::Auth::Credentials] credentials A Google::Auth::Credentials
47
+ # object. (See {PubSub::Credentials})
48
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
49
+ # is deprecated. Providing an unvalidated credential configuration to
50
+ # Google APIs can compromise the security of your systems and data.
51
+ #
52
+ # @example
53
+ #
54
+ # # The recommended way to provide credentials is to use the `make_creds` method
55
+ # # on the appropriate credentials class for your environment.
56
+ #
57
+ # require "googleauth"
58
+ #
59
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
60
+ # json_key_io: ::File.open("/path/to/keyfile.json")
61
+ # )
62
+ #
63
+ # pubsub = Google::Cloud::Pubsub.new project_id: "my-project", credentials: credentials
49
64
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
50
65
  # the set of resources and operations that the connection can access.
51
66
  # See [Using OAuth 2.0 to Access Google
@@ -76,10 +76,24 @@ module Google
76
76
  # @param [String] project_id Project identifier for the Pub/Sub service you
77
77
  # are connecting to. If not present, the default project for the
78
78
  # credentials is used.
79
- # @param [String, Hash, Google::Auth::Credentials] credentials The path to
80
- # the keyfile as a String, the contents of the keyfile as a Hash, or a
81
- # Google::Auth::Credentials object.
82
- # (See {Google::Cloud::PubSub::Credentials})
79
+ # @param [Google::Auth::Credentials] credentials A Google::Auth::Credentials
80
+ # object. (See {Google::Cloud::PubSub::Credentials})
81
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
82
+ # is deprecated. Providing an unvalidated credential configuration to
83
+ # Google APIs can compromise the security of your systems and data.
84
+ #
85
+ # @example
86
+ #
87
+ # # The recommended way to provide credentials is to use the `make_creds` method
88
+ # # on the appropriate credentials class for your environment.
89
+ #
90
+ # require "googleauth"
91
+ #
92
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
93
+ # json_key_io: ::File.open("/path/to/keyfile.json")
94
+ # )
95
+ #
96
+ # pubsub = Google::Cloud::Pubsub.new project_id: "my-project", credentials: credentials
83
97
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
84
98
  # set of resources and operations that the connection can access. See
85
99
  # [Using OAuth 2.0 to Access Google
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore