Private command diagnostics carry class and code, never a message
Soul pass 4, F1: a provider's 2xx refresh answer that was not JSON made JSON.parse quote the text around the fault, a refresh-token fragment among it, and the plane returned that message in the reply's diagnostics. Those travel outside the sealed envelope and Ghostlight logs them. The plane's diagnostic is now fixed text plus the error's class and code, through errorIdentity, which the failed-callback audit event now shares. Every provider body Heimdall parses goes through readProviderJson: a non-2xx answer or a body that is not JSON becomes a ProviderResponseError (status and code, provider_status or provider_body_not_json) and no parser message survives. This replaces ProviderHttpError and the separate parses in the Discord guild lookup and the YouTube channel lookup. Soul's canary probe is committed inverted: a refresh against a malformed 2xx body and against a 400 whose body holds the canary; no byte of it may appear in the reply or its decoded failure payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
efd11373b8
commit
698f5dfc0e
5 changed files with 180 additions and 29 deletions
|
|
@ -1542,13 +1542,29 @@ describe("the failed-callback audit event for a provider's HTTP refusal", () =>
|
|||
expect(failed[0]!.eventPayloadJson).toEqual({
|
||||
provider: "discord",
|
||||
mode: "sign_in",
|
||||
errorClass: "ProviderHttpError",
|
||||
errorCode: null,
|
||||
errorClass: "ProviderResponseError",
|
||||
errorCode: "provider_status",
|
||||
providerStatus: 401,
|
||||
});
|
||||
expect(JSON.stringify(failed)).not.toContain("CANARY");
|
||||
});
|
||||
|
||||
it("keeps a 2xx body that is not JSON out of the event, by class and code alone", async () => {
|
||||
const failed = await auditAfterTokenExchangeAnswers(
|
||||
() => new Response('{"access_token":"CANARYaccess","refresh_token":CANARYrefresh}', { status: 200 })
|
||||
);
|
||||
|
||||
expect(failed).toHaveLength(1);
|
||||
expect(failed[0]!.eventPayloadJson).toEqual({
|
||||
provider: "discord",
|
||||
mode: "sign_in",
|
||||
errorClass: "ProviderResponseError",
|
||||
errorCode: "provider_body_not_json",
|
||||
providerStatus: 200,
|
||||
});
|
||||
expect(JSON.stringify(failed)).not.toContain("CANARY");
|
||||
});
|
||||
|
||||
it("keeps no status that is not an HTTP status", async () => {
|
||||
const store = new InMemoryStore();
|
||||
const app = await buildApp({
|
||||
|
|
|
|||
Loading…
Reference in a new issue