fix(privacy): sanitize console error/warn to prevent PII leakage
CI / Build & Quality Checks (push) Successful in 10m39s
CI / Trigger Desktop Build (push) Successful in 7s

Replace raw error object logging (which may contain Matrix event
payloads, user IDs, or message bodies) with e.message-only strings
in three files:
- CallEmbed.ts: state update and event widget feed errors
- msgContent.ts: image/video element load failures and thumb errors
- RoomInput.tsx: GIF send failure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 19:24:52 -04:00
parent 9deeef6e8d
commit fb66c0ed90
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -725,7 +725,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
info: { mimetype: 'image/gif', w, h, size: blob.size }, info: { mimetype: 'image/gif', w, h, size: blob.size },
}); });
} catch (e) { } catch (e) {
console.error('GIF send failed', e); console.error('GIF send failed:', e instanceof Error ? e.message : 'unknown error');
if (!alive()) return; if (!alive()) return;
setGifError('Failed to send GIF. Please try again.'); setGifError('Failed to send GIF. Please try again.');
setTimeout(() => setGifError(null), 4000); setTimeout(() => setGifError(null), 4000);
+3 -3
View File
@@ -50,7 +50,7 @@ export const getImageMsgContent = async (
): Promise<IContent> => { ): Promise<IContent> => {
const { file, originalFile, encInfo, metadata } = item; const { file, originalFile, encInfo, metadata } = item;
const [imgError, imgEl] = await to(loadImageElement(getImageFileUrl(originalFile))); const [imgError, imgEl] = await to(loadImageElement(getImageFileUrl(originalFile)));
if (imgError) console.warn(imgError); if (imgError) console.warn('Failed to load image element:', imgError.message);
const content: IContent = { const content: IContent = {
msgtype: MsgType.Image, msgtype: MsgType.Image,
@@ -85,7 +85,7 @@ export const getVideoMsgContent = async (
const { file, originalFile, encInfo, metadata } = item; const { file, originalFile, encInfo, metadata } = item;
const [videoError, videoEl] = await to(loadVideoElement(getVideoFileUrl(originalFile))); const [videoError, videoEl] = await to(loadVideoElement(getVideoFileUrl(originalFile)));
if (videoError) console.warn(videoError); if (videoError) console.warn('Failed to load video element:', videoError.message);
const content: IContent = { const content: IContent = {
msgtype: MsgType.Video, msgtype: MsgType.Video,
@@ -109,7 +109,7 @@ export const getVideoMsgContent = async (
scaleYDimension(videoEl.videoWidth, 512, videoEl.videoHeight), scaleYDimension(videoEl.videoWidth, 512, videoEl.videoHeight),
); );
} }
if (thumbError) console.warn(thumbError); if (thumbError) console.warn('Failed to generate video thumbnail:', thumbError.message);
content.info = { content.info = {
...getVideoInfo(videoEl, file), ...getVideoInfo(videoEl, file),
...thumbContent, ...thumbContent,
+2 -2
View File
@@ -390,7 +390,7 @@ export class CallEmbed {
if (this.call === null) return; if (this.call === null) return;
const raw = ev.getEffectiveEvent(); const raw = ev.getEffectiveEvent();
this.call.feedStateUpdate(raw as IRoomEvent).catch((e) => { this.call.feedStateUpdate(raw as IRoomEvent).catch((e) => {
console.error('Error sending state update to widget: ', e); console.error('Error sending state update to widget:', e instanceof Error ? e.message : 'unknown error');
}); });
} }
@@ -496,7 +496,7 @@ export class CallEmbed {
} else { } else {
const raw = ev.getEffectiveEvent(); const raw = ev.getEffectiveEvent();
this.call.feedEvent(raw as IRoomEvent).catch((e) => { this.call.feedEvent(raw as IRoomEvent).catch((e) => {
console.error('Error sending event to widget: ', e); console.error('Error sending event to widget:', e instanceof Error ? e.message : 'unknown error');
}); });
} }
} }