Merge pull request #95 from JoasASantos/feat/web-auto-defaults

feat(web): surface auto-config defaults in the wizard
This commit is contained in:
Joas A Santos authored and GitHub committed 2026-12-02 13:16:11 -03:00
commit 2d8ffe70d0
4 files changed
+29 -11

No files matched your search

@@ -233,7 +233,7 @@ pub fn apply(cfg: &mut RunConfig, mcp: &mut bool, reactive_default: bool) {
"OPSEC evasion enabled — scan header dropped (disable: NEUROSPLOIT_NO_EVASION=1)",
);
}
if cfg.sandbox.is_none() {
if cfg.sandbox.is_none() && !env_present("NEUROSPLOIT_NO_SANDBOX") {
if let Some(rt) = sandbox_ready() {
cfg.sandbox = Some(String::new());
eprintln!(" [auto] sandbox enabled ({rt}: kalilinux/kali-rolling already present)");
+5 -4
View File
@@ -873,8 +873,9 @@ function renderReview() {
{ k: 'Out-of-band', v: state.authz.oobDomain ? `*.${state.authz.oobDomain}` : 'none — blind classes stay leads' },
{ k: 'Hard scope', v: (() => { const sc = collectScope(); return sc ? `${sc.hard.length} host rule(s) · ${sc.rateLimit || '∞'} req/min${sc.allowDestructive ? ' · writes allowed' : ''}` : 'Target only'; })() },
{ k: 'Intercept', v: $('#fieldIntercept').value === 'off' ? 'direct' : $('#fieldIntercept').value },
{ k: 'Sandbox', v: $('#fieldSandbox').value ? 'Kali container' : 'host' },
{ k: 'Sandbox', v: (() => { const v = $('#fieldSandbox').value; return v === 'auto' ? 'auto (Kali if available)' : v === 'default' ? 'Kali container' : 'this host'; })() },
{ k: 'PoC re-validation', v: $('#fieldRevalidatePoc').checked ? 'on' : 'off' },
{ k: 'OPSEC evasion', v: $('#fieldEvasion')?.checked ? 'on' : 'off' },
{ k: 'C2 / post-exploitation', v: $('#fieldC2')?.checked ? `on${$('#fieldC2Persistence')?.checked ? ' · persistence' : ''}${$('#fieldC2Lateral')?.checked ? ' · lateral' : ''}` : 'off' },
{ k: 'TypeSafe', v: $('#fieldTypesafe') ? $('#fieldTypesafe').value : 'auto' },
{ k: 'Compliance', v: (['fieldCompPci', 'fieldCompHipaa', 'fieldCompSoc2', 'fieldCompGdpr'].map((id) => $(`#${id}`).checked && $(`#${id}`).value).filter(Boolean).join(', ')) || 'none' },
@@ -933,8 +934,9 @@ async function startExploitation() {
// the same full run it was before this control existed.
budget: $('#fieldBudget').value,
intercept: $('#fieldIntercept').value,
sandbox: $('#fieldSandbox').value || undefined,
sandbox: $('#fieldSandbox').value,
revalidatePoc: $('#fieldRevalidatePoc').checked,
evasion: $('#fieldEvasion')?.checked ?? true,
typesafe: $('#fieldTypesafe') ? $('#fieldTypesafe').value : undefined,
compliance: ['fieldCompPci', 'fieldCompHipaa', 'fieldCompSoc2', 'fieldCompGdpr'].map((id) => $(`#${id}`).checked && $(`#${id}`).value).filter(Boolean),
tokenLimit: Number($('#fieldTokenLimit').value) || undefined,
@@ -9790,7 +9792,6 @@ const EXTRA_UI = [
{ key: 'agentTools', label: 'Agents can request tools', help: 'API-model agents may call catalog tools in a bounded loop.' },
{ key: 'workerTools', label: 'Worker tool loop', help: 'Reactive engine: each worker plans, runs real tools and observes.', needs: 'reactive' },
{ key: 'provision', label: 'Install missing tools', help: 'Allow apt / pipx / go installs for tools that are not present.' },
{ key: 'evasion', label: 'OPSEC / evasion', help: 'Drop the X-NeuroSploit-Scan header to reduce attribution (authorized stealth).' },
{ key: '_mcpLink', type: 'link' },
] },
{ group: 'Agents & models', items: [
@@ -9851,7 +9852,7 @@ function renderExtraOptions() {
${active && repl ? '<div class="callout xo-note">With these options on, the run starts without live input (you cannot type to it mid-run).</div>' : ''}
<div class="xo-groups">${EXTRA_UI.map((g) => { const items = g.items.map(field).join(''); return items ? `<div class="xo-group"><div class="xo-gt">${esc(g.group)}</div>${items}</div>` : ''; }).join('')}</div>`;
$('#btnFullPower', sec)?.addEventListener('click', () => {
state.extra = { ...state.extra, tools: true, agentTools: true, workerTools: true, provision: true, economy: true, evasion: true, checkpoints: 'record' };
state.extra = { ...state.extra, tools: true, agentTools: true, workerTools: true, provision: true, economy: true, checkpoints: 'record' };
renderExtraOptions();
if (typeof toast === 'function') toast('Full power enabled — review scope and authorization before launching.', 'info');
});
+4 -2
View File
@@ -853,7 +853,8 @@
</div>
<div class="field-group"><label class="field-label" for="fieldSandbox">Run commands in</label>
<select id="fieldSandbox">
<option value="" selected>This host</option>
<option value="auto" selected>Auto (Kali if available)</option>
<option value="host">This host</option>
<option value="default">Kali container</option>
</select>
</div>
@@ -865,7 +866,8 @@
</select>
</div>
</div>
<div class="check-row"><input type="checkbox" id="fieldRevalidatePoc" /> <label for="fieldRevalidatePoc">Re-run every PoC before reporting</label></div>
<div class="check-row"><input type="checkbox" id="fieldRevalidatePoc" checked /> <label for="fieldRevalidatePoc">Re-run every PoC before reporting</label></div>
<div class="check-row"><input type="checkbox" id="fieldEvasion" checked /> <label for="fieldEvasion">OPSEC evasion <span class="req">drop the scan header</span></label></div>
<div class="check-row"><input type="checkbox" id="fieldC2" /> <label for="fieldC2">Enable C2 / post-exploitation <span class="req">internal tests only</span></label></div>
<div class="c2-opts" id="c2Opts">
<input id="fieldC2Auth" type="text" placeholder="Authorization reference (SOW or ticket)" />
+19 -4
View File
@@ -657,6 +657,17 @@ function envOverrides() {
return env;
}
// The backend auto-enables revalidation / evasion / an already-present sandbox.
// When the operator explicitly turns one off in the wizard, translate that into
// the matching NEUROSPLOIT_NO_* opt-out for the child run.
function autoOptOutEnv(body) {
const env = {};
if (body.revalidatePoc === false) env.NEUROSPLOIT_NO_REVALIDATE = '1';
if (body.evasion === false) env.NEUROSPLOIT_NO_EVASION = '1';
if (body.sandbox === 'host') env.NEUROSPLOIT_NO_SANDBOX = '1';
return env;
}
async function cloudEnvOverrides(cloudProvider) {
if (!cloudProvider) return {};
const integs = await readConfig('integrations');
@@ -2216,8 +2227,10 @@ function buildArgs(body) {
if (body.sms) args.push('--sms', body.sms);
if (body.typesafe) args.push('--typesafe', body.typesafe);
if (body.intercept && body.intercept !== 'off') args.push('--intercept', body.intercept);
if (body.sandbox) args.push('--sandbox', body.sandbox === 'default' ? '' : body.sandbox);
if (body.sandbox === 'default') args.push('--sandbox', '');
else if (body.sandbox && !['auto', 'host'].includes(body.sandbox)) args.push('--sandbox', body.sandbox);
if (runOnly && body.revalidatePoc) args.push('--revalidate-poc');
if (body.evasion) args.push('--evasion');
if (runOnly) for (const fw of body.compliance || []) args.push('--compliance', fw);
// Authorization: the signed grant caps the scope, the extra in-scope entries
// can only narrow within it, and the environment scales every risk score.
@@ -2266,7 +2279,7 @@ async function startJob(body) {
jobs.set(id, job);
const cloudEnv = cloudProv ? await cloudEnvOverrides(cloudProv) : {};
const child = spawn(BIN, args, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...cloudEnv } });
const child = spawn(BIN, args, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...cloudEnv, ...autoOptOutEnv(body) } });
job.child = child;
let buf = '';
const onData = (chunk) => {
@@ -2324,7 +2337,9 @@ function authArgs(body) {
if (body.typesafe) args.push('--typesafe', body.typesafe);
if (body.decisionBackend) args.push('--decision-backend', body.decisionBackend);
if (body.intercept && body.intercept !== 'off') args.push('--intercept', body.intercept);
if (body.sandbox) args.push('--sandbox', body.sandbox === 'default' ? '' : body.sandbox);
if (body.sandbox === 'default') args.push('--sandbox', '');
else if (body.sandbox && !['auto', 'host'].includes(body.sandbox)) args.push('--sandbox', body.sandbox);
if (body.evasion) args.push('--evasion');
// C2 is global (launcher-level), like the authorization ceiling.
if (body.c2) {
if (body.c2Authorization) args.push('--c2-authorization', body.c2Authorization);
@@ -2434,7 +2449,7 @@ async function startJobViaRepl(body) {
// The REPL session inherits the engagement's authorization from argv, so the
// ceiling is set before the first command is scripted into it.
const child = spawn(BIN, auth, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...(body.allAgents ? { NEUROSPLOIT_ALL_AGENTS: '1' } : {}) } });
const child = spawn(BIN, auth, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...(body.allAgents ? { NEUROSPLOIT_ALL_AGENTS: '1' } : {}), ...autoOptOutEnv(body) } });
job.child = child;
let buf = '';
const onData = (chunk) => {