Skip to content

bug(platform): deleting the default connector credential promises no default but promotes another #3713

Closed

Description

@yannickmonney

P2 · Reproduced locally at d351611bdd942ffeed758147ccaf57e70877125a (origin/main, 2026-09-28) in Chromium against the real backend and PostgreSQL.

Deleting a connector's default credential shows this confirmation: "This is the default credential. Deleting it leaves no default until you pick another one." The server does the opposite. In the same transaction it makes the oldest remaining active credential of that connector the new default. No warning appears and nothing says which account took over.

Reproduction

  1. Hold two GitHub credentials: "Support bot" (Default) and "Release bot".
  2. Row menu of "Support bot" → Delete. Read the dialog, then confirm.
  3. Look at the table (or GET /api/app/connector-credentials).

Expected: Either no default remains and the table shows the "No default credential for GitHub" warning, as the dialog promised and as manual box CONN-F14 expects ("delete its default … Surfaced, never auto-fixed"). Or the dialog names the credential that will become the default before the admin confirms.

Actual: "Release bot" is the default immediately after the delete. No no-default warning appears.

User impact

The admin confirms a delete believing that calls which name no credential will stop, because they were told there would be no default. Those calls then keep running through a different account that nobody chose. With two mailboxes, repositories or stores, mail is sent from, or data changed in, the "other" account. Removing a compromised or wrong-account default this way silently routes traffic to whichever sibling is oldest.

Cause

  • The connector service promotes on delete: "deleting the DEFAULT promotes the oldest remaining ACTIVE row of the pair" (connector_credentials/service.ts:763–791).
  • The shared row menu falls back to credentials.deleteDefaultWarning whenever the adapter supplies no deleteWarning (credential-row-actions.tsx:232–234; copy at messages/en.yml:5651, de.yml:5464, fr.yml:5545).
  • That sentence is true for AI providers, where "nothing promotes another credential when the default goes" (provider_credentials/service.ts:849).
  • It is false for connectors: the connector adapter defines no deleteWarning.
  • The manual suite's CONN-F13/CONN-F14 repeat the provider rule for connectors.

Executable local proof and controls

probes/proof-delete-default.cjs (below) runs against fresh synthetic organizations. Frozen output at d351611bd:

setup: fresh org SA19bGEYOX8yubzpvfhYkvUpjsWFx49J; GitHub credentials = ["Release bot","Support bot [Default]"]
delete dialog for the default said: "Delete credential | Delete "Support bot"? Automations and chat actions using it lose access immediately. | This is the default credential. Deleting it leaves no default until you pick another one. | Cancel | Delete"
after confirming: GitHub credentials = ["Release bot [Default]"]; no-default alert shown: false
CONFIRMED the dialog promised no default would remain, but "Release bot" was silently made the default
control: default "Support bot" + disabled "Release bot"; after delete = ["Release bot [Disabled]"]
CONTROL a disabled sibling is not promoted, so there the warning is accurate

Control: when the only sibling is disabled, nothing is promoted and the dialog's sentence holds (CONTROL line). The promotion only happens when an active sibling exists, which is exactly the case where the warning matters.

Mocked boundary

None. Real SPA, backend and PostgreSQL; GitHub credentials hold synthetic tokens and are never used.

Local stack (loopback only): a detached worktree of d351611bd with bun install --frozen-lockfile; a fresh PostgreSQL 16.13 + pg_search 0.22.6 + pgvector 0.8.1 cluster bootstrapped like the tale-db image plus services/db/init-scripts; the backend from services/platform (node --experimental-transform-types --import ./backend/node-loader.mjs backend/main.ts, TALE_ROLE=all, PORT=3005, SITE_URL=http://localhost:3000, an empty TALE_CONFIG_DIR, TALE_CONFIG_BUILTIN_DIR=configs/platform/custom, TALE_DEV_SEED_USER=1, TALE_ALLOW_OPEN_SIGN_UP=true, locally generated ENCRYPTION_SECRET_HEX/BETTER_AUTH_SECRET); the SPA via TALE_BACKEND_URL=http://127.0.0.1:3005 bunx --bun vite --port 3000; Chromium 141 driven by the worktree's playwright-core 1.58.2. The backend ran with NODE_USE_ENV_PROXY=1 HTTPS_PROXY=HTTP_PROXY=http://127.0.0.1:9 NO_PROXY=127.0.0.1,localhost,::1, so every non-loopback fetch failed at a dead proxy: no real provider, mailbox or external service was reachable. Each proof mints its own synthetic organization through POST /api/auth/sign-up/email + POST /api/auth/organization/create.

Deduplication

  • Searched the bodies of all 1,035 issues in every state for promote/promotion and default, "leaves no default" and deleteDefaultWarning: no match.
  • Not in the debt ledgers or not-a-finding.md.
  • Found by the TALE-78 local audit.
probes/lib.cjs (shared helpers)
// Shared helpers for the TALE-78 local audit probes. Everything targets the local stack only:
// SPA http://localhost:3000 (proxying /api to the backend on :3005), fake vendor https://127.0.0.1:4443.
const { chromium } = require('/agent/.runtime/home/scratch/tale78/tale/node_modules/playwright-core');
const fs = require('node:fs');
const BASE = 'http://localhost:3000';
const ORIGIN = { origin: BASE };
const PW = 'TaleAudit!Passw0rd';
const USERS = {
  owner: { email: '[email protected]', password: 'TaleDev!Passw0rd' },
};
async function launch() {
  return chromium.launch({ executablePath: '/opt/ms-playwright/chromium-1194/chrome-linux/chrome', headless: true });
}
async function newContext(browser, opts = {}) {
  const context = await browser.newContext({ baseURL: BASE, ignoreHTTPSErrors: true, serviceWorkers: 'block', viewport: opts.viewport ?? { width: 1280, height: 900 }, locale: 'en-US' });
  return context;
}
async function signIn(context, who) {
  const u = typeof who === 'string' ? (USERS[who] ?? { email: who, password: PW }) : who;
  const r = await context.request.post('/api/auth/sign-in/email', { data: { email: u.email, password: u.password }, headers: ORIGIN });
  if (!r.ok()) throw new Error(`sign-in ${u.email} -> ${r.status()} ${await r.text()}`);
  return r.json();
}
async function api(context, method, path, data) {
  const r = await context.request.fetch(path, { method, data, headers: ORIGIN });
  let body = null;
  const text = await r.text();
  try { body = JSON.parse(text); } catch { body = text; }
  return { status: r.status(), body };
}
function watch(page, sink) {
  page.on('console', (m) => { if (['error', 'warning'].includes(m.type())) sink.push(`[console.${m.type()}] ${m.text().slice(0, 300)}`); });
  page.on('pageerror', (e) => sink.push(`[pageerror] ${String(e).slice(0, 300)}`));
  page.on('response', (r) => { if (r.status() >= 400 && r.url().includes('/api/')) sink.push(`[http ${r.status()}] ${r.request().method()} ${r.url().replace(BASE, '')}`); });
}
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
module.exports = { launch, newContext, signIn, api, watch, sleep, BASE, ORIGIN, PW, USERS, fs };

// ---- fresh synthetic organizations for self-contained proofs ------------------------------------
async function freshOrg(browser, label) {
  const stamp = `${label}-${Date.now().toString(36)}`;
  const email = `proof-${stamp}@tale.test`;
  const ctx = await newContext(browser);
  const su = await api(ctx, 'POST', '/api/auth/sign-up/email', { email, password: PW, name: `Proof ${label}` });
  if (su.status !== 200) throw new Error(`sign-up ${email}: ${su.status} ${JSON.stringify(su.body)}`);
  const org = await api(ctx, 'POST', '/api/auth/organization/create', { name: `Proof ${stamp}`, slug: `proof-${stamp}` });
  if (org.status !== 200) throw new Error(`org create: ${org.status} ${JSON.stringify(org.body)}`);
  await api(ctx, 'POST', '/api/auth/organization/set-active', { organizationId: org.body.id });
  return { ctx, orgId: org.body.id, email, stamp };
}
async function addMember(browser, owner, role) {
  const email = `proof-${owner.stamp}-${role}@tale.test`;
  const ctx = await newContext(browser);
  const su = await api(ctx, 'POST', '/api/auth/sign-up/email', { email, password: PW, name: `Proof ${role}` });
  const add = await api(owner.ctx, 'POST', `/api/app/members?orgId=${owner.orgId}`, { userId: su.body.user.id, role });
  if (add.status !== 200) throw new Error(`add member ${role}: ${add.status} ${JSON.stringify(add.body)}`);
  return { ctx, email, memberId: add.body.memberId };
}
const creds = async (ctx, orgId) => (await api(ctx, 'GET', `/api/app/connector-credentials?orgId=${orgId}`)).body.credentials;
const vendorControl = (q) => fetch(`https://127.0.0.1:4443/control?${q}`).then((r) => r.json());
const toasts = async (page) => (await page.locator('[role="region"] li').allInnerTexts()).map((s) => s.replace(/\s*\n+\s*/g, ' ').trim()).filter(Boolean);
const focusedDesc = (page) => page.evaluate(() => { const e = document.activeElement; if (!e || e === document.body) return 'BODY'; return `${e.tagName.toLowerCase()} "${(e.getAttribute('aria-label') || e.innerText || '').trim().split('\n')[0].slice(0, 50)}"`; });
Object.assign(module.exports, { freshOrg, addMember, creds, vendorControl, toasts, focusedDesc });
probes/proof-delete-default.cjs
// PROOF: the connector delete dialog says deleting the default "leaves no default until you pick another one",
// but the server promotes the oldest remaining ACTIVE credential of that connector to default in the same delete.
// Mocked boundary: none (real SPA, backend, Postgres).
const L = require('./lib.cjs');
const gh = async (ctx, o) => (await L.creds(ctx, o)).filter((c) => c.connectorSlug === 'github').map((c) => `${c.name}${c.isDefault ? ' [Default]' : ''}${c.status === 'disabled' ? ' [Disabled]' : ''}`);
async function deleteViaUi(page, o, name) {
  await page.goto(`/dashboard/${o}/settings/connectors`);
  await page.getByRole('button', { name: `Actions for ${name}` }).click();
  await page.getByRole('menuitem', { name: 'Delete' }).click();
  const dlg = page.getByRole('alertdialog').or(page.getByRole('dialog')).first();
  const text = (await dlg.innerText()).replace(/\s*\n+\s*/g, ' | ');
  await dlg.getByRole('button', { name: /^Delete$/ }).click();
  await page.waitForTimeout(1500);
  const alerts = (await page.getByRole('alert').allInnerTexts()).map((s) => s.replace(/\s+/g, ' '));
  return { text, alerts };
}
(async () => {
  const browser = await L.launch();
  const owner = await L.freshOrg(browser, 'deldef');
  const o = owner.orgId;
  const mk = async (name) => (await L.api(owner.ctx, 'POST', `/api/app/connector-credentials?orgId=${o}`, { connectorSlug: 'github', authMethod: 'bearer', name, secret: { token: `ghp_${name.replace(/\W/g, '')}_000000000000` } })).body.credentialId;
  await mk('Support bot'); await mk('Release bot');
  console.log(`setup: fresh org ${o}; GitHub credentials = ${JSON.stringify(await gh(owner.ctx, o))}`);
  const page = await owner.ctx.newPage();
  let r = await deleteViaUi(page, o, 'Support bot');
  console.log(`delete dialog for the default said: "${r.text}"`);
  const after = await gh(owner.ctx, o);
  console.log(`after confirming: GitHub credentials = ${JSON.stringify(after)}; no-default alert shown: ${r.alerts.some((a) => a.includes('No default'))}`);
  if (/leaves no default/.test(r.text) && after.includes('Release bot [Default]')) console.log('CONFIRMED the dialog promised no default would remain, but "Release bot" was silently made the default');
  // Control: when the only sibling is disabled, nothing is promoted and the dialog's sentence holds.
  const owner2 = await L.freshOrg(browser, 'deldef2');
  const o2 = owner2.orgId;
  const mk2 = async (name) => (await L.api(owner2.ctx, 'POST', `/api/app/connector-credentials?orgId=${o2}`, { connectorSlug: 'github', authMethod: 'bearer', name, secret: { token: `ghp_${name.replace(/\W/g, '')}_000000000000` } })).body.credentialId;
  await mk2('Support bot'); const second = await mk2('Release bot');
  await L.api(owner2.ctx, 'PATCH', `/api/app/connector-credentials/${second}?orgId=${o2}`, { status: 'disabled' });
  const page2 = await owner2.ctx.newPage();
  r = await deleteViaUi(page2, o2, 'Support bot');
  console.log(`control: default "Support bot" + disabled "Release bot"; after delete = ${JSON.stringify(await gh(owner2.ctx, o2))}`);
  console.log('CONTROL a disabled sibling is not promoted, so there the warning is accurate');
  await browser.close();
})().catch((e) => { console.error(e); process.exit(1); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions