Refactor: extract the repeated --allow-dangerous validation preamble
Beta tool for embedding and verifying digital authenticity in images,
Status: Beta
Brought to you by:
redosan
Originally created by: Redo-San
Six CLI command files repeat the same ~10-line preamble: resolve path, read allowDangerous, try { validateFile(...) } catch { console.error(...); if message includes "Blocked dangerous file type" print a hint; process.exit(1); }.
cli/commands/c2pa.js:190-199, fingerprint.js:115-126, forensic.js:137-147, metadata.js:71-82, pixel_injection.js:91-100, watermark.js:325-335
Add an exported helper next to the already-exported validateFile at cli/utils.js:842, and call it from all six.
Note the hint wording is inconsistent today: 4 files say "Use --allow-dangerous to bypass" while fingerprint.js:123 and watermark.js:332 say "...bypass file validation". Pick one wording for all six.
npm run test:cli passes.node cli/index.js fingerprint <some.exe> still prints Validation failed: … and exits 1; with --allow-dangerous it proceeds.Blocked dangerous file type check.