activestorage 8.1.1 → 8.1.2

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: bb21689b523e24daf0e515ac7911747dee19392944ff656959d89aab65600a7e
4
- data.tar.gz: cf47c4e0cfd77341b0671e7613487dcc2786a3c7b8671f4a1f4560b70d1f4c0a
3
+ metadata.gz: b700aaa6ff149a5ce6ff88794c94141d8d7e0895c6561578756727ecf5a3128b
4
+ data.tar.gz: 2eecb99972e95b8495aafbf2458d775bae6a7bcabf4abbc1fc0dd2286b1b140e
5
5
  SHA512:
6
- metadata.gz: fafe3e80aea4b2df4b614cbb6ee03bb0ba14533fa046e35e0f58220ee11e5a21fd0af895f6eadb9530d2db9e46dce63a476e51e6b5af96ac58fb9f0dd21ff1b0
7
- data.tar.gz: 2089114992e5520ad69637d12bd7f7d2ad0478f98b660a79c4c158e903cb210b23f04bbb59a66f380fb62003e5d5084a18b0be6eb649d2df6b2e24710f5e37bc
6
+ metadata.gz: ddb19a88f6c95a4be6d198a7342e830a53d03a24c2f62e63ae2b41d1a94cb863dde34079d168a90e7c661736974691395605f991987ade4ff5164e187ad860e4
7
+ data.tar.gz: 3499297b88322fa207ace2e9f140a53f678f88c7fbe06646d2924c2b29c17e1d8fd8723058382310d307960ba3813733fb5848f232f17c868f09c2d75be6b373
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## Rails 8.1.2 (January 08, 2026) ##
2
+
3
+ * Restore ADC when signing URLs with IAM for GCS
4
+
5
+ ADC was previously used for automatic authorization when signing URLs with IAM.
6
+ Now it is again, but the auth client is memoized so that new credentials are only
7
+ requested when the current ones expire. Other auth methods can now be used
8
+ instead by setting the authorization on `ActiveStorage::Service::GCSService#iam_client`.
9
+
10
+ ```ruby
11
+ ActiveStorage::Blob.service.iam_client.authorization = Google::Auth::ImpersonatedServiceAccountCredentials.new(options)
12
+ ```
13
+
14
+ This is safer than setting `Google::Apis::RequestOptions.default.authorization`
15
+ because it only applies to Active Storage and does not affect other Google API
16
+ clients.
17
+
18
+ *Justin Malčić*
19
+
20
+
1
21
  ## Rails 8.1.1 (October 28, 2025) ##
2
22
 
3
23
  * No changes.
@@ -9,7 +9,7 @@ module ActiveStorage
9
9
  module VERSION
10
10
  MAJOR = 8
11
11
  MINOR = 1
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -144,6 +144,21 @@ module ActiveStorage
144
144
  end
145
145
  end
146
146
 
147
+ # Returns the IAM client used for direct uploads and signed URLs.
148
+ # By default, the authorization for the IAM client is set to
149
+ # {Application Default Credentials}[https://docs.cloud.google.com/docs/authentication/application-default-credentials],
150
+ # fetched once at instantiation time, then refreshed automatically when expired.
151
+ # This can be set to a different value to use other authorization methods.
152
+ #
153
+ # ActiveStorage::Blob.service.iam_client.authorization = Google::Auth::ImpersonatedServiceAccountCredentials.new(options)
154
+ def iam_client
155
+ @iam_client ||= Google::Apis::IamcredentialsV1::IAMCredentialsService.new.tap do |client|
156
+ client.authorization ||= Google::Auth.get_application_default(["https://www.googleapis.com/auth/iam"])
157
+ rescue
158
+ nil
159
+ end
160
+ end
161
+
147
162
  private
148
163
  def private_url(key, expires_in:, filename:, content_type:, disposition:, **)
149
164
  args = {
@@ -211,19 +226,6 @@ module ActiveStorage
211
226
  def signer
212
227
  # https://googleapis.dev/ruby/google-cloud-storage/latest/Google/Cloud/Storage/Project.html#signed_url-instance_method
213
228
  lambda do |string_to_sign|
214
- iam_client = Google::Apis::IamcredentialsV1::IAMCredentialsService.new
215
-
216
- # We explicitly do not set iam_client.authorization so that it uses the
217
- # credentials set by the application at Google::Apis::RequestOptions.default.authorization.
218
- # If the application does not set it, the GCP libraries will automatically
219
- # determine it on each call. This code previously explicitly set the
220
- # authorization to Google::Auth.get_application_default which triggers
221
- # an explicit call to the metadata server - given this lambda is called
222
- # for a significant number of file operations, it can lead to considerable
223
- # tail latencies and even metadata server overloads. Additionally, that
224
- # prevented applications from being able to configure the credentials
225
- # used to perform the signature operation.
226
-
227
229
  request = Google::Apis::IamcredentialsV1::SignBlobRequest.new(
228
230
  payload: string_to_sign
229
231
  )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.1
4
+ version: 8.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,56 +15,56 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 8.1.1
18
+ version: 8.1.2
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 8.1.1
25
+ version: 8.1.2
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: actionpack
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 8.1.1
32
+ version: 8.1.2
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 8.1.1
39
+ version: 8.1.2
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: activejob
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 8.1.1
46
+ version: 8.1.2
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 8.1.1
53
+ version: 8.1.2
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: activerecord
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 8.1.1
60
+ version: 8.1.2
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 8.1.1
67
+ version: 8.1.2
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: marcel
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -192,10 +192,10 @@ licenses:
192
192
  - MIT
193
193
  metadata:
194
194
  bug_tracker_uri: https://github.com/rails/rails/issues
195
- changelog_uri: https://github.com/rails/rails/blob/v8.1.1/activestorage/CHANGELOG.md
196
- documentation_uri: https://api.rubyonrails.org/v8.1.1/
195
+ changelog_uri: https://github.com/rails/rails/blob/v8.1.2/activestorage/CHANGELOG.md
196
+ documentation_uri: https://api.rubyonrails.org/v8.1.2/
197
197
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
198
- source_code_uri: https://github.com/rails/rails/tree/v8.1.1/activestorage
198
+ source_code_uri: https://github.com/rails/rails/tree/v8.1.2/activestorage
199
199
  rubygems_mfa_required: 'true'
200
200
  rdoc_options: []
201
201
  require_paths:
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.6.9
214
+ rubygems_version: 4.0.3
215
215
  specification_version: 4
216
216
  summary: Local and cloud file storage framework.
217
217
  test_files: []