19 lines
1.3 KiB
JavaScript
19 lines
1.3 KiB
JavaScript
import fs from 'node:fs/promises';
|
|
import assert from 'node:assert/strict';
|
|
const source = await fs.readFile('scripts/supplier-evaluation-check.mjs', 'utf8');
|
|
const common = source.slice(source.indexOf('const base ='), source.indexOf('const author ='));
|
|
await new Function('fs', 'assert', 'return (async()=>{' + common + `
|
|
const records=[];
|
|
for(const role of ['admin','warehouse']) {
|
|
const viewer=client(); await viewer.enter(role);
|
|
assert.equal((await viewer.request('/contexto','POST',{area:'procurement',option:'procurement.internal'})).status,302);
|
|
for(const path of ['/auditoria/eventos','/auditoria/eventos.csv']) {
|
|
const result=await viewer.request(path,'GET',undefined,false);
|
|
assert.equal(result.status,403);
|
|
records.push({role,path,status:result.status});
|
|
}
|
|
}
|
|
await fs.writeFile('docs/proofs/audit-metadata-http.json',JSON.stringify({checked_at:new Date().toISOString(),environment:base,result:'passed',records,pilot_grants_changed:false,business_commands:false,visual_review:false,coverage:'Denial before explicit permission; positive access exercised in disposable databases.'},null,2));
|
|
console.log('Auditoria recusa acesso no piloto sem nova competência explícita.');
|
|
` + '})()')(fs, assert);
|