mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 01:46:39 +00:00
* feat(artifacts): inspect VS Code extension packages offline REA had no owner for a local .vsix ZIP. inspect_vsix_package and inspect-vsix-package now read extension.vsixmanifest and extension/package.json, report identity disagreements, engine range, activation events, a contributes summary, hashed native/wasm/executable members, and a ZIP inventory without installing the extension or contacting a marketplace. Missing or malformed manifests return the inventory with limitations. Invalid ZIP input fails without partial success. Signature files are reported present or absent and are not verified. * fix(vsix): bound vsixmanifest XML nodes before building the tree A compressed extension.vsixmanifest within the 16 MiB byte budget can still expand into millions of XML nodes. Count nodes as a stream first, as the Maven POM reader does, and refuse the manifest with an xml_nodes limit before parseXmlDocument allocates its document. * fix(vsix): report the vsixmanifest node ceiling as a fixed allowance The xml_nodes limit is a fixed parser ceiling, not a caller budget, so the provider fell through to a generic memory refusal that implied more memory could help. Map it through fixedAllowanceOptions as the Maven provider does and cover the public error from the provider. * refactor(vsix): classify provider failures through the shared owner VsixPackageProvider kept its own chain for cancellation, identity, path, selected-file and cleanup failures. It now supplies a dialect to classifyProviderFailure with only the package's own refusals: its parse ceilings and budget recovery, format failures, fixed reader allowances and the max_file_bytes refusal. The held snapshot still supplies the completed identity for a parser failure after the read. * fix(vsix): report an empty contributes key instead of failing the report A package.json with an empty contributes key produced a key with an empty name, which the contract refuses, so the whole inventory was rejected. The empty key is now left out of contributes.keys and reported as a limitation. * fix(vsix): charge member decoding to one package-wide budget Each hashed member was read with a fresh per-member budget, so a small compressed package with thousands of members could make the parser decode several GiB. Member reads now draw on one artifactExpansionBudgetBytes budget for the package; once it is spent, remaining members stay in the inventory without a digest and a limitation names the spent budget. * fix(vsix): resolve dot segments in package.json entry points packageJsonEntryPath stripped only one leading ./, so a main such as ./out/./extension.js named extension/out/./extension.js and was reported absent even when extension/out/extension.js existed. Entry points now resolve . and .. segments under extension/; a path that climbs out of extension/ keeps its unresolved form and matches no member. * fix(vsix): resolve entry points with the loader's lookup rules An extension-less main such as ./out/extension was looked up as a literal ZIP name and reported absent although Node resolves it to extension/out/extension.js. main now tries Node's CommonJS file and directory suffixes, browser tries the .js the web extension host adds, and the reported path is the member found. * fix(vsix): resolve a directory main through its own package.json Node's directory lookup reads the directory's package.json main before falling back to index files, so an entry like main: ./out with out/package.json naming ./start.js now resolves as present. * Address review feedback * fix(vsix): report interesting member sizes past 4 GiB A ZIP64 member can declare an uncompressed size above 0xffffffff while the compressed package stays under max_file_bytes. The parser skips hashing it and reports the declared size, but interesting_members[].bytes used the 32-bit uint schema, so the service rejected the whole report. The field now takes any nonnegative integer, matching contents[].uncompressed_size. * fix(vsix): report a malformed directory package.json instead of its index When main names a directory whose package.json is not a JSON object, Node's loader throws ERR_INVALID_PACKAGE_CONFIG rather than falling back to index.js. Keep that outcome distinct from a manifest with no usable main: mark the entry point absent and add a limitation naming the member. * fix(vsix): classify Java archives as nested archives A bundled .jar, .war or .ear is a ZIP, but the path classifier returned unknown for it, so it was never hashed or counted as a nested archive. * fix(vsix): match entry points by exact member case Resolve main and browser entry points against exact ZIP member names, as a case-sensitive file system would, and report a member that matches only when case is ignored as a limitation instead of marking the entry present. The directory package.json used to resolve a directory main is matched exactly too. * fix(vsix): keep directory-only intent for a trailing-slash main A main such as "./out/", ".", "..", or one ending in "/." or "/.." can only name a directory under Node's loader. Normalizing it to a bare path let a sibling file like extension/out.js match and report the entry as present. Carry a directory-only flag from the raw value and skip file candidates in the declared-path lookup and in the check that decides whether to read <main>/package.json. * fix(vsix): only blame case when the spelling differs The case-only entry point warning scanned index candidates even when a malformed directory package.json had already stopped the main lookup, so an exact extension/out/index.js could be reported as a case mismatch. Skip index candidates when the directory manifest is malformed, and skip any candidate whose member is spelled exactly as declared. * fix(vsix): stop main lookup at an over-budget directory package.json When main names a directory whose package.json exceeds max_manifest_bytes, its main is unknown, so falling back to index.* could report a file Node would not load. Treat the unread manifest like a malformed one: report main unresolved, add a limitation that says the index files were not used, and skip the index files in the case-only scan. * fix(vsix): resolve a main that normalizes to the package root A main of ".", "./" or "./out/.." normalized to "extension/", so the directory lookups searched "extension//package.json" and "extension//index.js" and reported a present index file as absent. Return "extension" for the root so those lookups name real members. * fix(vsix): stop main lookup at an unread directory package.json An encrypted or duplicated directory package.json left the directory main unresolved as "none", so lookup fell through to index files even though the unread manifest may name another file or be invalid. Mark it unread and stop the lookup, as the over-budget branch already does. * test(vsix): tag the decode-budget regression long-running The package-wide decode budget test passed a fixed 60-second deadline, which also turned off coverage and CI deadline scaling. Use the long-running tag the testing guide prescribes instead. * fix(vsix): leave unread dependency declarations unknown A missing, encrypted, or malformed manifest reported its extension dependencies and extension pack as empty lists, so a declaration on the other side showed up as a disagreement. Report the unread side as null and only flag a disagreement when both manifests were read. * fix(vsix): look up entry points by their literal text package.json main, browser, and a directory package.json main were trimmed before lookup. A ZIP member name can begin or end with whitespace and Node does not trim the specifier, so "./out/start.js " was reported absent or matched the different "out/start.js" member. Use the declared text as written; only an empty string names nothing. * fix(vsix): keep activation events literal before eager classification VS Code matches activation events as exact strings, so "* " and "onStartupFinished " are not startup activations. The parser read activationEvents through the whitespace-trimming ID helper, which turned those values into "*" and "onStartupFinished" and reported them as eager. Read activation events with a literal helper that drops only empty strings and exact duplicates, and cover the padded values next to their exact-name controls. * fix(vsix): keep mode-executable members inventoried when unread A member with no recognized suffix but Unix execute bits was only classified after its magic was read. When the hash budget, the package decode budget, encryption, or traversal skipped that read, it stayed unknown and fell out of interesting_members and the executable count. Unread mode-executable members now keep an inferred executable kind. * fix(vsix): count a singleton contributes.commands object VS Code accepts contributes.commands as one command object as well as an array. Normalize the singleton form before capping and counting so a package with one command reports commands_total 1 and the commands key count matches. * fix(vsix): keep contributed command identifiers literal VS Code registers and invokes a contributed command by its exact identifier, and the parser already keeps onCommand activation events literal. Commands went through the trimming text helper, so a declared "demo.run " was reported as "demo.run" next to an "onCommand:demo.run " event, giving two different identities for the same command. Keep the declared command text as written and report null only for an empty string. Titles are display text and stay trimmed. * fix(vsix): do not infer executables from symlink modes A Unix symlink entry carries 0o120777, so its permission bits made an unread link look like an executable helper. Only regular files, or entries with no recorded file type, now count toward mode-inferred executables. * style(vsix): apply oxfmt to manifest limit guard * fix(vsix): keep mode-executable kind when read bytes have no known magic A suffixless regular Unix member with execute bits but no recognized magic (for example a shell helper without a shebang) was listed as an executable only when the hash budget skipped its read. Raising the budget enough to hash it resolved the kind to unknown and dropped it from interesting_members and the executable count. Fall back to the mode-derived executable kind when the read bytes match no magic. * fix(vsix): charge failed member expansions to the package budget A member whose ZIP header understates its uncompressed size can decode its whole allowance before the bounded writer refuses it. That work was not charged to the package-wide decode budget, so every later failing member got the same allowance again. Charge the allowance on a max_member_bytes failure so later members see the spent budget. * fix(vsix): bound JSON values before parsing manifests Both package.json readers called JSON.parse after a byte-only check, so a 16 MiB manifest of many tiny values could allocate far more memory than its text. A one-pass countJsonValues scan now runs first: an extension/package.json holding more than 1,048,576 values is refused with a fixed json_values parser allowance, and an over-allowance directory package.json is left unread with a limitation, so its index files are not used. * Address review feedback * fix(vsix): treat absolute directory package.json main as outside the package Node resolves a directory package main with path.resolve(dir, main), so an absolute main names a host file, never a package member. Report it as no main so the lookup falls back to index.* or reports the entry absent. * fix(vsix): tag escaped entry points instead of matching them as members A package.json main or browser that climbs out of extension/ was kept as an ordinary member path string. A traversal ZIP member with the same name (extension/../outside.js) is in the inventory, so the lookup reported the entry point present even though that member is never extracted. packageJsonEntryPath now returns a tagged resolved/escaped value. Escaped entry points skip the member, directory manifest and case-only lookups and are reported with present: false. * fix(vsix): decode directory package.json as UTF-8 like Node Node reads a nested package.json as UTF-8 only. A UTF-16 manifest fails with ERR_INVALID_PACKAGE_CONFIG, so report it malformed instead of transcoding it and marking main present. * fix(vsix): keep directory package.json main inside the extension root A directory package.json main such as ../../outside.js could pop the extension segment and resolve to an archive-root member, which was then reported as the present main entry point. Treat any main that climbs out of extension/ as naming no main, so the lookup falls back to index.* or reports the entry absent. * fix(vsix): keep a root directory main from matching archive-root files A nested package.json main such as ".." in extension/out resolves to the extension root itself. Trying file suffixes on that path matched an archive-root extension.js, which sits outside the installed payload. Mark such a main directoryOnly and resolve it through extension/index.* only, as Node does. * fix(vsix): skip member reads once the package decode budget is spent A compressed member declaring zero uncompressed bytes passed the declared-size check even with no package allowance left, so its decoder still ran and produced output before the writer rejected it. The failure then charged zero, letting each later zero-declared member decompress again past the package ceiling. Skip the read and report the spent budget once nothing remains. * fix(vsix): keep declared API proposal names literal Read enabledApiProposals with the literal list reader used for activation events. VS Code matches proposal names exactly, so trimming whitespace or splitting on commas reported identifiers the package never declared and collapsed declarations that differ only in surrounding whitespace. * fix(vsix): select manifests by their exact member path Count ZIP members by exact logical path. A package holding only extension/Package.json no longer has it parsed as extension/package.json, and a case-only sibling no longer marks the real lowercase manifest as a duplicate and drops its facts. Names that differ only in case, and a manifest present only under another case, are reported as their own limitations. * fix(vsix): treat shared libraries as interesting members Bundled .dll, .so (including versioned .so.N names) and .dylib files without Unix execute bits were classified unknown, so their magic was never read and they were missing from interesting_members and the summary count. Classify these suffixes as executable so they are hashed and listed like .exe and .node members. * refactor(vsix): run inspection through the shared artifact runner VsixPackageService now delegates input parsing, the provider call, output checks, Evidence creation and late cancellation to executeArtifactInspection, as NugetNupkgService does, keeping only the VSIX-specific report checks. * feat(vsix): point first-contact inspection of a .vsix to the VSIX reader inspect_artifact now suggests inspect_vsix_package when a ZIP holds a root extension.vsixmanifest file. The non-ZIP refusal test follows main's unsupported_target classification for malformed target bytes. * fix(vsix): align artifact failures with main * fix(vsix): bound inspect_vsix_package output with shared detail/summary contract * Address review feedback * fix(vsix): bound summary text fields and report structured parameter limits * fix(vsix): omit required_value on early-stop parameter limits * refactor(vsix): count eager activation events without intermediate array --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>