Download Latest Version openpublisher5g_amd64-windows.exe (81.1 MB)
Home / 5.1.10
Name Modified Size InfoDownloads / Week
Parent folder
openpublisher5_amd64-windows-portable.exe 2026-09-30 183.2 MB
openpublisher5_amd64-windows.exe 2026-09-30 165.2 MB
openpublisher5_amd64-macos.dmg 2026-09-30 233.1 MB
openpublisher5_amd64-linux.run 2026-09-30 193.4 MB
openpublisher5_amd64-linux.rpm 2026-09-30 215.4 MB
openpublisher5_amd64-linux.flatpak 2026-09-30 153.6 MB
openpublisher5_amd64-linux.deb 2026-09-30 156.2 MB
openpublisher5_amd64-linux.AppImage 2026-09-30 176.6 MB
openpublisher5_amd64-freebsd.pkg 2026-09-30 185.5 MB
5.1.10_ Desktop App Password Encryption _ Metadata Bridge source code.tar.gz 2026-09-30 21.5 MB
5.1.10_ Desktop App Password Encryption _ Metadata Bridge source code.zip 2026-09-30 21.7 MB
README.md 2026-09-30 6.4 kB
Totals: 12 Items   1.7 GB 0

πŸš€ Summary

Version 5.1.10 fixes a critical issue where password-protected documents saved inside the V5 desktop application (wrapper.html) failed to retain encryption, causing saved .opub publications to reopen without prompting for a password.

This fix is implemented entirely within the web application codebase, eliminating the need to rebuild, recompile, or redistribute desktop application installers across Windows, macOS, Linux, and FreeBSD.


πŸ” Root Cause Analysis

When running inside the V5 desktop application wrapper (wrapper.html), an injection timer periodically injected an unencrypted stub for saveDocument:

:::js
// Desktop wrapper injection stub (wrapper.html)
window.saveDocument = function() {
    state.pages[state.currentPageIndex] = serializeCurrentPage();
    var docData = {
        title: document.getElementById('doc-title').innerText,
        pages: state.pages
    };
    console.log('OP_IPC:' + JSON.stringify({
        type: 'OP_SAVE_DATA',
        payload: JSON.stringify(docData)
    }));
};

Why this broke password protection and document integrity:

  1. No Encryption Pass: The wrapper's stub extracted only { title, pages } and dispatched them as raw unencrypted JSON. It completely bypassed state.documentPassword and Web Crypto AES-GCM 256 encryption (window.encryptDocumentData).
  2. Missing Document Metadata: The stub dropped all critical document metadata, including dpi, format, unit, rulerUnit, margins, and isSpreadMode.
  3. Non-Configurable Function Statement: In io/file-io.js, saveDocument was originally declared as a top-level function declaration (function saveDocument()). In non-strict browser scripts, this created a non-configurable property (configurable: false) on window, preventing extensions from attaching getter/setter traps via Object.defineProperty.
  4. Silent Password Loss: Because the desktop wrapper's atomicSave received unencrypted JSON from the injected stub, the resulting .opub file on disk contained no encryption wrapper (encrypted: true, salt, iv, data). When reopened, the loader saw plain JSON and loaded it directly without requesting the password.

πŸ› οΈ Fix

The issue is resolved through a defensive desktop bridge in extensions/system-patches.js and an adjustment to function configurability in io/file-io.js:

1. Configurable Declaration (io/file-io.js)

Changed function saveDocument() to an explicit property assignment:

:::js
window.saveDocument = function() { ... };

This ensures window.saveDocument is configurable and can be intercepted by property descriptors. Also updated saveDocumentAs to invoke window.saveDocument().

2. Desktop Save Bridge & Interception (extensions/system-patches.js)

Implemented masterSaveDocument and masterExtractSnapshot and protected both properties using Object.defineProperty:

:::js
Object.defineProperty(window, 'saveDocument', {
    get: function() {
        return masterSaveDocument;
    },
    set: function(newFn) {
        // Intercept desktop wrapper injection, flag desktop bridge as active,
        // and retain our secure masterSaveDocument with AES-GCM encryption & full metadata.
        _desktopBridgeActive = true;
        console.log("OpenPublisher: Desktop save bridge connected securely with encryption support.");
    },
    configurable: true,
    enumerable: true
});

3. Unified Encryption and Metadata Pipeline

When saving in desktop mode, masterSaveDocument:

  • Serializes the active page and gathers full document metadata (dpi, format, unit, rulerUnit, margins, isSpreadMode, documentProperties).
  • Checks state.documentPassword. If present, encrypts the document payload using AES-GCM 256 (window.encryptDocumentData).
  • Dispatches the serialized payload to the desktop wrapper via OP_IPC:{"type":"OP_SAVE_DATA","payload":...}.
  • Updates dirty state baselines and Recent Files thumbnails.
  • Leaves standard browser workflows (showSaveFilePicker and blob downloads) unaffected.

πŸ§ͺ Verification / Test Coverage

Automated end-to-end tests were conducted in a headless Chromium environment verifying all 7 conditions:

  1. Configurable Property Verification: window.saveDocument exists as a callable function.
  2. Hijack Interception: Wrapper script attempts to overwrite window.saveDocument with an unencrypted stub are intercepted; the secure function is preserved and _desktopBridgeActive is flagged.
  3. Desktop IPC Dispatch: Calling saveDocument() in desktop mode emits OP_IPC messages with type OP_SAVE_DATA.
  4. AES-GCM Encryption Integrity: Documents saved with a password produce a payload containing encrypted: true, salt, iv, and ciphertext data.
  5. Decryption Round-Trip: The encrypted payload is successfully decrypted with window.decryptDocumentData using the correct password, matching the original document structure and metadata.
  6. Password Rejection: Decryption attempts with an incorrect password fail with an authentication error.
  7. Unencrypted Metadata Preservation: Documents saved without a password preserve all document metadata fields (dpi, format, margins, isSpreadMode, etc.).

βœ… Checklist Completed

  • [x] io/file-io.js: Changed function saveDocument() to window.saveDocument = function() { ... } so the property is configurable. Updated saveDocumentAs to route through window.saveDocument().
  • [x] extensions/system-patches.js: Implemented masterSaveDocument and masterExtractSnapshot with full AES-GCM 256 encryption and metadata preservation. Protected window.saveDocument and window.extractDocumentSnapshot with getter/setter traps via Object.defineProperty.
  • [x] index.html: Bumped all script, stylesheet, and asset cachebusters from ?v=5.1.9 to ?v=5.1.10.
  • [x] ui/dashboard.js: Bumped template index fetch cachebuster from ?v=5.1.9 to ?v=5.1.10.
  • [x] README.md: Updated incremental version history table and summary to include version 5.1.10.

πŸŽ‰ Version 5.1.10 - Open Publisher

Source: README.md, updated 2026-09-30