Skip to content

Commit c48b070

Browse files
revopushbotclaude
andcommitted
Replace unmaintained aab-parser to clear protobufjs CVEs (REV-36)
protobufjs entered the tree only via aab-parser@1.0.1, which hard-pins protobufjs ^6.11.2. Every reachable 6.x version is affected by 11 npm audit advisories (worst: critical 9.8 RCE), and all fixes land above the pinned range, so npm audit fix could not resolve it. An npm `overrides` bump was insufficient: overrides are honored only for the root project (so end-users installing the published CLI stay vulnerable), and protobufjs 7.x's strict import resolution exposed that aab-parser ships a broken Resources.proto (imports an unshipped Configuration.proto), breaking AAB parsing at runtime. No maintained pure-JS alternative exists — the maintained options wrap Google's Java bundletool and would add a JRE requirement. Instead, vendor the small piece actually used: - Remove aab-parser; add maintained protobufjs ^7.6.3 and jszip ^3.10.1 as direct deps. - script/utils/aab-utils.ts: parseAabManifest() reproducing aab-parser's logic (jszip -> decode aapt.pb.XmlNode -> extract attributes), same shape/errors. - script/utils/aab-resources-descriptor.ts: exact aapt.pb schema embedded as a compiled JSON descriptor, so it ships through plain tsc with no .proto asset and no Configuration.proto import. - Swap the single call site in command-executor.ts. Verified: tsc clean; protobufjs gone from npm audit; differential test on a real 36MB app-release.aab shows byte-identical output between old aab-parser (protobufjs 6.11.x) and the vendored parser (7.6.5). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e06571d commit c48b070

5 files changed

Lines changed: 987 additions & 59 deletions

File tree

package-lock.json

Lines changed: 26 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
],
2525
"dependencies": {
2626
"@devicefarmer/adbkit-apkreader": "^3.2.4",
27-
"aab-parser": "^1.0.1",
2827
"adm-zip": "^0.5.16",
2928
"backslash": "^0.2.0",
3029
"bplist-parser": "^0.3.2",
@@ -34,13 +33,15 @@
3433
"email-validator": "^2.0.4",
3534
"gradle-to-js": "2.0.1",
3635
"jsonwebtoken": "^9.0.2",
36+
"jszip": "^3.10.1",
3737
"moment": "^2.29.4",
3838
"opener": "^1.5.2",
3939
"parse-duration": "1.1.0",
4040
"plist": "^3.1.0",
4141
"progress": "^2.0.3",
4242
"prompt": "^1.3.0",
4343
"properties": "^1.2.1",
44+
"protobufjs": "^7.6.3",
4445
"q": "~1.5.1",
4546
"recursive-fs": "2.1.0",
4647
"rimraf": "^2.5.1",

script/command-executor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import * as semver from "semver";
1515
import * as cli from "../script/types/cli";
1616
import sign from "./sign";
1717
const ApkReader = require("@devicefarmer/adbkit-apkreader");
18-
const aabParser = require("aab-parser");
18+
import { parseAabManifest } from "./utils/aab-utils";
1919
import {
2020
AccessKey,
2121
Account,
@@ -1564,7 +1564,7 @@ export const releaseNative = (command: cli.IReleaseNativeCommand): Promise<void>
15641564
} else if (targetBinaryPathNormalised.endsWith(".aab")) {
15651565
log(chalk.cyan(`\nExtracting AAB file:\n`));
15661566
await extractAAB(targetBinaryPath, extractFolder);
1567-
const { versionName: appStoreVersion, versionCode } = await aabParser.parseAabManifest(targetBinaryPath);
1567+
const { versionName: appStoreVersion, versionCode } = await parseAabManifest(targetBinaryPath);
15681568

15691569
const metadataZip = await extractMetadataFromAndroid(`${extractFolder}/base`, outputFolder); // base folder is nested in AAB
15701570
releaseCommandPartial = {

0 commit comments

Comments
 (0)