Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): sign Windows native addons #8206

MergedLumbreras2306(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/8206/headmerged by maria-rcks View on GitHub

Problem

The signed Windows desktop build only signs .exe files by default. Native addons and libraries copied into app.asar.unpacked and server.asar.unpacked remain unsigned, so Windows Smart App Control can block them independently from the signed T3 Code executable. Blocking ffi-rs.win32-x64-msvc.node crash-loops the embedded backend and leaves the renderer on the generic fetch-session-state (HTTP 500) error screen.

Fix

Add .node and .dll to Electron Builder's Windows signExts configuration. Release builds will use the existing Azure Trusted Signing configuration for these native runtime files as well as the default executable targets.

The Windows build-config test now asserts that both native extensions remain covered.

Fixes #8201.

Testing

  • vp test run scripts/build-desktop-artifact.test.ts -t "configures Windows executable metadata and native signing extensions"
  • vp lint scripts/build-desktop-artifact.ts scripts/build-desktop-artifact.test.ts
  • pnpm --filter @t3tools/scripts typecheck

A full run of scripts/build-desktop-artifact.test.ts reached 46 passing tests; 6 existing environment-sensitive tests failed locally on Windows because the sandbox cannot create symlinks/spawn the packaged probe and an ancestor node_modules is intentionally rejected. The focused test, lint, and typecheck pass.

Generated with GPT-5 via Codex.


Note

Medium Risk Changes Windows release signing scope for all signed builds; misconfiguration could break signing CI or leave natives unsigned if Electron Builder behavior differs from expectations.

Overview Extends Windows release packaging so Electron Builder signs .node and .dll files, not just the main .exe. The change sets win.signExts to ['.node', '.dll'] in createBuildConfig, so Azure Trusted Signing (when signed is enabled) also covers native addons and libraries unpacked from app.asar and the server sidecar—addressing Smart App Control blocking unsigned runtime natives (e.g. ffi-rs) that can crash-loop the embedded backend.

The build-config test was renamed and now asserts signExts alongside existing checks for icon, signAndEditExecutable, and absent azureSignOptions on unsigned builds.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2fda067872dee4a82429a68b2c5e7afaa85d851e. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add signExts to Windows build config in createBuildConfig

Sets winConfig.signExts to ['.node', '.dll'] in the Windows branch of createBuildConfig so Electron-builder signs native addons. Updates the test in build-desktop-artifact.test.ts to assert the extension list.

Macroscope summarized 2fda067.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 7569121c-3656-483d-a1f0-064f68859a3b

      📥 Commits

      Reviewing files that changed from the base of the PR and between aacefcd7e92a784c179b3ca2473a7608f783784e and 5f915d31a3a912c5efcda351912e4f84c465a313.


      📒 Files selected for processing (2)
      • scripts/build-desktop-artifact.test.ts
      • scripts/build-desktop-artifact.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.



      📝 Walkthrough

      Walkthrough

      Windows server-sidecar packaging now unpacks shared-library and helper formats, and selectively unpacks .node files with the MZ signature. Windows signing includes .node and .dll extensions. Tests cover native-file placement and signing configuration.

      Changes

      Windows native addon packaging

      Layer / File(s)Summary
      Selective Windows sidecar unpacking
      scripts/build-desktop-artifact.ts, scripts/build-desktop-artifact.test.ts
      The sidecar packer applies shared-library and helper unpack globs. It adds an unpack rule for .node files only when their contents begin with MZ. Tests check that the Windows native is unpacked and the Linux native remains readable inside the ASAR.
      Windows native signing extensions
      scripts/build-desktop-artifact.ts, scripts/build-desktop-artifact.test.ts
      Windows signing configuration includes .node and .dll extensions. The test retains the executable resource-editing expectation.

      Priority: ➖ Normal

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: juliusmarminge


      Merge Risk | ⚪ Minimal · up to 5f915

      Merge Risk: ⚪ Minimal · up to 5f915

      The changed packaging and signing paths appear to cover the Windows native addons. No merge-blocking issue remains after normal checks.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 5f915

      The change is narrowly scoped to Windows packaging and uses the existing signing identity. No introduced attack path was established. Remaining uncertainty is whether final release artifacts retain executable signing and successfully sign every intended native library.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The changed trust scope covers native files selected for Windows packages using the existing release-signing identity. Compromised staged dependency content could consequently receive that publisher signature; no new remote submission path, tenant authority, or signing credential is established by the inspected change.

      Trust Boundaries and Controls

      • inferred — Earlier inspection of the pinned signing dependency supports selection of sidecar native files during extra-resource copying, so server.asar.unpacked placement alone does not establish missing signing coverage. Configuration and selection do not prove successful signatures; current inspection could not independently confirm the external implementation or preservation of default executable signing.

      Resilience and Maintainability Implications

      • observed — The existing final-output copy loop is non-transactional and unlocked: interruption or concurrent builds sharing an output directory can leave partial or stale outputs. This publication limitation predates the PR and is not retained as an introduced concern. Build isolation and validation ordering remain unchanged.

      Hardening Proposals

      • proposed — For signed releases, verify Authenticode validity and expected publisher identity on final executable, .node, and .dll outputs in both unpacked trees before distributing artifacts. This would demonstrate delegated signing coverage rather than relying solely on configuration assertions and runtime-load probes.

      Pre-merge checks | Passed 3 | Failed 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Linked Issues checkWarningThe change satisfies the packaging requirement in [#8201] by adding .node and .dll to Windows signExts. The updated tests also cover PE .node unpacking and Linux prebuild exclusion. However, t…Add automated coverage that verifies signatures for every packaged Windows native artifact. Propagate the native load error, including Windows error 4551 when available, to the desktop startup error and diagnostics. Add the requested Smart …
      ✅ Passed checks (3 passed)
      Check nameStatusExplanation
      Title checkPassedThe title clearly identifies the primary change: signing Windows native addons.
      Description checkPassedThe description explains the problem, fix, issue reference, focused verification, and known environment-sensitive failures. It is mostly complete, although it does not use explicit "Change," "Scope an…
      Out of Scope Changes checkPassedThe changes stay within [#8201]. The server-sidecar unpack rules make Windows native files available for signing and exclude Linux native prebuilds. The fixture updates verify that packaging behavior.…

      Full details: Linked Issues check

      Explanation

      The change satisfies the packaging requirement in [#8201] by adding .node and .dll to Windows signExts. The updated tests also cover PE .node unpacking and Linux prebuild exclusion. However, the reviewed changes do not implement the issue's other coding requirements: preserve and surface the underlying application-control or ERR_DLOPEN_FAILED error, and add a release check for native signature coverage. No Smart App Control enforcement smoke test is added either.

      Resolution

      Add automated coverage that verifies signatures for every packaged Windows native artifact. Propagate the native load error, including Windows error 4551 when available, to the desktop startup error and diagnostics. Add the requested Smart App Control enforcement smoke test if the CI environment supports it.


      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Warning

      ⚠️ This pull request shows signs of AI-generated slop (ai_padded_prose). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.


      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This patch changes Windows production artifact layout and expands Authenticode signing to native addons and DLLs. The focused tests cover representative packaging cases, but the release-signing and packaging impact warrants human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2fda067872dee4a82429a68b2c5e7afaa85d851e. Configure [here](https://www.cursor.com/dashboard/bugbot).
      scripts/build-desktop-artifact.ts line 2951Resolvedby maria-rcks
    5. juliusmarminge added labelsmacroscope-review

    6. maria-rcks merged thisfa9f936

    7. maria-rcks closed this

Sign in to join this conversation.