activestorage-hotcell-server 1.0.0 → 1.1.0
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 +4 -4
- data/lib/active_storage/hot_cell/server/previewers/pdf/mutool.rb +2 -1
- data/lib/active_storage/hot_cell/server/previewers/pdf/poppler.rb +1 -1
- data/lib/active_storage/hot_cell/server/tool_operation.rb +12 -3
- data/lib/active_storage/hot_cell/server/transformers/image/vips.rb +2 -1
- data/lib/active_storage/hot_cell/server/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 564a7c12f6ca3517a73524b53f1fe3a4e2eeb8227def645557cc840b0a6fedca
|
|
4
|
+
data.tar.gz: b40a4dedbf29c4c7164670fda7466fe40c54740317d5d740940279cf15149aee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 276349261e10c73ec526f98ac2cfa5883a350b5dd943f833a523b8af626fb647ee3de51acac42cd83d55c36d3e23d489a09860a0188e81f2399032963fc8e3ed
|
|
7
|
+
data.tar.gz: 6770cd3d3e91768735583b5583045dbfd5b7005702955dffe1ef8a56af26f7cdb7cec7848c0fd74c2f1ecf76d7e98323ceccd57f0df1f9f9fca4919a1f5c36a2
|
|
@@ -22,7 +22,8 @@ module ActiveStorage
|
|
|
22
22
|
# separate change.
|
|
23
23
|
def render(source, destination, page:, resolution:)
|
|
24
24
|
run! "mutool", "draw", "-F", "png", "-r", resolution.to_s, "-o", destination.path,
|
|
25
|
-
source.fd_path, page.to_s, pass: [ source.to_io ]
|
|
25
|
+
source.fd_path, page.to_s, pass: [ source.to_io ],
|
|
26
|
+
causes: { /cannot authenticate password/ => ProtectedDocument }
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def tool
|
|
@@ -22,7 +22,7 @@ module ActiveStorage
|
|
|
22
22
|
def render(source, destination, page:, resolution:)
|
|
23
23
|
run! "pdftoppm", "-png", "-singlefile", "-cropbox", "-r", resolution.to_s,
|
|
24
24
|
"-f", page.to_s, "-l", page.to_s, source.fd_path, destination.path,
|
|
25
|
-
pass: [ source.to_io ]
|
|
25
|
+
pass: [ source.to_io ], causes: { /Incorrect password/ => ProtectedDocument }
|
|
26
26
|
|
|
27
27
|
destination.adopt destination.path(extension: "png")
|
|
28
28
|
end
|
|
@@ -20,16 +20,25 @@ module ActiveStorage
|
|
|
20
20
|
# UnreadableInput is always in the rescue list, and this descends from it.
|
|
21
21
|
class UnreadableDocument < ::HotCell::UnreadableInput; end
|
|
22
22
|
|
|
23
|
+
# The document demands credentials the cell does not have.
|
|
24
|
+
class ProtectedDocument < UnreadableDocument
|
|
25
|
+
def self.cause
|
|
26
|
+
::HotCell::Codes::PROTECTED
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
23
30
|
private
|
|
24
31
|
# Runs the tool with unsetenv_others and a written environment, and turns a non-zero exit into
|
|
25
32
|
# `unreadable`. The tool's own stderr is the only useful diagnostic, and it is attacker-influenced,
|
|
26
33
|
# so it is capped and scrubbed on its way onto the wire like any other error message.
|
|
27
|
-
|
|
34
|
+
# `causes` maps stderr patterns to the UnreadableDocument subclass to raise instead.
|
|
35
|
+
def run!(*command, pass: [], causes: {})
|
|
28
36
|
result = run_tool(*command, pass: pass)
|
|
29
37
|
return result if result.ok?
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
error = causes.detect { |pattern, _| result.err.to_s.match?(pattern) }&.last || UnreadableDocument
|
|
40
|
+
raise error, "#{command.first} exited #{result.status.exitstatus}: " \
|
|
41
|
+
"#{result.err.to_s.strip[0, 200]}"
|
|
33
42
|
end
|
|
34
43
|
|
|
35
44
|
# An empty output means the tool said it succeeded and produced nothing, which the client would
|
|
@@ -10,7 +10,8 @@ module ActiveStorage
|
|
|
10
10
|
module Image
|
|
11
11
|
# What `ActiveStorage::Transformers::ImageProcessingTransformer` does, moved out of the application,
|
|
12
12
|
# and deliberately nothing more: the transformations and the format reach ImageProcessing exactly as
|
|
13
|
-
# Rails hands them over
|
|
13
|
+
# Rails hands them over, except that the client sends a web image's format as its content type's
|
|
14
|
+
# canonical extension, so `jfif` arrives as `jpg` (#84).
|
|
14
15
|
#
|
|
15
16
|
# There is no allowlist here, and that mirrors Rails: the vips path validates exactly one thing —
|
|
16
17
|
# `combine_options` is refused — and `ActiveStorage.supported_image_processing_methods` is enforced by
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activestorage-hotcell-server
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Dalessio
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 1.
|
|
18
|
+
version: 1.1.0
|
|
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: 1.
|
|
25
|
+
version: 1.1.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: image_processing
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,8 +99,8 @@ licenses:
|
|
|
99
99
|
- MIT
|
|
100
100
|
metadata:
|
|
101
101
|
homepage_uri: https://github.com/basecamp/hotcell
|
|
102
|
-
source_code_uri: https://github.com/basecamp/hotcell/tree/v1.
|
|
103
|
-
changelog_uri: https://github.com/basecamp/hotcell/blob/v1.
|
|
102
|
+
source_code_uri: https://github.com/basecamp/hotcell/tree/v1.1.0/activestorage-hotcell-server
|
|
103
|
+
changelog_uri: https://github.com/basecamp/hotcell/blob/v1.1.0/CHANGELOG.md
|
|
104
104
|
documentation_uri: https://basecamp.github.io/hotcell/
|
|
105
105
|
bug_tracker_uri: https://github.com/basecamp/hotcell/issues
|
|
106
106
|
rubygems_mfa_required: 'true'
|
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
119
|
version: '0'
|
|
120
120
|
requirements: []
|
|
121
|
-
rubygems_version: 4.0.
|
|
121
|
+
rubygems_version: 4.0.16
|
|
122
122
|
specification_version: 4
|
|
123
123
|
summary: The operations a cell runs on behalf of Active Storage.
|
|
124
124
|
test_files: []
|