Skip to content

feat(artifacts): inspect Squirrel.Windows installers and release packages - #16258

Open
thehobbit85 wants to merge 11 commits into
morluto:mainfrom
thehobbit85:feat/squirrel-windows-installers
Open

thehobbit85 wants to merge 11 commits into
morluto:mainfrom
thehobbit85:feat/squirrel-windows-installers

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds inspect_squirrel_package (CLI inspect-squirrel-package): a static, read-only reader for Squirrel.Windows installers (Setup.exe), release packages (*-full.nupkg, *-delta.nupkg) and RELEASES files. Electron apps for Windows often ship this way. Until now REA saw the Setup.exe as a plain PE and could not reach the packaged app.

No issue is linked. I searched issues and PRs for squirrel, Update.exe, RELEASES, Setup.exe, electron installer, nupkg and velopack and found no prior work.

Problem and expected behavior

An analyst with DemoSetup.exe wants to know which app and version it installs, where the payload sits, whether an Electron app.asar is inside, and whether a release folder's RELEASES matches its packages. They want all of this without running the installer or Update.exe.

Change and scope

  • Setup.exe. The bundle ZIP is located in the PE resource "DATA"/131, which Squirrel's stub reads. The locator otherwise falls back to a ZIP that starts the PE overlay, which is how Velopack appends its package. Both use the existing owners: locatePeResourcePayloads, now generalized to string or numeric type and name keys, and the overlay computation, whose header facts are now shared as peOverlayHeaderFacts. The report gives the offset, length, SHA-256, location and how the payload was found. A PE with no payload succeeds with coverage: unknown. A DATA/131 resource that is not a ZIP is named in a limitation. An image whose sections run past the end of the file fails as truncated.

  • Packages. Identity comes from the existing NuGet reader (parseNugetNupkg), declared as a provider dependency in module-layers.mjs. The report gives the app folder (lib/net45/ for Squirrel, lib/app/ for Velopack), the Electron resources/app.asar or resources/app/ with its package.json, and the .bsdiff, .zsdiff, .diff and .shasum delta parts with the file each one targets. Delta parts are not applied.

  • RELEASES. Parsed with Squirrel's ReleaseEntry rules: comments, CRLF, and a staging # N% suffix. Each entry is checked against the package of that name: in the same directory for a selected file, or in the same bundle for a RELEASES inside a Setup. The result is match, sha1-mismatch, size-mismatch, missing or not-checked; URL and path filenames are not checked. Malformed lines are listed by number.

  • Inventory and extraction. A PE with a DATA/131 ZIP is classified as the new squirrel-setup artifact format. inspect_artifact and extract_artifact therefore serve the bundle members (Update.exe, RELEASES, the nupkg) through the shared ZipArtifactReader, now able to read a byte region of a carrier. NuGet's private random-access ZIP reader moved to src/resources/ByteSourceZipReader.ts so both readers share it.

  • Budgets.

    Budget Default Maximum
    max_file_bytes 1 GiB 4 GiB − 1
    max_entries (bundle and all packages together) 16384 262144
    max_package_bytes 512 MiB 1 GiB
    max_releases_bytes 4 MiB 64 MiB

    Each refusal reports its parameter and effective value. The PE resource walk and the .nuspec read keep their existing fixed allowances and are reported as such.

  • Not included. Authenticode verification (the existing PE certificate tool covers it), applying deltas, choosing what Update.exe would install, and NSIS/Inno/MSI.

Contract and boundary impact

  • Semantic owner and earliest changed stage.
    • The payload location is owned by src/domain/squirrel/squirrelSetupPayload.ts. The provider report and artifact classification both consume it.
    • PE resource lookup and overlay header facts stay with their existing owners.
    • Package identity stays with the NuGet parser.
  • Contribution scope fit and linked maintainer decision. This is a built-in static reader within existing boundaries, like the NuGet and VSIX readers. It adds no external provider and no target execution, injection, mutation or protection recovery, so no maintainer scope decision is required.
  • CLI and MCP/tool-catalog contract.
    • New tool inspect_squirrel_package with a summary view.
    • New artifact format squirrel-setup in inspect_artifact and extract_artifact.
    • Advertised schema summary added.
  • Provider, bridge, target-format, or platform compatibility. A PE that has a DATA/131 ZIP resource now inventories as squirrel-setup instead of pe. Other PEs, including Velopack overlay installers, stay pe.
  • Evidence, artifact, provenance, or reconstruction contract. The artifact's SHA-256 is recorded, plus the payload's SHA-256 and each package's SHA-1.
  • Generated metadata. scripts/verify/advertised-schemas/tools/inspect_squirrel_package.json is added. The Cursor plugin skill mirror is regenerated.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated. All fixtures are synthetic and built inside the tests: zip.js ZIPs and PE images from the existing PE resource and overlay fixtures.

    • src/squirrel/SquirrelPackageProvider.test.ts covers:

      • a Setup with Electron app.asar
      • resources/app/ with PE32+
      • a bundled RELEASES with sha1-mismatch and missing
      • no payload, giving unknown coverage
      • a non-ZIP DATA/131 resource
      • a truncated Setup
      • Velopack overlay
      • delta parts
      • a RELEASES directory with match, SHA-1 mismatch, size mismatch with staging, missing, not-checked and malformed lines
      • an unrecognized file
      • max_entries and max_package_bytes refusals
    • src/artifacts/SquirrelSetupArtifactReader.test.ts covers inventory, extraction of the nupkg from a Setup selected as pe, relocation without admission, a Velopack PE staying pe, and a reader with no bundle.

    • src/domain/squirrel/squirrelPackage.test.ts covers RELEASES parsing, member roles and layout.

    • src/application/squirrel/SquirrelPackageService.test.ts covers invalid input and late cancellation.

    • tests/boundary/mcp/squirrelPackageMcp.test.ts covers the MCP round trip.

    • Registry entries were added in the absolute-path, served-schema, local-tool-contract and provider-lifecycle suites.

    • Review fixes added regressions for:

      • the shared entry budget across packages
      • a Velopack payload counted once
      • bundled RELEASES checks resolved by full path, including ambiguous and URL entries
      • partial coverage for malformed bundled lines
      • one read per repeated RELEASES filename
      • cancellation during a bundled package read

      Each of these failed on the commit before its fix.

  • Base reproduction or other evidence. On the base, the tool does not exist and a Squirrel Setup.exe inventories as pe with no members.

  • User-visible CLI/MCP output. Abridged, from the provider test fixture:

    {"kind":"setup","flavor":"squirrel",
     "setup":{"image_format":"pe32","payload":{"location":"resource","found_by":"PE resource type \"DATA\" ID 131 ...","content":"bundle"}},
     "packages":[{"name":"DemoApp-1.2.3-full.nupkg","identity":{"id":"DemoApp","version":"1.2.3"},"app_root":"lib/net45/","electron":{"asar":"lib/net45/resources/app.asar"}}],
     "releases":{"entries":[{"filename":"DemoApp-1.2.3-full.nupkg","check":{"status":"match"}}]}}
  • Remaining proof gaps.

    • Not run against a real Squirrel.Windows or Velopack installer produced by electron-winstaller or vpk. All coverage is synthetic.
    • The DATA/131 location and RELEASES grammar follow Squirrel.Windows' source (WriteZipToSetup, ReleaseEntry).
  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run check:fast: passed on the final commit (typecheck, lint, module boundaries, architecture guards).
  • npm run test:local on the Squirrel provider, Setup reader and domain suites: 27 passed on the final commit.
  • Greptile review on 141d9f5: confidence 5/5, no open findings.
  • npm run docs:check: passed.
  • npm run test:focused on the 8 new and registry suites: 44 passed. The suites were:
    • SquirrelPackageService.test.ts
    • squirrelPackageMcp.test.ts
    • absoluteLocalPathSchema.test.ts
    • servedSchemaParity.test.ts
    • localToolContracts.test.ts
    • the three Squirrel source suites
  • npm run test:focused on providerLifecycleCoverage.test.ts, stableArtifactConsumers.test.ts and localPath.test.ts: 289 passed.
  • npm run test:local on neighbouring NuGet, PE resource, PE overlay, ZIP, inventory, extraction, format-recognition, evidence-subject, capability and analysis-view suites: all passed.
  • npm run verify:advertised-schemas -- --update-summary: summary written; 41/41 patterns accepted by V8 and Python re. RE2, Go and Rust were not available locally.
  • After rebasing onto main to resolve a merge conflict (head 4a7cfd0):
    • The only conflict was the new row in docs/reference/supported-targets.md. It was re-inserted after the VS Code extensions row in main's realigned table.
    • Main now requires a public-workflow conformance case for each provider capability, so squirrelPackage names tests/boundary/mcp/squirrelPackageMcp.test.ts.
    • The hostile-member extraction test passed inputFormat: "squirrel-setup", which BinaryTarget["format"] does not accept; a Setup.exe is admitted as pe, and extraction probes a PE for the bundle. The test now uses pe and asserts the escaped path is absent with ENOENT (main's lint now requires a specific rejection).
    • The inspect_squirrel_package advertised-schema summary was refreshed for main's checker.
    • npm run check:fast and npm run docs:check: passed. npm run test:local -- on the Squirrel domain, service, provider and reader tests: 30 passed. npm run test:focused -- on the Squirrel MCP and reader tests: 7 passed; on providerCapabilityConformance, providerLifecycleCoverage, targetFailureConformance, stableArtifactConsumers, localToolContracts and cliParityGoldens plus the Squirrel tests: passed. The pre-push hook (check:fast and the advertised-schema check) passed.
  • After the Greptile review of 4a7cfd0 (head c217cc6): RELEASES comment and CR trimming are linear (a 32 KiB late-failing line took 1,640 ms before and now runs within the 100 ms test bound); a failed close of a RELEASES sibling package is reported as cleanup instead of not-checked; the package layout is derived in one collection pass, with a characterization test that passes on both implementations. npm run check:fast: passed. npm run test:local -- on the Squirrel domain, provider, service and reader tests: 32 passed. npm run test:focused -- on the Squirrel MCP and reader tests: 7 passed. The pre-push hook passed.
  • Shared expansion bound (head b4054db): bundle member reads also charge one allowance sized by artifactExpansionBudgetBytes from the bundle; max_package_bytes still bounds each package. npm run check:fast: passed. npm run test:local -- on the Squirrel domain, provider, expansion, service and reader tests: 36 passed. npm run test:focused -- on the Squirrel MCP test and provider capability and target failure conformance: 166 passed. npm run docs:check: passed. The pre-push hook passed. Not run: check:pr, real Squirrel installers.
  • I did not run the full npm run check:pr because the machine is shared.

Compatibility, safety, and release

  • Breaking changes or migration steps. None in the tool contract. A Squirrel Setup.exe that previously inventoried as pe now has root format squirrel-setup, and extraction still accepts it when selected as pe.
  • Real Hopper/Ghidra, browser, or OS coverage. Not applicable. No real installers were tested.
  • Package or release metadata impact. A new tool in the catalog.
  • Security, privacy, process, or containment review. Read-only. It does not spawn processes or use the network. Sibling package checks only stat and hash regular files that a RELEASES line names in the same directory; URL and path names are not followed.

Author readiness

Human owner: @thehobbit85

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Author checklist (completed by the PR author before requesting review)

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
  • I ran every test, build, or measurement needed to validate this change, reported a browser, GPU, or environment gap only when that runtime or hardware is unavailable, and reported the checks I ran and their results without presenting inferred correctness or speedups as measured.
  • Comments explain constraints or non-obvious decisions; task history and conversations stay out of code and docs.
  • Documentation is concise and factual, without punchy slogans or promotional language.
  • This change fixes the root cause and follows the engineering rules in AGENTS.md.
  • Formatted input is interpreted once at the owning boundary, and consumers use the owner's parsed facts. See Interpret boundary facts once.
  • Combined failures preserve partial observations, remaining resources, and cleanup facts. See Own the lifecycle.
  • A hardcoded limit is an REA_ runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.

@thehobbit85
thehobbit85 marked this pull request as ready for review December 3, 2026 06:34
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-03T06:34:16.203730Z
We couldn’t complete this review. Comment @codex review to try again.
bf6be7e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 Tier: plusRetriggerView in Greptile

[Medium impact] The latest changes appear safe to merge; no blocking findings remain.

Summary

Adds read-only inspection of Squirrel.Windows installers, release packages and RELEASES files.

  • Squirrel installers and release files can be inspected without running them.
  • Squirrel Setup bundles appear in inventory and can be extracted as ZIP files.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Selected artifact"] --> B{"Input kind"}
  B -->|PE| C["Locate ZIP payload"]
  C --> D{"Bundle?"}
  D -->|Yes| E["Shared byte allowance"]
  E --> F["Read packages and release list"]
  D -->|No| G["Read one NuGet package"]
  B -->|ZIP| G
  B -->|Text| H["Check release-list siblings"]
  F --> I["Report app, hashes and coverage"]
  G --> I
  H --> I
Loading

Reviews (9) · Last reviewed commit: "fix(squirrel): share one expansion allow..." · Reviewed by Greptile

Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageProvider.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
thehobbit85 and others added 8 commits December 4, 2026 14:16
…ages

Add inspect_squirrel_package (CLI inspect-squirrel-package) for a
Squirrel.Windows Setup.exe, a -full/-delta .nupkg, or a RELEASES file.
Setup.exe payloads are located from the DATA/131 resource or a ZIP-led
overlay (Velopack) through the shared PE resource and overlay owners.
Packages reuse the NuGet reader for identity and report the app folder,
Electron app.asar or resources/app/, and delta parts without applying
them. RELEASES lines are checked against sibling or bundled packages.

Setup.exe bundles are also served as the squirrel-setup artifact format
so inspect_artifact and extract_artifact reach the bundled packages.
Nothing is executed.
…ntity

- Charge max_entries once across the bundle listing and every package.
- Resolve bundled RELEASES entries to the member in the RELEASES folder by
  full path; ambiguous, encrypted or unlisted members are not-checked.
- Count malformed and unchecked RELEASES lines in Setup coverage.
- Keep cancellation during bundle member reads as cancellation.
- Report PE resource and .nuspec limits as fixed allowances.
- Observe each RELEASES file name once.
… by record

- An appended package's listing is refunded before the package is read,
  so its entries are charged once.
- Bundle member hashes are keyed by ZIP record, keeping members whose
  names normalize alike; RELEASES checks use one path index built once.
@thehobbit85
thehobbit85 force-pushed the feat/squirrel-windows-installers branch from 8716ccf to 4a7cfd0 Compare December 4, 2026 22:21
@thehobbit85

Copy link
Copy Markdown
Contributor Author

@greptileai review

This PR was rebased onto main (head 4a7cfd0) to resolve a conflict in the supported-targets table. It also has two new commits that meet main's newer conformance, lint and advertised-schema checks. Please review the current head.

Comment thread src/domain/squirrel/squirrelPackage.ts Resolved
Comment thread src/squirrel/SquirrelPackageParser.ts Resolved
Comment thread src/squirrel/SquirrelPackageProvider.ts Resolved
Comment thread src/domain/squirrel/squirrelPackage.ts Resolved
Each package in a Setup.exe bundle was bounded only by max_package_bytes, so a bundle of many packages could expand without a combined bound. Bundle member reads now also charge one allowance sized by artifactExpansionBudgetBytes from the bundle, as the ZIP reader does. Exceeding it is a fixed ceiling; a RELEASES check whose member would exceed it is left not-checked.
@thehobbit85

Copy link
Copy Markdown
Contributor Author

@greptileai review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants