fix: redact three raw-error console sinks found in pass 2

Security audit pass 2 (step 6/6): the image-downscale fallback warn
and the two clipboard-copy error catches (notifications, video
settings) logged raw error objects; route them through redactError.

Co-Authored-By: Claude <bot@wafflenet.io>
This commit is contained in:
bot 2026-07-02 14:15:31 -07:00
parent 6548268f61
commit ec7e4e0184
No known key found for this signature in database
3 changed files with 6 additions and 5 deletions

View file

@ -8,7 +8,7 @@
* they fit under the limit before they ever reach the API.
*/
import { base64EncodedLength } from '../shared';
import { base64EncodedLength, redactError } from '../shared';
// Canonical home of the encoding helpers is now shared/encoding.ts (#251) so
// the audio module can reuse them; re-exported here for back-compat. Imported
@ -75,7 +75,7 @@ export async function preprocessImage(
try {
return await downscaleToFit(data, mediaType, maxBytes);
} catch (error) {
console.warn('[Synapse] Image downscale failed; sending original bytes:', error);
console.warn('[Synapse] Image downscale failed; sending original bytes:', redactError(error));
return { data, mediaType, downscaled: false };
}
}

View file

@ -1,5 +1,5 @@
import { Notice } from 'obsidian';
import { redactSecrets } from './redact';
import { redactSecrets, redactError } from './redact';
export type NoticeLevel = 'info' | 'progress' | 'success' | 'warning' | 'error';
@ -505,7 +505,7 @@ export class NotificationManager {
navigator.clipboard.writeText(redacted)
.then(() => this.info('Error copied to clipboard'))
.catch((err) => {
console.error('[Synapse] Could not copy error to clipboard:', err);
console.error('[Synapse] Could not copy error to clipboard:', redactError(err));
this.info("Couldn't copy error to clipboard");
});
});

View file

@ -1,4 +1,5 @@
import { Setting, setIcon } from 'obsidian';
import { redactError } from '../shared';
import type { SettingsSectionContext, NotificationManager } from '../shared';
/** A single copy-able install command shown in a path setting's help panel (#382/#383). */
@ -80,7 +81,7 @@ function buildInstallHelpPanel(
}, COPY_CONFIRM_MS);
})
.catch((err) => {
console.error('[Synapse] Could not copy install command:', err);
console.error('[Synapse] Could not copy install command:', redactError(err));
notifications.info("Couldn't copy to clipboard");
});
});