mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
fix(rotation): OAuth client ids are identifiers, never rotated (CLI 0.16.2) (#299)
c0upons CoinPay sign-in broke with `invalid_client: Invalid client_id`. c0upons--prod's COINPAY_CLIENT_ID held the same value as COINPAY_API_KEY, and a rotation writes every vault:key with the value's fingerprint, whatever the key is called. The 2026-11-22 coinpay-api-key run minted a new cp_live_ key, wrote it into COINPAY_CLIENT_ID too, and saved the rotator state as __ROTATE__COINPAY_CLIENT_ID (targets[0] was the client id), so the plan showed the client id as provider/coinpay/automatic from then on. - New method `identifier`: every *_CLIENT_ID (COINPAY_CLIENT_ID, *_OAUTH_CLIENT_ID, GOOGLE_CLIENT_ID...) gets it from the catalog, never automatic, with the reason. A __ROTATE__ entry claiming otherwise is ignored and reported in the plan with the command to reset it. - rotate-keys never writes a rotated value into a client id under another name (named in the result instead), records rotator state under the plan's own key, and skips a client id outright. - coinpay-api-key and coinpay-webhook-secret refuse a client id in preflight and mint without calling CoinPay. - rotation-set refuses random/provider/command/ssh-keygen for a client id. - Tests for each; docs/rotation.md. Co-authored-by: riotcoder <riotcoder@profullstack.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
41ad9f0987
commit
267973f439
11 changed files with 215 additions and 19 deletions
|
|
@ -340,3 +340,18 @@ describe("postgres-role", () => {
|
|||
expect(rewriteUrls({ A: "postgres://u:old@h/d", B: "postgres://u:other@h/d", C: "plain" }, "old", "n w")).toEqual({ A: "postgres://u:n%20w@h/d" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("CoinPay rotators never touch OAuth client ids", () => {
|
||||
it("refuses COINPAY_CLIENT_ID in preflight and mint without calling CoinPay", async () => {
|
||||
const { fetch, calls } = fakeFetch(() => ({ status: 200, body: { businesses: [] } }));
|
||||
const env = { COINPAY_ROTATE_TOKEN: "session" };
|
||||
for (const key of ["COINPAY_CLIENT_ID", "COINPAY_OAUTH_CLIENT_ID", "C0UPONS_COINPAY_CLIENT_ID"]) {
|
||||
const c = ctx({ key, oldValue: "cp_live_0123456789abcdef", fetch, env, vaultValues: { COINPAY_API_KEY: "cp_live_x" } });
|
||||
expect(await coinpayApiKeyRotator.preflight(c)).toMatch(/OAuth client id/);
|
||||
await expect(coinpayApiKeyRotator.mint(c)).rejects.toThrow(/OAuth client id/);
|
||||
expect(await coinpayWebhookSecretRotator.preflight(c)).toMatch(/OAuth client id/);
|
||||
await expect(coinpayWebhookSecretRotator.mint(c)).rejects.toThrow(/OAuth client id/);
|
||||
}
|
||||
expect(calls).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue