Repository navigation
feat(artifacts): inspect Squirrel.Windows installers and release packages - #16258
thehobbit85 wants to merge 11 commits into
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Confidence Score: 5/5
[Medium impact] The latest changes appear safe to merge; no blocking findings remain. SummaryAdds read-only inspection of Squirrel.Windows installers, release packages and
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
Reviews (9) · Last reviewed commit: "fix(squirrel): share one expansion allow..." · Reviewed by Greptile |
…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.
8716ccf to
4a7cfd0
Compare
|
@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. |
…kage layout in one pass
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.
|
@greptileai review |
Summary
Adds
inspect_squirrel_package(CLIinspect-squirrel-package): a static, read-only reader for Squirrel.Windows installers (Setup.exe), release packages (*-full.nupkg,*-delta.nupkg) andRELEASESfiles. Electron apps for Windows often ship this way. Until now REA saw theSetup.exeas 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.exewants to know which app and version it installs, where the payload sits, whether an Electronapp.asaris inside, and whether a release folder'sRELEASESmatches 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 aspeOverlayHeaderFacts. The report gives the offset, length, SHA-256, location and how the payload was found. A PE with no payload succeeds withcoverage: unknown. ADATA/131resource 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 inmodule-layers.mjs. The report gives the app folder (lib/net45/for Squirrel,lib/app/for Velopack), the Electronresources/app.asarorresources/app/with itspackage.json, and the.bsdiff,.zsdiff,.diffand.shasumdelta 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 aRELEASESinside a Setup. The result ismatch,sha1-mismatch,size-mismatch,missingornot-checked; URL and path filenames are not checked. Malformed lines are listed by number.Inventory and extraction. A PE with a
DATA/131ZIP is classified as the newsquirrel-setupartifact format.inspect_artifactandextract_artifacttherefore serve the bundle members (Update.exe, RELEASES, the nupkg) through the sharedZipArtifactReader, now able to read a byte region of a carrier. NuGet's private random-access ZIP reader moved tosrc/resources/ByteSourceZipReader.tsso both readers share it.Budgets.
max_file_bytesmax_entries(bundle and all packages together)max_package_bytesmax_releases_bytesEach refusal reports its parameter and effective value. The PE resource walk and the
.nuspecread 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
src/domain/squirrel/squirrelSetupPayload.ts. The provider report and artifact classification both consume it.inspect_squirrel_packagewith a summary view.squirrel-setupininspect_artifactandextract_artifact.DATA/131ZIP resource now inventories assquirrel-setupinstead ofpe. Other PEs, including Velopack overlay installers, staype.scripts/verify/advertised-schemas/tools/inspect_squirrel_package.jsonis added. The Cursor plugin skill mirror is regenerated.Expected effects:
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.tscovers:app.asarresources/app/with PE32+sha1-mismatchandmissingDATA/131resourcemax_entriesandmax_package_bytesrefusalssrc/artifacts/SquirrelSetupArtifactReader.test.tscovers inventory, extraction of the nupkg from a Setup selected aspe, relocation without admission, a Velopack PE stayingpe, and a reader with no bundle.src/domain/squirrel/squirrelPackage.test.tscovers RELEASES parsing, member roles and layout.src/application/squirrel/SquirrelPackageService.test.tscovers invalid input and late cancellation.tests/boundary/mcp/squirrelPackageMcp.test.tscovers 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:
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.exeinventories aspewith 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.
electron-winstallerorvpk. All coverage is synthetic.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:localon the Squirrel provider, Setup reader and domain suites: 27 passed on the final commit.141d9f5: confidence 5/5, no open findings.npm run docs:check: passed.npm run test:focusedon the 8 new and registry suites: 44 passed. The suites were:SquirrelPackageService.test.tssquirrelPackageMcp.test.tsabsoluteLocalPathSchema.test.tsservedSchemaParity.test.tslocalToolContracts.test.tsnpm run test:focusedonproviderLifecycleCoverage.test.ts,stableArtifactConsumers.test.tsandlocalPath.test.ts: 289 passed.npm run test:localon 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.docs/reference/supported-targets.md. It was re-inserted after the VS Code extensions row in main's realigned table.squirrelPackagenamestests/boundary/mcp/squirrelPackageMcp.test.ts.inputFormat: "squirrel-setup", whichBinaryTarget["format"]does not accept; a Setup.exe is admitted aspe, and extraction probes a PE for the bundle. The test now usespeand asserts the escaped path is absent withENOENT(main's lint now requires a specific rejection).inspect_squirrel_packageadvertised-schema summary was refreshed for main's checker.npm run check:fastandnpm 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; onproviderCapabilityConformance,providerLifecycleCoverage,targetFailureConformance,stableArtifactConsumers,localToolContractsandcliParityGoldensplus the Squirrel tests: passed. The pre-push hook (check:fast and the advertised-schema check) passed.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.artifactExpansionBudgetBytesfrom the bundle;max_package_bytesstill 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.npm run check:prbecause the machine is shared.Compatibility, safety, and release
Setup.exethat previously inventoried aspenow has root formatsquirrel-setup, and extraction still accepts it when selected aspe.Author readiness
Human owner: @thehobbit85
Author checklist (completed by the PR author before requesting review)
type(scope): outcome.REA_runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.