Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions browse/src/read-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function handleReadCommand(
id: input.id || undefined,
placeholder: input.placeholder || undefined,
required: input.required || undefined,
value: input.value || undefined,
value: input.type === 'password' ? '[redacted]' : (input.value || undefined),
options: el.tagName === 'SELECT'
? [...(el as HTMLSelectElement).options].map(o => ({ value: o.value, text: o.text }))
: undefined,
Expand Down Expand Up @@ -184,7 +184,7 @@ export async function handleReadCommand(
const key = args[1];
const value = args[2] || '';
await page.evaluate(([k, v]) => localStorage.setItem(k, v), [key, value]);
return `Set localStorage["${key}"] = "${value}"`;
return `Set localStorage["${key}"]`;
}
const storage = await page.evaluate(() => ({
localStorage: { ...localStorage },
Expand Down
8 changes: 5 additions & 3 deletions browse/src/write-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export async function handleWriteCommand(
const text = args.join(' ');
if (!text) throw new Error('Usage: browse type <text>');
await page.keyboard.type(text);
return `Typed "${text}"`;
return `Typed ${text.length} characters`;
}

case 'press': {
Expand Down Expand Up @@ -153,7 +153,7 @@ export async function handleWriteCommand(
domain: url.hostname,
path: '/',
}]);
return `Cookie set: ${name}=${value}`;
return `Cookie set: ${name}=****`;
}

case 'header': {
Expand All @@ -163,7 +163,9 @@ export async function handleWriteCommand(
const name = headerStr.slice(0, sep).trim();
const value = headerStr.slice(sep + 1).trim();
await bm.setExtraHeader(name, value);
return `Header set: ${name}: ${value}`;
const sensitiveHeaders = ['authorization', 'cookie', 'set-cookie', 'x-api-key', 'x-auth-token'];
const redactedValue = sensitiveHeaders.includes(name.toLowerCase()) ? '****' : value;
return `Header set: ${name}: ${redactedValue}`;
}

case 'useragent': {
Expand Down