mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 01:31:23 +00:00
fix(macos): ensure exec approval prompt displays the command (#5042)
* fix(config): migrate audio.transcription with any CLI command Two bugs fixed: 1. Removed CLI allowlist from mapLegacyAudioTranscription - the modern config format has no such restriction, so the allowlist only blocked legacy migration of valid configs like whisperx-transcribe.sh 2. Moved audio.transcription migration to a separate migration entry - it was nested inside routing.config-v2 which early-exited when no routing section existed Closes #5017 * fix(macos): ensure exec approval prompt displays the command The NSStackView and NSScrollView for the command text lacked proper width constraints, causing the accessory view to collapse to zero width in some cases. This fix: 1. Adds minimum width constraint (380px) to the root stack view 2. Adds minimum width constraint to the command scroll view 3. Enables vertical resizing and scrolling for long commands 4. Adds max height constraint to prevent excessively tall prompts Closes #5038 * fix: validate legacy audio transcription migration input (openclaw#5042) thanks @shayan919293 * docs: add changelog note for legacy audio migration guard (openclaw#5042) thanks @shayan919293 * fix: satisfy lint on audio transcription migration braces (openclaw#5042) thanks @shayan919293 --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ export type LegacyConfigMigration = {
|
||||
apply: (raw: Record<string, unknown>, changes: string[]) => void;
|
||||
};
|
||||
|
||||
import { isSafeExecutableValue } from "../infra/exec-safety.js";
|
||||
import { isRecord } from "../utils.js";
|
||||
export { isRecord };
|
||||
|
||||
@@ -45,24 +46,27 @@ export const mergeMissing = (target: Record<string, unknown>, source: Record<str
|
||||
}
|
||||
};
|
||||
|
||||
const AUDIO_TRANSCRIPTION_CLI_ALLOWLIST = new Set(["whisper"]);
|
||||
|
||||
export const mapLegacyAudioTranscription = (value: unknown): Record<string, unknown> | null => {
|
||||
const transcriber = getRecord(value);
|
||||
const command = Array.isArray(transcriber?.command) ? transcriber?.command : null;
|
||||
if (!command || command.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const rawExecutable = String(command[0] ?? "").trim();
|
||||
if (typeof command[0] !== "string") {
|
||||
return null;
|
||||
}
|
||||
if (!command.every((part) => typeof part === "string")) {
|
||||
return null;
|
||||
}
|
||||
const rawExecutable = command[0].trim();
|
||||
if (!rawExecutable) {
|
||||
return null;
|
||||
}
|
||||
const executableName = rawExecutable.split(/[\\/]/).pop() ?? rawExecutable;
|
||||
if (!AUDIO_TRANSCRIPTION_CLI_ALLOWLIST.has(executableName)) {
|
||||
if (!isSafeExecutableValue(rawExecutable)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const args = command.slice(1).map((part) => String(part));
|
||||
const args = command.slice(1);
|
||||
const timeoutSeconds =
|
||||
typeof transcriber?.timeoutSeconds === "number" ? transcriber?.timeoutSeconds : undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user