# Export Package Preflight v0.1.0

Free, manual n8n module. The workflow code and accompanying documentation are licensed under the [MIT License](n8n-export-package-preflight-LICENSE.txt); see [rights and scope notice](n8n-export-package-preflight-NOTICE.md). Screenshots, image fixtures, supplied documents and third-party marks/software retain their separate rights. The premium commercial licence is unchanged.

## Scope and trust boundary

Offline manual n8n checks for supplied package metadata and optional bytes. No filesystem reads, archive generation/extraction, fetch, model/paid API calls, publication, approval or scheduling. `status: structure_valid` is a structural result. `release_approved` is always false. It is not a production exporter, security scanner or ZIP validator.

`byte_integrity_verified` becomes true only when every file has supplied bytes and a matching SHA-256. It proves consistency against caller-declared hashes, not trusted provenance, correct rendering or rights. Missing bytes or hashes never become integrity-verified. `zip_integrity_verified` and `rendering_verified` remain false. A correct PDF/image signature is not a full decode. Visual, copyright, licence/dependency, workflow-import and security review remain separate gates.

## Input contract

Top-level: profile article or product, optional slug (required for article), files, and expected_images (article only; product may use empty array). Unknown fields reject to avoid silently ignoring proof. No ZIP bytes are accepted as a substitute for unpacked file records.

Each file: path, bytes (positive declared integer), optional sha256 (64 lowercase hex), optional data (canonical base64 of actual bytes). Do not put a URL or filename in data. Omit data for metadata-only checks; an explicitly empty data string rejects. File names are conservative relative ASCII paths. Absolute paths, traversal/dot segments, backslashes, encoded paths, duplicate case-insensitive paths, file/directory collisions, Windows device names and trailing-dot segments reject.

Limits: 1–32 files, 8 MiB per file, 16 MiB total declared bytes, 1 MiB textual file limit, 180 path characters. Size/schema checks run before decoding. JSON is bounded to 40 levels and 20,000 values. Sparse arrays, invalid integers/NaN, malformed canonical base64 and malformed JSON reject. This is a conservative supported subset, not every valid HTML, Markdown or workflow representation.

### Article profile

Requires slug.md, slug.html, slug.pdf, assets-manifest.json and 1–2 expected_images paths under assets/ ending jpg/jpeg/png. Slug: lowercase ASCII words separated by hyphens, maximum 120 characters.

When actual manifest bytes are supplied, JSON must contain assets with path and bytes for every expected image, and optional sha256. Paths and declared sizes must match supplied file records; supplied hashes must agree and are checked against supplied image bytes when available. Without manifest bytes its presence is only a structural assertion. Every expected image must be present as a file record, but metadata alone never proves a real image exists.

When actual Markdown or HTML bytes are supplied, all supported inline image references must match expected_images and every expected image must appear. Markdown uses ![alt](assets/path.jpg); HTML uses quoted img src. Reference-style Markdown images, HTML images inside Markdown, HTML srcset, external/data URLs and unsupported image syntax reject. This is not a renderer or complete HTML parser. PDF bytes need a %PDF- version signature; JPEG/PNG bytes need their expected header. Text bytes must roundtrip UTF-8. File size and any supplied SHA-256 must match.

### Product profile

Requires workflow.json, exactly one README or README.md, exactly one LICENSE / LICENSE.md / LICENSE.txt, and exactly one CHANGELOG / CHANGELOG.md. All supplied product text is heuristically checked for common token/password patterns and identifiable private URLs. Supplied JSON is also parsed and checked for credential fields and nonempty/malformed pinData. Product workflow bytes also require nonempty nodes, connections and inactive state if active is present. Nodes must have unique nonblank names and n8n-nodes-base.* types; custom nodes are intentionally unsupported. No workflow code is executed or imported by the checker.

Supplied product text and parsed JSON are scanned; PDF/image bodies and absent bytes are excluded. Non-PDF/JPEG/PNG product files must be bounded valid UTF-8 text; unsupported opaque binaries reject. Not every possible secret format can be detected. Regex/key checks can miss secrets and can flag harmless strings. Encoded data, obfuscation, unusual token formats or private destinations require human security review. Do not submit actual secrets to test this module. Metadata-only product checks cannot inspect workflow content. This result never guarantees safe-to-share status.

## Demonstration and recovery

1. Import workflow.json into a new inactive workflow and run the fictional metadata-only article fixture: expect structure_valid, byte_integrity_verified false, release_approved false
2. Remove assets/imagem-1.jpg from files: validation must fail for the missing article file
3. Restore the original fixture and rerun: structure_valid returns, integrity remains false
4. For byte tests, supply your separately reviewed actual files and matching hashes. A mismatch must block; correct the source package, never patch hashes merely to suppress a failure

A fresh isolated n8n 2.41.4 import passed valid metadata-only, missing-image rejection and canonical-restored recovery runs on 30 September 2026. The restored fictional input was saved, reloaded and matched exactly before recovery. No production workflow was changed. Exact evidence is in docs/delivery-package-candidates-2026-09-30.json. Source settings request Africa/Luanda and no retained execution data, but the tested import retained default Etc/UTC and Default Save for failed, successful and manual executions. Review actual runtime settings before private input; no settings/export roundtrip is claimed. The crypto module is required only for hash checks and is embedded using the existing n8n crypto pattern; confirm your runtime permits it.

The automated all-byte fixtures deliberately use fictional signature-only PDF/image bytes, not renderable documents or real photographs. Their success proves the signature/hash branch works, not visual quality or a usable export.

Before distribution, generate a ZIP separately, extract into an isolated directory, compare every extracted hash, open HTML/PDF to inspect images/accents/cuts, import product workflows into an isolated environment, review rights/licences and obtain release approval. These gates are deliberately not automated or claimed complete here.

Run: `node --test automation/editorial/export-package.test.cjs automation/editorial/delivery-package-packages.test.cjs`.

Reference: https://docs.n8n.io/build/manage-workflows/export-and-import

This module is publicly downloadable. Its licence does not authorize publishing supplied content or sharing credentials. Complete the separately required editorial, rights, security and release reviews for any package you process.
