Merge fb35d46f9d9842aa85185a0c135dd6e94ff0db35 into 598f1826d8b2bc969aace2c6459824737667218c
This commit is contained in:
commit
0f82a5b7b0
@ -316,6 +316,24 @@ export function createExecApprovalHandlers(
|
||||
}
|
||||
const approvalId = resolvedId.id;
|
||||
const snapshot = manager.getSnapshot(approvalId);
|
||||
// Security: prevent self-approval — the connection that submitted the request
|
||||
// cannot also resolve it. This blocks prompt-injected agents from immediately
|
||||
// approving their own dangerous command requests without human oversight.
|
||||
if (
|
||||
snapshot?.requestedByConnId != null &&
|
||||
client?.connId != null &&
|
||||
client.connId === snapshot.requestedByConnId
|
||||
) {
|
||||
respond(
|
||||
false,
|
||||
undefined,
|
||||
errorShape(
|
||||
ErrorCodes.INVALID_REQUEST,
|
||||
"requester cannot approve their own exec request",
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const resolvedBy = client?.connect?.client?.displayName ?? client?.connect?.client?.id;
|
||||
const ok = manager.resolve(approvalId, decision, resolvedBy ?? null);
|
||||
if (!ok) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user