Patron support sync keeps Bifrost's answer by status alone
Soul pass 4, F2: the route stored Bifrost's whole response body in its audit event and returned it to the caller, as `detail` on a refusal and as `bifrostResponse` on success. Another service's body can quote the signed fact or its own configuration. Both audit events now carry bifrostStatus and no body; a refusal answers 502 with fixed text and Bifrost's status; success answers bifrostStatus in place of the body, which no caller reads (Bifrost's docs name only the route). The body is discarded unread. Tests drive the route against a Bifrost that answers 200 and 403 with the canary in its body, and pin the reply and the audit event exactly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b5b980578c
commit
2e06678301
2 changed files with 54 additions and 11 deletions
10
src/app.ts
10
src/app.ts
|
|
@ -1689,7 +1689,10 @@ export async function buildApp(options: BuildAppOptions = {}): Promise<FastifyIn
|
|||
},
|
||||
body,
|
||||
});
|
||||
const bifrostBody = await bifrostResponse.text();
|
||||
// Bifrost's answer is kept by its status alone, in the audit event and
|
||||
// in the reply: another service's body can quote the signed fact or
|
||||
// its own configuration, and both of those are stored and relayed.
|
||||
await bifrostResponse.body?.cancel();
|
||||
|
||||
await store.createAuditEvent({
|
||||
accountId: request.body.accountId,
|
||||
|
|
@ -1700,7 +1703,6 @@ export async function buildApp(options: BuildAppOptions = {}): Promise<FastifyIn
|
|||
requiredTierTitle: request.body.requiredTierTitle,
|
||||
providerEventId: supportFact.providerEventId,
|
||||
bifrostStatus: bifrostResponse.status,
|
||||
bifrostResponse: bifrostBody,
|
||||
},
|
||||
createdAt: now,
|
||||
});
|
||||
|
|
@ -1710,14 +1712,14 @@ export async function buildApp(options: BuildAppOptions = {}): Promise<FastifyIn
|
|||
return {
|
||||
error: "bifrost_patron_support_rejected",
|
||||
statusCode: bifrostResponse.status,
|
||||
detail: bifrostBody,
|
||||
detail: "Bifrost refused the patron support fact.",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
status: "synced",
|
||||
supportFact,
|
||||
bifrostResponse: bifrostBody,
|
||||
bifrostStatus: bifrostResponse.status,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue