fix: harden permissions matching and alias caching (#1027)
This commit is contained in:
@@ -11678,6 +11678,12 @@ Plan file path: ${planFilePath}`;
|
||||
allowPersistence={
|
||||
currentApprovalContext?.allowPersistence ?? true
|
||||
}
|
||||
defaultScope={
|
||||
currentApprovalContext?.defaultScope === "user"
|
||||
? "session"
|
||||
: (currentApprovalContext?.defaultScope ??
|
||||
"project")
|
||||
}
|
||||
showPreview={showApprovalPreview}
|
||||
/>
|
||||
) : ln.kind === "user" ? (
|
||||
@@ -11757,6 +11763,11 @@ Plan file path: ${planFilePath}`;
|
||||
allowPersistence={
|
||||
currentApprovalContext?.allowPersistence ?? true
|
||||
}
|
||||
defaultScope={
|
||||
currentApprovalContext?.defaultScope === "user"
|
||||
? "session"
|
||||
: (currentApprovalContext?.defaultScope ?? "project")
|
||||
}
|
||||
showPreview={showApprovalPreview}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -68,6 +68,7 @@ type Props = {
|
||||
approveAlwaysText?: string;
|
||||
allowPersistence?: boolean;
|
||||
showPreview?: boolean;
|
||||
defaultScope?: "project" | "session";
|
||||
|
||||
// Special handlers for ExitPlanMode
|
||||
onPlanApprove?: (acceptEdits: boolean) => void;
|
||||
@@ -215,6 +216,7 @@ export const ApprovalSwitch = memo(
|
||||
precomputedDiff,
|
||||
allDiffs,
|
||||
showPreview = true,
|
||||
defaultScope = "project",
|
||||
}: Props) => {
|
||||
const toolName = approval.toolName;
|
||||
|
||||
@@ -251,6 +253,7 @@ export const ApprovalSwitch = memo(
|
||||
isFocused={isFocused}
|
||||
approveAlwaysText={approveAlwaysText}
|
||||
allowPersistence={allowPersistence}
|
||||
defaultScope={defaultScope}
|
||||
showPreview={showPreview}
|
||||
/>
|
||||
);
|
||||
@@ -271,6 +274,7 @@ export const ApprovalSwitch = memo(
|
||||
isFocused={isFocused}
|
||||
approveAlwaysText={approveAlwaysText}
|
||||
allowPersistence={allowPersistence}
|
||||
defaultScope={defaultScope}
|
||||
showPreview={showPreview}
|
||||
/>
|
||||
);
|
||||
@@ -340,6 +344,7 @@ export const ApprovalSwitch = memo(
|
||||
isFocused={isFocused}
|
||||
approveAlwaysText={approveAlwaysText}
|
||||
allowPersistence={allowPersistence}
|
||||
defaultScope={defaultScope}
|
||||
showPreview={showPreview}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -22,6 +22,7 @@ type Props = {
|
||||
approveAlwaysText?: string;
|
||||
allowPersistence?: boolean;
|
||||
showPreview?: boolean;
|
||||
defaultScope?: "project" | "session";
|
||||
};
|
||||
|
||||
// Horizontal line character for Claude Code style
|
||||
@@ -44,6 +45,7 @@ export const InlineBashApproval = memo(
|
||||
approveAlwaysText,
|
||||
allowPersistence = true,
|
||||
showPreview = true,
|
||||
defaultScope = "project",
|
||||
}: Props) => {
|
||||
const [selectedOption, setSelectedOption] = useState(0);
|
||||
const {
|
||||
@@ -107,7 +109,7 @@ export const InlineBashApproval = memo(
|
||||
if (selectedOption === 0) {
|
||||
onApprove();
|
||||
} else if (selectedOption === 1 && allowPersistence) {
|
||||
onApproveAlways("project");
|
||||
onApproveAlways(defaultScope);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -123,7 +125,7 @@ export const InlineBashApproval = memo(
|
||||
return;
|
||||
}
|
||||
if (input === "2" && allowPersistence) {
|
||||
onApproveAlways("project");
|
||||
onApproveAlways(defaultScope);
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -45,6 +45,7 @@ type Props = {
|
||||
approveAlwaysText?: string;
|
||||
allowPersistence?: boolean;
|
||||
showPreview?: boolean;
|
||||
defaultScope?: "project" | "session";
|
||||
};
|
||||
|
||||
// Horizontal line characters for Claude Code style
|
||||
@@ -160,6 +161,7 @@ export const InlineFileEditApproval = memo(
|
||||
approveAlwaysText,
|
||||
allowPersistence = true,
|
||||
showPreview = true,
|
||||
defaultScope = "project",
|
||||
}: Props) => {
|
||||
const [selectedOption, setSelectedOption] = useState(0);
|
||||
const {
|
||||
@@ -268,7 +270,7 @@ export const InlineFileEditApproval = memo(
|
||||
onApprove(diffsToPass.size > 0 ? diffsToPass : undefined);
|
||||
} else if (selectedOption === 1 && allowPersistence) {
|
||||
onApproveAlways(
|
||||
"project",
|
||||
defaultScope,
|
||||
diffsToPass.size > 0 ? diffsToPass : undefined,
|
||||
);
|
||||
}
|
||||
@@ -286,7 +288,7 @@ export const InlineFileEditApproval = memo(
|
||||
}
|
||||
if (input === "2" && allowPersistence) {
|
||||
onApproveAlways(
|
||||
"project",
|
||||
defaultScope,
|
||||
diffsToPass.size > 0 ? diffsToPass : undefined,
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -17,6 +17,7 @@ type Props = {
|
||||
approveAlwaysText?: string;
|
||||
allowPersistence?: boolean;
|
||||
showPreview?: boolean;
|
||||
defaultScope?: "project" | "session";
|
||||
};
|
||||
|
||||
// Horizontal line character for Claude Code style
|
||||
@@ -58,6 +59,7 @@ export const InlineGenericApproval = memo(
|
||||
approveAlwaysText,
|
||||
allowPersistence = true,
|
||||
showPreview = true,
|
||||
defaultScope = "project",
|
||||
}: Props) => {
|
||||
const [selectedOption, setSelectedOption] = useState(0);
|
||||
const {
|
||||
@@ -121,7 +123,7 @@ export const InlineGenericApproval = memo(
|
||||
if (selectedOption === 0) {
|
||||
onApprove();
|
||||
} else if (selectedOption === 1 && allowPersistence) {
|
||||
onApproveAlways("project");
|
||||
onApproveAlways(defaultScope);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -136,7 +138,7 @@ export const InlineGenericApproval = memo(
|
||||
return;
|
||||
}
|
||||
if (input === "2" && allowPersistence) {
|
||||
onApproveAlways("project");
|
||||
onApproveAlways(defaultScope);
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user