ceeb0d1edf66
fix: accept wsPort:0 as valid no-port sentinel in manifest validation (v4.7.8)
- time
- 2026-08-01 17:08 UTC · 2 months ago
- machine
- koh2
- parent
- f17d073716b4
↓ peach-browser-ceeb0d1e.tar.gzatlas at this save
files changed5 files
manifest.firefox.json+1 −1manifest.json+1 −1package.json+1 −1src/shared/device-manifest.test.ts+26 −0src/shared/device-manifest.ts+1 −1manifest.firefox.json+1 −1
@@ -1,7 +1,7 @@11 {22 "manifest_version": 3,33 "name": "Peach Password Manager",4- "version": "4.7.7",4+ "version": "4.7.8",55 "description": "Zero-knowledge password manager",66 "browser_specific_settings": {77 "gecko": {manifest.json+1 −1
@@ -2,7 +2,7 @@22 "manifest_version": 3,33 "minimum_chrome_version": "116",44 "name": "Peach Password Manager",5- "version": "4.7.7",5+ "version": "4.7.8",66 "description": "Zero-knowledge password manager",77 "action": {88 "default_popup": "src/popup/index.html",package.json+1 −1
@@ -1,6 +1,6 @@11 {22 "name": "peach",3- "version": "4.7.7",3+ "version": "4.7.8",44 "description": "Zero-knowledge password manager",55 "license": "GPL-3.0-only",66 "type": "module",src/shared/device-manifest.test.ts+26 −0
@@ -225,4 +225,30 @@225225 expect(got).toContain('"wsPort":49142');226226 expect(got).toContain('"relayUrl":"wss://relay.peachpasswords.com"');227227 });228+229+ it("preserves wsPort:0 in canonical bytes (Android sends 0 as no-port sentinel)", () => {230+ const got = canonicalise({231+ deviceId: "peer-1",232+ deviceName: "Peer One",233+ deviceType: "extension",234+ longTermPublicKeyHex: "aa".repeat(32),235+ signingPublicKeyHex: "bb".repeat(32),236+ pairedAt: 1_700_000_000_000,237+ wsPort: 0,238+ });239+ expect(got).toContain('"wsPort":0');240+ });241+});242+243+describe("verifyDeviceManifest accepts wsPort:0", () => {244+ it("does not reject wsPort:0 as malformed (Android Int default = no port)", async () => {245+ const kp = await deriveSyncSigningKeypair(MASTER_KEY, ISSUER_DEVICE_ID);246+ const e: ManifestDeviceEntry = {247+ ...entry(),248+ wsPort: 0,249+ };250+ const m = await buildSignedDeviceManifest(ISSUER_DEVICE_ID, [e], kp.privateKey);251+ const body = await verifyDeviceManifest(m, kp.publicKeyRaw);252+ expect(body.devices[0].wsPort).toBe(0);253+ });228254 });src/shared/device-manifest.ts+1 −1
@@ -155,7 +155,7 @@155155 (156156 typeof d.wsPort !== "number" ||157157 !Number.isInteger(d.wsPort) ||158- d.wsPort < 1 ||158+ d.wsPort < 0 ||159159 d.wsPort > 65535160160 )161161 ) {