effective_storage 0.2.0 → 0.2.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5231ce8c007d3502f5048efcfff027ef485bf6cdab01e68f054f3e51b242a4a7
|
4
|
+
data.tar.gz: f027bcaf1d992287ad769c7f507856d335000e0ce94bb5e6b55209f319b6953c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27c7686f989ab6a4fea7c3ad136af23cb6e2c0d85c4eb0e265739e72567efaa2a34199c1dd966b2ed588f5186e5e0eccc46f69631ff03bdc1295875c83ecfc7f
|
7
|
+
data.tar.gz: 3f39bb8e38203f6aa834c793613093502405afb25a7e0137fcbd817112bb835083c26ce205e99d8c72e5d8594fdbdd9bc676bc4579136410a058edb20a54e2a2
|
@@ -15,7 +15,7 @@ module ActiveStorageAuthorization
|
|
15
15
|
extend ActiveSupport::Concern
|
16
16
|
|
17
17
|
included do
|
18
|
-
rescue_from(
|
18
|
+
rescue_from(Effective::UnauthorizedStorageException, with: :unauthorized_active_storage_request)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Authorize ActiveStorage DiskController downloads
|
@@ -68,7 +68,7 @@ module ActiveStorageAuthorization
|
|
68
68
|
return true if @blob.attachments.any? { |attachment| authorized_attachment_download?(attachment) }
|
69
69
|
|
70
70
|
# Otherwise raise a 403 Forbidden and block the download
|
71
|
-
head :
|
71
|
+
head(:forbidden, 'X-Robots-Tag': 'noindex')
|
72
72
|
|
73
73
|
# Raise an exception to log unauthorized request
|
74
74
|
raise_exception()
|
@@ -88,7 +88,7 @@ module ActiveStorageAuthorization
|
|
88
88
|
|
89
89
|
resolution = "Missing can?(:show, #{(resource || record || attachment).class.name})"
|
90
90
|
|
91
|
-
raise(error + '. ' + resolution)
|
91
|
+
raise Effective::UnauthorizedStorageException.new(error + '. ' + resolution)
|
92
92
|
end
|
93
93
|
|
94
94
|
# This is a file that was drag & drop or inserted into the article editor
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- app/models/concerns/active_storage_authorization.rb
|
140
140
|
- app/models/concerns/active_storage_blob_extension.rb
|
141
141
|
- app/models/effective/active_storage_extension.rb
|
142
|
+
- app/models/effective/unauthorized_storage_exception.rb
|
142
143
|
- app/views/admin/storage/_datatable_actions.html.haml
|
143
144
|
- app/views/admin/storage/index.html.haml
|
144
145
|
- config/effective_storage.rb
|