fix(ipc): validate base64 format in audio:save schema (#250) - #267
Merged
tbrandenburg merged 2 commits intoAug 31, 2026
Conversation
|
tbrandenburg
deleted the
fix/250-audio-save-base64-validation-integrated
branch
August 31, 2026 04:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues fixed
Closes #250
Summary
audio:save's handler wrappedBuffer.from(base64Audio, "base64")in atry/catch, but Node's lenient base64 decoder never throws, so the catch was dead code. Malformed base64 payloads silently wrote a garbage.webmfile to disk instead of surfacing an error..refine()tosaveRecordingSchema.base64Audioinsrc/shared/schemas.tsvalidating base64 charset/padding/length (^[A-Za-z0-9+/]*={0,2}$+ length % 4 === 0) before any decode/write happens.try/catcharoundBuffer.frominsrc/main/ipc.ts'saudio:savehandler, since validation now happens at the schema boundary.src/main/ipc.test.tsasserting malformed base64 is rejected with a clear error and no file is written toos.tmpdir().Validation commands run
npx vitest run src/main/ipc.test.ts src/shared/schemas.test.ts→ 40/40 passednpx tsc --noEmit -p tsconfig.json && npx tsc --noEmit -p tsconfig.main.json→ cleannpx vitest run(full suite) → 422 passed, 15 pre-existing failures confined tosrc/main/model/*(model catalog/registry tests), confirmed to fail identically onmainbefore this change (unrelated, likely network-dependent fixtures)E2E coverage
No dedicated E2E test added; this is an IPC-boundary validation fix covered by the existing
src/main/ipc.test.tsintegration-style test (invokes the real IPC handler registry, not mocked), which is the appropriate test layer for this change per repo conventions (renderer only ever sends real base64 fromMediaRecorder, so this path isn't reachable through the normal UI flow — see issue for severity rationale).Risks / follow-ups
"resolves a bundled extension's provider on the chat path... (issues #211, #212)") that passed on immediate re-run; not reproduced during coordinator's final full-suite run, so no action taken. The 15src/main/model/*test failures are pre-existing onmainand unrelated to this change; no new issue filed since they already fail onmainwithout any modification.