web/website/tests/cms-publication-access.test.mjs
Dev 484f121fcc
All checks were successful
DuneRealms Web CI / web (push) Successful in 3m6s
Restore CMS item publication and seal official treasury routing
2026-11-29 13:12:31 +01:00

4 lines
852 B
JavaScript

import test from 'node:test';import assert from 'node:assert/strict';import {publicationAccessPlan} from '../ops/cms-publication-access.mjs';
test('publication access is schema scoped, preserves immutable bindings and rejects injected identities',()=>{
const input={centralSchema:'central',gameSchema:'gameplay',centralIdentity:'site@127.0.0.1',bankIdentity:'bank@127.0.0.1'},sql=publicationAccessPlan(input).join(';');assert(!sql.includes('*.*'));assert(sql.includes('GRANT SELECT,INSERT ON `central`.jarvis_item_publications'));assert(!/UPDATE.*jarvis_item_publications/.test(sql));assert(!sql.includes('GRANT OPTION'));assert(sql.includes('UPDATE(category),DELETE'));for(const bad of [{centralSchema:'central;DROP'},{bankIdentity:"bank'@%"},{centralIdentity:'root@localhost@other'}])assert.throws(()=>publicationAccessPlan({...input,...bad}));
});