upload_inspector 0.11.0 → 0.11.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +13 -7
- data/lib/upload_inspector/version.rb +1 -1
- metadata +18 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ba8b2b1a96b4bdd11dfdd4535db370b11f42ab1374befafc2b607c6aa39a9ef6
|
|
4
|
+
data.tar.gz: 33a47957bbe8e6b8e51b2a65b2f43b24b280d4cb4ad84a8ca4852dd77b278b70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 342b0d959d1c5ff8978841511c43e98928db925a0402846d103d13a6ecfbc9095eb8d3b151e1a582f5e8be5db54c5f813f8f26a2574f616e0ebab9e3efe35c3a
|
|
7
|
+
data.tar.gz: eb2671ae48c8acbe84b76148d516cef1a3091b284e6ff167ca78d37c496bb429e2b721bd7c5c69eca9ed2861acf9918a18f085e0e9b7766368c556fce4657f54
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -9,19 +9,25 @@ A file is accepted only when its structure is proven to match a known-safe shape
|
|
|
9
9
|
unparsable, encrypted, oversized, or erroring is rejected. Pure Ruby (`marcel`, `rubyzip`), no AV engine,
|
|
10
10
|
no native parsers, nothing is rendered or executed (libvips only for the optional re-encode).
|
|
11
11
|
|
|
12
|
-
> **New in 0.
|
|
13
|
-
>
|
|
14
|
-
> (
|
|
15
|
-
>
|
|
16
|
-
>
|
|
17
|
-
>
|
|
12
|
+
> **New in 0.11: CLI & Framework Integrations.**
|
|
13
|
+
> - `upload_inspector` CLI tool: `check FILE...`, `scan DIR [--recursive]`, and `sanitize FILE --out PATH` with `--types`, `--json` (JSON lines), `--clamav`, and `--no-sandbox`.
|
|
14
|
+
> - Plug-and-play integrations (zero extra dependencies): **Active Storage** signed analyzer (`UploadInspector::ActiveStorageAnalyzer`), **Shrine** plugin (`plugin :upload_inspector`), **CarrierWave** mixin (`include UploadInspector::CarrierWave`), and **Rack** middleware (`UploadInspector::Rack`).
|
|
15
|
+
>
|
|
16
|
+
> **New in 0.10: Malware Scanning Adapters.**
|
|
17
|
+
> Files passing structural checks can be scanned for malware in the same call (`scanner:` option):
|
|
18
|
+
> - `UploadInspector::Scanners::ClamAV`: clamd `INSTREAM` over Unix socket or TCP via stdlib sockets (no extra gem).
|
|
19
|
+
> - `UploadInspector::Scanners::Command`: any scanner binary judged by exit code.
|
|
20
|
+
> - `UploadInspector.check_s3(require_guardduty_tag: true)`: AWS GuardDuty Malware Protection for S3 integration.
|
|
21
|
+
>
|
|
22
|
+
> **Content Disarm & Reconstruction (CDR):**
|
|
23
|
+
> `UploadInspector.sanitize` writes a clean copy keeping only parts known to be safe: strips EXIF with GPS, XMP, comments, unknown chunks/boxes from PNG, JPEG, GIF, WebP, HEIC, AVIF, MP4, QuickTime; rebuilds SVG from an allowlist; neutralizes CSV formulas; optional `reencode: true` with libvips.
|
|
18
24
|
>
|
|
19
25
|
> ```ruby
|
|
20
26
|
> result = UploadInspector.sanitize(params[:file], to: clean_path, allowed_types: UploadInspector::Presets::IMAGES)
|
|
21
27
|
> store(result.sanitized_path) if result.safe?
|
|
22
28
|
> ```
|
|
23
29
|
>
|
|
24
|
-
> See [Sanitizing uploads (CDR)](#sanitizing-uploads-cdr).
|
|
30
|
+
> See [Active Storage, Shrine, CarrierWave, Rack](#active-storage-analyzer-shrine-carrierwave-rack), [Command line](#command-line), [Malware scanning](#malware-scanning), and [Sanitizing uploads (CDR)](#sanitizing-uploads-cdr).
|
|
25
31
|
|
|
26
32
|
> **Not an antivirus.** It blocks structural attack vectors: disguised executables, macros, PDF
|
|
27
33
|
> JavaScript, OLE objects, remote templates, DDE, zip bombs, image polyglots, scripted SVG and
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: upload_inspector
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Minh Doan
|
|
@@ -44,25 +44,20 @@ dependencies:
|
|
|
44
44
|
- - "<"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '4'
|
|
47
|
-
description: '
|
|
48
|
-
(CDR).
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
a Rails validator, a background job, type presets, a report-only shadow mode, ActiveSupport
|
|
62
|
-
instrumentation and helpers to serve files safely (safe file names and response
|
|
63
|
-
headers). Inspection runs in a resource-limited child process. Pure Ruby (libvips
|
|
64
|
-
only for the optional re-encode), not an antivirus. If this gem helps you, a star
|
|
65
|
-
on GitHub is much appreciated! Usage and options: https://akarui2004.github.io/upload_inspector'
|
|
47
|
+
description: 'Fail-closed structural inspection and content disarm and reconstruction
|
|
48
|
+
(CDR) for untrusted uploads. UploadInspector.sanitize writes a clean copy keeping
|
|
49
|
+
only parts known to be safe (strips EXIF/GPS, XMP, comments, unknown chunks/boxes
|
|
50
|
+
from PNG, JPEG, GIF, WebP, HEIC, AVIF, MP4, QuickTime; rebuilds SVG from an allowlist;
|
|
51
|
+
neutralizes CSV formulas; optional ruby-vips re-encode). Structural checks reject
|
|
52
|
+
macros, PDF JavaScript/actions, OLE objects, remote templates, DDE, zip bombs, image
|
|
53
|
+
polyglots, and dangerous filenames (hidden extensions, bidi tricks). Malware scanning
|
|
54
|
+
(0.10): pluggable scanner adapters including ClamAV (clamd INSTREAM via pure-Ruby
|
|
55
|
+
socket), custom command binaries, and AWS GuardDuty Malware Protection for S3 tags.
|
|
56
|
+
Integrations & CLI (0.11): upload_inspector CLI (check, scan directory, sanitize),
|
|
57
|
+
signed Active Storage analyzer, Shrine plugin, CarrierWave mixin, and Rack middleware.
|
|
58
|
+
Works with Rails uploads, S3 presigned URLs, and plain IO in a resource-limited
|
|
59
|
+
child process. Pure Ruby (libvips only for optional re-encode). Usage and options:
|
|
60
|
+
https://akarui2004.github.io/upload_inspector'
|
|
66
61
|
email:
|
|
67
62
|
- minhdpc@gmail.com
|
|
68
63
|
executables:
|
|
@@ -142,6 +137,7 @@ requirements: []
|
|
|
142
137
|
rubygems_version: 3.5.22
|
|
143
138
|
signing_key:
|
|
144
139
|
specification_version: 4
|
|
145
|
-
summary: 'Sanitize (CDR) and fail-closed checks for untrusted
|
|
146
|
-
of images, video, SVG
|
|
140
|
+
summary: 'Sanitize (CDR), malware scanning, CLI, and fail-closed checks for untrusted
|
|
141
|
+
uploads: clean copies of images, video, SVG, CSV; PDF, Office, zip verified; Active
|
|
142
|
+
Storage, Shrine, CarrierWave, Rack.'
|
|
147
143
|
test_files: []
|