Revert "fix(#709): make runtime approvals transport neutral"
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful

This reverts commit a4c70c5a71.
This commit is contained in:
Jarvis
2026-07-13 01:33:27 -05:00
parent a4c70c5a71
commit 485e24a06a

View File

@@ -134,6 +134,8 @@ export class CommandAuthorizationService {
if ( if (
!this.isRuntimeTerminationApproval(approval) || !this.isRuntimeTerminationApproval(approval) ||
approval.actionDigest !== this.runtimeActionDigest(action) || approval.actionDigest !== this.runtimeActionDigest(action) ||
approval.actorId !== action.actorId ||
approval.tenantId !== action.tenantId ||
!this.isUnexpired(approval.expiresAt) !this.isUnexpired(approval.expiresAt)
) { ) {
return false; return false;
@@ -194,19 +196,27 @@ export class CommandAuthorizationService {
} }
private hasRuntimeTerminationAction(action: RuntimeTerminationApprovalAction): boolean { private hasRuntimeTerminationAction(action: RuntimeTerminationApprovalAction): boolean {
return [action.providerId, action.sessionId, action.agentName].every( return [
(value: string): boolean => value.trim().length > 0, action.providerId,
); action.sessionId,
action.actorId,
action.tenantId,
action.channelId,
action.correlationId,
action.agentName,
].every((value: string): boolean => value.trim().length > 0);
} }
private runtimeActionDigest(action: RuntimeTerminationApprovalAction): string { private runtimeActionDigest(action: RuntimeTerminationApprovalAction): string {
return createHash('sha256') return createHash('sha256')
.update( .update(
JSON.stringify({ JSON.stringify({
// Exact action identity is transport-neutral. Discord actor/correlation
// remain immutable audit metadata on the record, not its consume key.
providerId: action.providerId, providerId: action.providerId,
sessionId: action.sessionId, sessionId: action.sessionId,
actorId: action.actorId,
tenantId: action.tenantId,
channelId: action.channelId,
correlationId: action.correlationId,
agentName: action.agentName, agentName: action.agentName,
}), }),
) )