Skip to content
ERPForAll DocsDevelopment

    The .erpaddon package

    Status: implemented. A runtime (WASM) addon ships as one .erpaddon file, a ZIP archive. This page is what an addon author needs to build one, and what an administrator’s install step checks.

    manifest.toml # required; same keys as a native addon, plus an optional [wasm] section
    wasm/<name>.wasm # required when the manifest has [wasm]; <name> is the technical name
    data/ views/ security/ i18n/ migrations/ # as for native addons
    static/dist/ # optional pre-built client code (needs an explicit administrator ack)
    SHA256SUMS # required; one line per file except itself

    SHA256SUMS lines are <64 lowercase hex> + two spaces (or a space and *) + the path, separated by \n. No blank lines, comments or duplicates; paths follow the archive path rules below. It detects corruption and tampering of individual files. It travels inside the archive, so it does not prove who made the package; pin the archive digest (archive_sha256) where authenticity matters.

    Path rules (reader and SHA256SUMS use the same ones)

    Section titled “Path rules (reader and SHA256SUMS use the same ones)”

    Paths must already be canonical: no leading /, no \, no : (drive letters), no control characters, no empty, . or .. segment, at most 512 bytes (255 per segment). There is no normalisation, so two entries can never resolve to one name. Duplicate names, names that differ only by case, a name that is both a file and a directory (also case-folded, on every directory prefix) and symlink entries are refused. Anything whose lowercase form is under static/dist/ must be spelled exactly static/dist/, so client code cannot dodge the acknowledgement gate.

    Read under hard bounds, enforced while inflating (header sizes are never trusted for allocation): archive 64 MiB, 4096 entries, 32 MiB per entry, 128 MiB total uncompressed. PackageLimits lets a caller tighten them. Exceeding one gives Error::PackageLimitExceeded naming the bound.

    [wasm] capabilities accepts only: migrations-sql; filesystem:temp:<N>(kb|mb|gb) with 1 <= N <= 4096; network:outbound:<http(s)-url> where the host is an exact DNS name or IP literal (no userinfo, no percent-encoding, no wildcard in the host, strict dotted-quad IPv4 only), the port is explicit if present, and * may only be the whole last path segment (/*). The stored form is normalised (lowercase host), and consent compares that form. Unknown names are an error.

    erp addon package <addon> -o <name>.erpaddon after erp addon build <addon> --target wasm (see wasm-addons.md). The packer writes technical_name = "<name>" as the first line of the archived manifest when the source manifest has none, so a display name such as "Shop (WASM)" is fine.

    let package = ErpAddonPackage::open("shop.erpaddon")?;
    let mut consent = AdminConsent::new(package.name().clone());
    consent.approve_capability("migrations-sql"); // exactly what the manifest requests
    consent.set_client_dist_digest_ack(package.client_dist_digest().unwrap()); // only if it ships static/dist/
    let consented = package.consent(&consent)?; // the only way to get a ConsentedPackage
    store_package(&mut tx, &consented).await?; // stores the verified archive bytes

    Consent must match the request exactly: missing approvals, approvals for capabilities the package does not request, another addon’s name, and a wrong or unneeded client acknowledgement are all refused. Storing never overwrites: the same archive returns the existing row, a different archive under an existing (name, version) is a conflict.

    Not yet done: ir_module_package is created by init_package_table only and is not part of the schema-migration path; the acknowledgement is not yet written to an audit trail; an upgrade does not yet compare the previous client digest.