fix(#709): make runtime approvals transport neutral
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
This commit is contained in:
@@ -134,8 +134,6 @@ 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;
|
||||||
@@ -196,27 +194,19 @@ export class CommandAuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private hasRuntimeTerminationAction(action: RuntimeTerminationApprovalAction): boolean {
|
private hasRuntimeTerminationAction(action: RuntimeTerminationApprovalAction): boolean {
|
||||||
return [
|
return [action.providerId, action.sessionId, action.agentName].every(
|
||||||
action.providerId,
|
(value: string): boolean => value.trim().length > 0,
|
||||||
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,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user