add security hardening features (#543)

* add security hardening features

- Add authentication vault (`auth save/login/list/show/delete`) so credentials are stored locally and never exposed to the LLM (fixes Snyk W007)
- Add `--content-boundaries` flag to wrap page-sourced output in structural markers, helping LLMs distinguish tool output from untrusted page content (fixes Snyk W011)
- Add `--allowed-domains` flag to restrict browser navigation to trusted domains
- Add `--action-policy` for static allow/deny gating of action categories, with opt-in `--confirm-actions`/`--confirm-interactive` for orchestrator or human-in-the-loop confirmation
- Add `--max-output` flag to truncate large page outputs, preventing context flooding
- New docs page at /security, updated README, SKILL.md, CLI help text, and templates

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* docs
This commit is contained in:
Chris Tate
2026-02-25 15:33:20 -06:00
committed by GitHub
parent c0e2b80f8c
commit bc1e917e87
28 changed files with 3444 additions and 476 deletions
+10 -3
View File
@@ -5,7 +5,7 @@ import * as os from 'os';
import { BrowserManager } from './browser.js';
import { IOSManager } from './ios-manager.js';
import { parseCommand, serializeResponse, errorResponse } from './protocol.js';
import { executeCommand } from './actions.js';
import { executeCommand, initActionPolicy } from './actions.js';
import { executeIOSCommand } from './ios-actions.js';
import { StreamServer } from './stream-server.js';
import {
@@ -333,6 +333,9 @@ export async function startDaemon(options?: {
// Clean up expired state files on startup
runCleanupExpiredStates();
// Initialize action policy enforcement
initActionPolicy();
// Determine provider from options or environment
const provider = options?.provider ?? process.env.AGENT_BROWSER_PROVIDER;
const isIOS = provider === 'ios';
@@ -595,9 +598,13 @@ export async function startDaemon(options?: {
processQueue().catch((err) => {
// Socket write failures during queue processing are non-fatal;
// the client has likely disconnected.
console.warn('[warn] processQueue error:', err?.message ?? err);
// Only log err.message to avoid leaking sensitive fields (e.g. passwords) from command objects.
console.warn('[warn] processQueue error:', err?.message ?? String(err));
if (process.env.AGENT_BROWSER_DEBUG === '1') {
console.error('[DEBUG] processQueue error (full):', err);
console.error(
'[DEBUG] processQueue error stack:',
err?.stack ?? err?.message ?? String(err)
);
}
});
});