Skip to content

Commit c60be71

Browse files
committed
test(plugin-security): order the same-named copy first so the global-grant pin can fail
The SQL driver returns the by-name read ordered by id, and the global row's id sorted first, so the global-grant pin stayed green against the unscoped read. The other organization's copy now sorts first. Claude-Session: https://claude.ai/code/session_01XY5uCwTjZj7884yYtyur4H Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2b4e67b commit c60be71

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎packages/plugins/plugin-security/src/orgless-position-name-fold.test.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,15 @@ async function boot(): Promise<ObjectQL> {
154154
}, SYS);
155155
await insertSet(e, 'ps_global_ops_lead', 'ops_lead', null, ['probe.global_ops_lead']);
156156
// (2) a global user grant to a global set, beside ORG_OTHER's same-named
157-
// copy inserted FIRST — an unordered read meets the copy first.
158-
await insertSet(e, 'ps_other_platform_ops', 'platform_ops', ORG_OTHER, ['probe.other_platform_ops']);
159-
await insertSet(e, 'ps_global_platform_ops', 'platform_ops', null, ['probe.global_platform_ops']);
157+
// copy. The copy's id SORTS FIRST (`ps_0_…` before `ps_1_…`) and the
158+
// SQL driver's read comes back ordered by id, so an unscoped read meets
159+
// the copy first. With the ids the other way round this pin stays green
160+
// against the unscoped read (measured by its ablation), so the order is
161+
// load-bearing.
162+
await insertSet(e, 'ps_0_other_platform_ops', 'platform_ops', ORG_OTHER, ['probe.other_platform_ops']);
163+
await insertSet(e, 'ps_1_global_platform_ops', 'platform_ops', null, ['probe.global_platform_ops']);
160164
await e.insert('sys_user_permission_set', {
161-
id: 'ups_global_platform_ops', user_id: USER_GLOBAL, permission_set_id: 'ps_global_platform_ops', organization_id: null,
165+
id: 'ups_global_platform_ops', user_id: USER_GLOBAL, permission_set_id: 'ps_1_global_platform_ops', organization_id: null,
162166
}, SYS);
163167
return engine;
164168
}

0 commit comments

Comments
 (0)