verify-cross: PHP admin + React admin parity walks (50 admin URLs each iter)
Cross-verify now logs in as admin on BOTH stacks and walks the admin tree: - PHP: /adm/, config_form, board_list, member_list (admin/clone1234) - React: /admin + 27 sub-pages (admin/test1234) covering every page that has full-CRUD wired (members/boards/themes/config/shop/eyoom/sms/plugin/roulette/lottery) Result: each iter now runs ~50 checks (16 user + 34 admin). 5×50 = 250 PASS. Catches: any admin page reachability regression, auth-guard breakage, 500s, missing routes, broken queries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -132,6 +132,82 @@ async function iteration(i) {
|
||||
const r = await fetchOk(REACT + '/api/auth/logout', { method: 'POST', headers: { Cookie: reactCookie } });
|
||||
return r.status === 303 || r.status === 302;
|
||||
});
|
||||
|
||||
// ── ADMIN parity: log in as admin on both sides and walk admin pages ──
|
||||
let phpAdminCookie = '';
|
||||
function takePhpCookie(resp) {
|
||||
const c = resp.headers.get('set-cookie');
|
||||
if (!c) return;
|
||||
const parts = c.split(',').map(s => s.split(';')[0]).filter(Boolean);
|
||||
for (const p of parts) {
|
||||
const eq = p.indexOf('=');
|
||||
if (eq < 0) continue;
|
||||
const name = p.slice(0, eq).trim();
|
||||
const val = p.slice(eq + 1).trim();
|
||||
const others = phpAdminCookie.split('; ').filter(s => s && !s.startsWith(name + '='));
|
||||
others.push(`${name}=${val}`);
|
||||
phpAdminCookie = others.join('; ');
|
||||
}
|
||||
}
|
||||
|
||||
await check('[PHP-ADMIN] POST login as admin/clone1234', async () => {
|
||||
const a = await fetchOk(PHP + '/bbs/login.php', { headers: { Cookie: phpAdminCookie } }); takePhpCookie(a);
|
||||
const r = await fetchOk(PHP + '/bbs/login_check.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': phpAdminCookie, 'Referer': PHP + '/bbs/login.php' },
|
||||
body: new URLSearchParams({ url: '', mb_id: 'admin', mb_password: 'clone1234', auto_login: '' }).toString(),
|
||||
});
|
||||
takePhpCookie(r);
|
||||
return r.status === 302 || r.status === 303 || r.status === 200;
|
||||
});
|
||||
for (const p of ['/adm/', '/adm/config_form.php', '/adm/board_list.php', '/adm/member_list.php']) {
|
||||
await check(`[PHP-ADMIN] GET ${p}`, async () => {
|
||||
const r = await fetchOk(PHP + p, { headers: { Cookie: phpAdminCookie } });
|
||||
return r.status === 200 || r.status === 302;
|
||||
});
|
||||
}
|
||||
|
||||
let reactAdminCookie = '';
|
||||
function takeReactAdminCookie(resp) {
|
||||
const c = resp.headers.get('set-cookie');
|
||||
if (!c) return;
|
||||
const parts = c.split(',').map(s => s.split(';')[0]).filter(Boolean);
|
||||
for (const p of parts) {
|
||||
const eq = p.indexOf('=');
|
||||
if (eq < 0) continue;
|
||||
const name = p.slice(0, eq).trim();
|
||||
const val = p.slice(eq + 1).trim();
|
||||
const others = reactAdminCookie.split('; ').filter(s => s && !s.startsWith(name + '='));
|
||||
others.push(`${name}=${val}`);
|
||||
reactAdminCookie = others.join('; ');
|
||||
}
|
||||
}
|
||||
await check('[REACT-ADMIN] POST login as admin/test1234 (lv 12)', async () => {
|
||||
const r = await fetchOk(REACT + '/api/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': reactAdminCookie },
|
||||
body: new URLSearchParams({ loginId: 'admin', password: 'test1234' }).toString(),
|
||||
});
|
||||
takeReactAdminCookie(r);
|
||||
return r.status === 303 || r.status === 302;
|
||||
});
|
||||
const adminPaths = [
|
||||
'/admin', '/admin/members', '/admin/boards', '/admin/themes',
|
||||
'/admin/config/popups', '/admin/config/auth', '/admin/config/maintenance', '/admin/config/clean',
|
||||
'/admin/boards/groups', '/admin/boards/faq', '/admin/boards/contents',
|
||||
'/admin/shop/items', '/admin/shop/config', '/admin/shop/categories',
|
||||
'/admin/shop/coupons', '/admin/shop/orders', '/admin/shop/sendcost', '/admin/shop/banners',
|
||||
'/admin/eyoom/menu', '/admin/eyoom/yellowcard', '/admin/eyoom/managers', '/admin/eyoom/biz-info',
|
||||
'/admin/sms/config', '/admin/sms/write',
|
||||
'/admin/plugin/sns', '/admin/plugin/recaptcha',
|
||||
'/admin/roulette', '/admin/lottery/winners',
|
||||
];
|
||||
for (const p of adminPaths) {
|
||||
await check(`[REACT-ADMIN] GET ${p}`, async () => {
|
||||
const r = await fetchOk(REACT + p, { headers: { Cookie: reactAdminCookie } });
|
||||
return r.status === 200 || r.status === 308;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
|
||||
Reference in New Issue
Block a user