Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(privacy): scrub api keys + tokens from feedback console-log bundle

Louis Beaumont4253ed2bdee5
diff --git a/apps/screenpipe-app-tauri/app/layout.tsx b/apps/screenpipe-app-tauri/app/layout.tsx
index 27b3af9d8..5687cec9c 100644
--- a/apps/screenpipe-app-tauri/app/layout.tsx
+++ b/apps/screenpipe-app-tauri/app/layout.tsx
@@ -133,16 +133,59 @@ export default function RootLayout({
const originalConsole = { ...console };
const debouncedWrite = createDebouncer(1000);
+ // Belt-and-suspenders: scrub well-known secret-bearing keys before they
+ // hit localStorage. Any `console.log(settings)` (recording page, agents,
+ // OAuth flows) used to leak deepgramApiKey, aiPresets[].apiKey,
+ // openaiCompatibleApiKey, and the user's Clerk JWT into feedback bundles.
+ // Scrubbing here means future debug logs can't reintroduce the leak even
+ // if someone forgets and dumps an object containing these keys.
+ const SECRET_KEYS = new Set([
+ "apiKey",
+ "deepgramApiKey",
+ "openaiCompatibleApiKey",
+ "openrouterApiKey",
+ "anthropicApiKey",
+ "openaiApiKey",
+ "geminiApiKey",
+ "groqApiKey",
+ "elevenLabsApiKey",
+ "token",
+ "accessToken",
+ "refreshToken",
+ "idToken",
+ "secret",
+ "clientSecret",
+ "password",
+ "authorization",
+ ]);
+ const stringifyRedacted = (arg: unknown): string => {
+ if (typeof arg !== "object" || arg === null) {
+ return String(arg);
+ }
+ try {
+ return JSON.stringify(arg, (key, value) => {
+ if (
+ SECRET_KEYS.has(key) &&
+ typeof value === "string" &&
+ value.length > 0
+ ) {
+ return "[redacted]";
+ }
+ return value;
+ });
+ } catch {
+ return "[unserializable]";
+ }
+ };
+
["log", "error", "warn", "info"].forEach((level) => {
(console[level as keyof Console] as any) = (...args: any[]) => {
// Call original first for performance
(originalConsole[level as keyof Console] as Function)(...args);
- // Add to memory buffer
+ // Add to memory buffer (with secret keys scrubbed)
logs.push(
- `[${level.toUpperCase()}] ${args
- .map((arg) => (typeof arg === "object" ? JSON.stringify(arg) : arg))
- .join(" ")}`
+ `[${level.toUpperCase()}] ${args.map(stringifyRedacted).join(" ")}`
);
// Trim buffer if needed
diff --git a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
index 619cf095c..c3de2a6c6 100644
--- a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
@@ -692,11 +692,8 @@ export function RecordingSettings() {
throw new Error(`Failed to fetch audio devices: ${audioResult.error}`);
}
const audioDevices = audioResult.data;
- console.log("audioDevices", audioDevices);
setAvailableAudioDevices(audioDevices);
- console.log("settings", settings);
-
// Update monitors — match by stable ID, with backward compat for old numeric IDs
// and fuzzy fallback when only position changed (name+resolution still match)
const availableStableIds = monitors.map((m) => m.stableId);
@@ -812,8 +809,6 @@ export function RecordingSettings() {
});
try {
- console.log("Applying settings:", settings);
-
if (!settings.analyticsEnabled) {
posthog.capture("telemetry", {
enabled: false,