@@ -19,11 +19,25 @@ export async function verifyNativeReviewHttp(origin, fixture, { assets, snapshot
|
||||
const reviewer = client();
|
||||
const auditor = client();
|
||||
const requester = client();
|
||||
const privateAuditor = client();
|
||||
await reviewer.login(fixture.synthetic_login);
|
||||
await auditor.login(fixture.synthetic_metadata_login);
|
||||
await requester.login(fixture.synthetic_requester_login);
|
||||
await privateAuditor.login(fixture.synthetic_private_audit_login);
|
||||
// Login/logout may legitimately rotate native authentication fields. Compare the read window only.
|
||||
const before = await snapshot();
|
||||
const privateAudit = await privateAuditor.page('/auditoria/privada', 'audit/private');
|
||||
check(privateAudit.props.families.length === 4 && privateAudit.props.exports.data.length === 0, 'dedicated private authority opens approved families without generating a package');
|
||||
for (const actor of [reviewer, auditor, requester]) check((await actor.request('/auditoria/privada')).status === 403, 'other authorities cannot open private audit');
|
||||
check((await privateAuditor.request('/orcamentos')).status === 403, 'private audit never grants native financial workspace');
|
||||
const operationalOrders = await reviewer.page('/ordens-operacionais', 'requisitions/operational-orders');
|
||||
check((await auditor.request('/ordens-operacionais')).status === 403, 'metadata authority never grants operational order register access');
|
||||
check(operationalOrders.props.canConfigure === true && operationalOrders.props.policy === null, 'native admin can configure origin but a GET does not select an origin');
|
||||
const ownOperationalOrders = await requester.page('/ordens-operacionais', 'requisitions/operational-orders');
|
||||
check(ownOperationalOrders.props.canConfigure === false && ownOperationalOrders.props.allowedTypes.length === 0, 'requester receives no production workshop or procurement order creation grant');
|
||||
const urgentStock = await reviewer.page(`/requisicoes/${fixture.historical_decision_request}/urgencia-stock`, 'requisitions/urgent-stock');
|
||||
check(urgentStock.props.eligible.length === 0, 'ordinary historical source receives no implicit urgent reduction');
|
||||
check((await requester.request(`/requisicoes/${fixture.historical_decision_request}/urgencia-stock`)).status === 403, 'request ownership does not grant stock threshold preparation or quotation oversight');
|
||||
const budgets = await reviewer.page('/orcamentos', 'budgets/index');
|
||||
check(budgets.props.budgets.length > 0, 'native synthetic budget is visible to its authorised reader');
|
||||
const budgetHeaders = await reviewer.request('/orcamentos');
|
||||
@@ -93,10 +107,24 @@ export async function verifyNativeReviewHttp(origin, fixture, { assets, snapshot
|
||||
check(await csv(reviewer) === await csv(auditor), 'both metadata grants export the same scoped metadata without private context');
|
||||
const after = await snapshot();
|
||||
check(JSON.stringify(before) === JSON.stringify(after), 'all native table rows and columns unchanged during read window');
|
||||
const auditInput = {operation_key: crypto.randomUUID(), families: ['purchasing', 'stock', 'finance', 'configuration'], purpose: 'Owned synthetic native QA export'};
|
||||
await privateAuditor.post('/auditoria/privada', auditInput);
|
||||
const prepared = await privateAuditor.page('/auditoria/privada', 'audit/private');
|
||||
check(prepared.props.exports.data.length === 1, 'one private package prepared after the unchanged read window');
|
||||
const packageRow = prepared.props.exports.data[0];
|
||||
const download = await privateAuditor.request(packageRow.download_url);
|
||||
check(download.status === 200 && download.headers.get('Cache-Control')?.includes('no-store'), 'authenticated private package download');
|
||||
const bytes = Buffer.from(await download.arrayBuffer());
|
||||
check(bytes.length === packageRow.size && crypto.createHash('sha256').update(bytes).digest('hex') === packageRow.sha256, 'native download bytes match immutable package size and SHA256');
|
||||
await privateAuditor.post('/auditoria/privada', auditInput);
|
||||
const replay = await privateAuditor.page('/auditoria/privada', 'audit/private');
|
||||
check(replay.props.exports.data.length === 1 && replay.props.exports.data[0].sha256 === packageRow.sha256, 'replay preserves the same archive');
|
||||
check((await auditor.request(packageRow.download_url)).status === 403, 'metadata cannot download private package');
|
||||
await reviewer.logout();
|
||||
await auditor.logout();
|
||||
await requester.logout();
|
||||
return { checks, fortify_sessions: 3, missing_csrf_refused: true, stale_inertia_version_refused: true, supply_views: 9, purchase_control_views: 2, requester_scope_verified: true, encrypted_history_verified: true,
|
||||
budget_view_verified: true, conflict_index_verified: true, stock_views_verified: 2, equipment_view_verified: true, investment_view_verified: true, company_configuration_verified: true, metadata_scope_isolation_verified: true, readonly_tables_equal: Object.keys(before).length,
|
||||
private_asset_verified: true, private_assets_verified: assets.length, business_commands_sent: 0, browser_visual_acceptance: false };
|
||||
await privateAuditor.logout();
|
||||
return { checks, fortify_sessions: 4, missing_csrf_refused: true, stale_inertia_version_refused: true, supply_views: 9, purchase_control_views: 2, requester_scope_verified: true, encrypted_history_verified: true,
|
||||
budget_view_verified: true, conflict_index_verified: true, stock_views_verified: 2, equipment_view_verified: true, investment_view_verified: true, company_configuration_verified: true, operational_orders_verified: true, urgent_stock_verified: true, metadata_scope_isolation_verified: true, readonly_tables_equal: Object.keys(before).length,
|
||||
private_asset_verified: true, private_assets_verified: assets.length, business_commands_sent: 0, audit_export_commands_sent: 2, private_audit_download_verified: true, browser_visual_acceptance: false };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user