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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7534f7c438934bdb7a41d994d0246b1dd57a81ebdf39fe971ea29eb38d4f1eab
4
- data.tar.gz: 15c7ea16a25019dd9b392efcc08ec3a33944f0405cc5c2fa5cdd41c408766d80
3
+ metadata.gz: ba8b2b1a96b4bdd11dfdd4535db370b11f42ab1374befafc2b607c6aa39a9ef6
4
+ data.tar.gz: 33a47957bbe8e6b8e51b2a65b2f43b24b280d4cb4ad84a8ca4852dd77b278b70
5
5
  SHA512:
6
- metadata.gz: fe4549d0acce99c7f95b83220a190764caf66d812a691f27c5b48f106e171cea5f49ed936d3783b60547321f2b024a1fe65051e1e271e5cf37ea47c9517491fc
7
- data.tar.gz: dee6f4d1bd34110fb51659415ceeedfbedae1662c78837a361f884e27743f1fdf109f530dc31adc4b70791237d18e53bcb82c1e3786e2ae1df460a519722cfda
6
+ metadata.gz: 342b0d959d1c5ff8978841511c43e98928db925a0402846d103d13a6ecfbc9095eb8d3b151e1a582f5e8be5db54c5f813f8f26a2574f616e0ebab9e3efe35c3a
7
+ data.tar.gz: eb2671ae48c8acbe84b76148d516cef1a3091b284e6ff167ca78d37c496bb429e2b721bd7c5c69eca9ed2861acf9918a18f085e0e9b7766368c556fce4657f54
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.1
4
+
5
+ - Update the description, and the github page for version 0.10.0 and 0.11.0
6
+
3
7
  ## 0.11.0
4
8
 
5
9
  - `upload_inspector` command: `check FILE...`, `scan DIR [--recursive]` to re-check stored
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.9: `UploadInspector.sanitize`.** Writes a clean copy that keeps only the parts known
13
- > to be safe: EXIF with GPS location, XMP, comments, unknown chunks and payloads hidden in them
14
- > (a `<?php` web shell in a JPEG comment, a zip in an MP4 box) are removed from PNG, JPEG, GIF,
15
- > WebP, HEIC, AVIF, MP4 and QuickTime; SVG is rebuilt from an allowlist; CSV formulas can be
16
- > neutralized; `reencode: true` re-encodes images through libvips. The copy is checked again
17
- > before it is written.
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UploadInspector
4
- VERSION = '0.11.0'
4
+ VERSION = '0.11.1'
5
5
  end
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.0
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: 'NEW in 0.9: UploadInspector.sanitize, content disarm and reconstruction
48
- (CDR). It writes a clean copy of an upload keeping only the parts known to be safe:
49
- EXIF with GPS location, XMP, comments, unknown chunks and payloads hidden in them
50
- (a PHP web shell in a JPEG comment, a zip in an MP4 box) are removed from PNG, JPEG,
51
- GIF, WebP, HEIC, AVIF, MP4 and QuickTime; SVG is rebuilt from an allowlist; CSV
52
- formulas can be neutralized; optional full re-encode through ruby-vips. The copy
53
- is checked again before it is written. Fail-closed checks for untrusted uploads:
54
- the real file type must be allowlisted and match the extension, and PDF, Office
55
- (OOXML, 97-2003, RTF, OpenDocument), zip, SVG, PNG, JPEG, GIF, WebP, HEIC, AVIF,
56
- MP4 and QuickTime files are verified structurally (scripts, macros, external links,
57
- appended data, zip and pixel bombs are rejected), as are CSV/TXT files (UTF-8 only,
58
- no binary, no HTML or script tags, no CSV injection). File names with hidden extensions
59
- (shell.php.jpg) or bidi tricks are rejected. Works with file paths, Rails uploads,
60
- Active Storage, any IO and S3 objects uploaded through presigned URLs, and ships
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 uploads: clean copies
146
- of images, video, SVG and CSV; PDF, Office, zip and text verified.'
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: []