Skip to content

v3.0.0 — full remediation (security, auto-crop & editor rewrites, off-thread, API cleanup)#33

Merged
Nardo86 merged 3 commits into
mainfrom
revamp/v3-remediation
Jun 11, 2026
Merged

v3.0.0 — full remediation (security, auto-crop & editor rewrites, off-thread, API cleanup)#33
Nardo86 merged 3 commits into
mainfrom
revamp/v3-remediation

Conversation

@Nardo86

@Nardo86 Nardo86 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Comprehensive review + remediation. Breaking — see MIGRATION.md. Single source of truth at 3.0.0.

Highlights

  • Security: downloadManualFromUrl hardened (HTTPS-only, size cap + streaming, timeout, SSRF blocklist, redirect re-validation, magic-byte validation); filename sanitization + path.isWithin (path-traversal fix); scoped storage (dropped MANAGE_EXTERNAL_STORAGE).
  • Auto-crop rewritten: Otsu white-blob detection + real homography/bilinear warp; removed the broken Canny path (shared-List.filled aliasing, recursion, fake affine "perspective", 100 ms no-op timeout).
  • Editor (Auto-crop intelligente per fogli bianchi su sfondo scuro #30/Aggiungere tasto reset crop #31/Rotazione deve resettare il crop e mostrare immagine intera #32) rewritten with a declarative state model: rotation keeps the crop tool + re-detects edges; reliable reset-crop; format change no longer auto-commits; no cumulative JPEG re-encode.
  • API (breaking): ColorFilterDocumentColorFilter; trimmed barrel; DocumentScannerService instance + .instance; QR methods take BuildContext; documentFormat serialized.
  • Crash/leak: mounted guards, dispose PdfController, errorBuilder, no force-unwrap in multi-page finalize, monotonic page ids.
  • Perf: real off-thread processing via compute.
  • Build/CI: removed unused printing/file_picker, camera ^0.12.0+1, flutter >=3.32.0; new ci.yml (format/analyze/test/publish-dry-run/pana + build_runner mock regen); dependabot.yml; tag==pubspec assert.
  • Tests: real auto-crop accuracy, download security, filename traversal, model round-trip, %PDF output.

Notes for reviewers

🤖 Generated with Claude Code

Eros Nardi and others added 3 commits June 11, 2026 09:17
…f-thread, API cleanup

BREAKING CHANGE: see MIGRATION.md. Single source of truth at 3.0.0.

Versioning/install:
- Align pubspec/README/CHANGELOG to v3.0.0; fix README install ref (was the
  non-existent v2.2.0 → every `pub get` failed); CI asserts tag == pubspec.

Security:
- downloadManualFromUrl: HTTPS-only (opt-in cleartext), streamed size cap,
  timeout, SSRF host blocklist, per-redirect re-validation, magic-byte checks.
- storage_helper: sanitize filenames + path.isWithin (path-traversal fix);
  scoped app-specific storage; drop MANAGE_EXTERNAL_STORAGE.

Algorithms:
- Rewrite auto_cropper: Otsu white-blob detection + real homography+bilinear
  warp (pure Dart). Remove broken Canny path (List.filled row aliasing,
  recursion, fake affine "perspective", 100ms no-op timeout).
- detectDocumentEdges now actually detects (off the UI thread).

Editor (#30/#31/#32):
- Rewrite ImageEditingWidget with a declarative state model rendered from the
  raw image: rotation keeps crop available + re-detects; reliable reset-crop;
  format change no longer auto-commits; no cumulative JPEG re-encode.

API (breaking):
- ColorFilter → DocumentColorFilter; trim barrel to public surface;
  DocumentScannerService instance + .instance (no hard singleton); QR methods
  take BuildContext; serialize documentFormat.

Crash/leak: mounted guards; dispose PdfController; Image.memory errorBuilder;
no force-unwrap in multi-page finalize; empty pdfPath handled; monotonic page ids.

Perf: real off-thread processing via compute (ImageProcessingIsolateService).

Build/deps: drop unused printing & file_picker; camera ^0.12.0+1; flutter
>=3.32.0; align example lints; stop committing package pubspec.lock; add ci.yml
(format/analyze/test/publish dry-run/pana + build_runner mock regen) and
dependabot.yml.

Tests: add real auto-crop accuracy, download security (SSRF/size/magic-byte),
filename traversal, model round-trip, and %PDF output coverage; realign editor
widget test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ional publish dry-run

- Add missing `package:flutter/foundation.dart` import for compute in
  document_scanner_widget (was relying on material, which doesn't export it).
- Apply `dart format` across the codebase.
- Clear analyzer warning (unused import) and tidy infos (curly braces, redundant
  imports, await-on-non-future).
- Regenerate mockito mocks for the new service signatures.
- Make the CI publish dry-run informational (package is distributed via git,
  not pub.dev).

Validated locally with Flutter 3.32.5: format clean, analyze clean (infos only),
all tests pass (224 passed, 7 skipped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Nardo86
Nardo86 merged commit a9018fa into main Jun 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant