Skip to content

Commit ffca0df

Browse files
os-trumpclaude
andauthored
fix(plugin-auth): repoint stale last-admin-ban-guard.ts citations (#16575)
Five source comments in packages/plugins/plugin-auth/src/ cited last-admin-ban-guard.ts / last-admin-ban-guard.test.ts, filenames that have not existed since the guard was renamed to last-admin-guard.ts. Repoint the four straightforward rename citations, and — after reading the test before repointing it, per the non-mechanical instruction on this card — repoint the objectql-adapter.test.ts:456 citation to last-admin-guard.test.ts, which is where the 403 arm (PERMISSION_DENIED -> APIError statusCode 403, via createObjectQLAdapterFactory) is actually pinned; last-admin-guard.re-pricing.test.ts and .config-anchor.test.ts contain no matching assertion. No behaviour change. CHANGELOG.md's historical hits are untouched. Claude-Session: https://claude.ai/code/session_012zTkyNHJ7TkuN2oXtP5x37 Co-authored-by: Claude <noreply@anthropic.com>
1 parent f2f6684 commit ffca0df

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/plugins/plugin-auth/src/break-glass-local-credential.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* invariant — pinned, not implemented.
66
*
77
* #5892 asked for two things. The ban half was missing and is built in
8-
* `last-admin-ban-guard.ts`; this half — "`enforced` SSO must never disable the
8+
* `last-admin-guard.ts`; this half — "`enforced` SSO must never disable the
99
* last local admin's password" — was **already implemented** on `origin/main`
1010
* and had no test of its own, which is the state that lets a security
1111
* behaviour be refactored away without anything going red. So this file adds
@@ -287,7 +287,7 @@ describe('[#5892] the last local password login survives ban / remove / delete',
287287
};
288288

289289
// A blocked legitimate removal is the cost here; a locked-out environment
290-
// is the cost in `last-admin-ban-guard.ts`. Different failure modes,
290+
// is the cost in `last-admin-guard.ts`. Different failure modes,
291291
// different directions — see that file's header.
292292
await expect(
293293
config.hooks!.before!(hookCtx('/admin/ban-user', { userId: 'usr_owner' }, adapter)),

packages/plugins/plugin-auth/src/invitation-role-cap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function orgRoleGrade(raw: unknown): number {
9898
* a hand-written copy drops the comma-joined (`'owner,member'`) and array
9999
* spellings `parseOrgRoles` handles, and on a security path that difference is
100100
* silent. Second consumer, and the reason this is exported: the break-glass
101-
* ban guard (`last-admin-ban-guard.ts`, cloud ADR-0024 D5.2), which counts the
101+
* ban guard (`last-admin-guard.ts`, cloud ADR-0024 D5.2), which counts the
102102
* administrators an environment would have left after a ban — a guard that
103103
* mistook the only owner for an ordinary member would wave the lockout
104104
* through.

packages/plugins/plugin-auth/src/objectql-adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ describe('withValidationErrorMapping – ObjectQL ValidationError → better-aut
453453

454454
// "Unclassified" — an error carrying neither the validation envelope nor the
455455
// `PERMISSION_DENIED` policy-refusal code the break-glass guards throw
456-
// (ADR-0024 D5.2; the 403 arm is pinned in `last-admin-ban-guard.test.ts`).
456+
// (ADR-0024 D5.2; the 403 arm is pinned in `last-admin-guard.test.ts`).
457457
// A driver fault is exactly that, and it must NOT be dressed up as a 4xx.
458458
it('re-throws unclassified errors verbatim (not remapped to an APIError)', async () => {
459459
const boom = new Error('driver exploded');

packages/plugins/plugin-auth/src/objectql-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ function isObjectQLValidationError(
534534
* the guards live in this package but throw a plain engine-shaped error so that
535535
* BOTH transports can map it — `mapDataError` gives the REST data routes a 403,
536536
* this gives the auth pipeline one. The concrete case is the break-glass
537-
* last-administrator ban guard (ADR-0024 D5.2, `last-admin-ban-guard.ts`):
537+
* last-administrator ban guard (ADR-0024 D5.2, `last-admin-guard.ts`):
538538
* without this arm, an over-broad SCIM deprovision would be refused correctly
539539
* and then reported to the IdP as an opaque 500, which is the one thing a guard
540540
* whose whole product is an explanation must not do.

0 commit comments

Comments
 (0)