YoloGuard: AI Agent Permission-Bypass Flag Checker
Every AI coding agent has a flag that turns its safety checks off: claude --dangerously-skip-permissions, codex --yolo, gemini --approval-mode=yolo, cursor-agent --force, copilot --allow-all-tools. On a throwaway VM with no secrets that is fine. The trouble
is where these flags end up once a demo turns into a workflow:
on:
issues:
types: [opened]
permissions:
contents: write
jobs:
triage:
runs-on: ubuntu-latest
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
steps:
- uses: actions/checkout@v4
- run: claude -p "Triage this: ${{ github.event.issue.body }}" --dangerously-skip-permissions
Anyone who can open an issue now writes the prompt for an agent that runs any command it likes,
with your API key in its environment and a token that can push to the repository. The same flag in
a postinstall script, a Makefile target or a dev container that mounts ~/.ssh runs with the
credentials of whoever types npm install.
YoloGuard finds every launch of an AI agent CLI with a bypass flag in your workflows, scripts and
config files, and rates it by where it runs: a CI job with secrets, a write token or issue/PR
triggers, an untrusted prompt, your own machine, a container that mounts host credentials, or a
real sandbox.
What you see
- Problems and squiggles on the exact flag, with a message that says what the flag turns off,
what the context exposes (secrets, permissions, triggers, mounts) and the scoped mode to use.
- Quick Fixes (lightbulb) where the tool documents a scoped mode:
--permission-mode acceptEdits
or --permission-mode dontAsk for Claude Code, --sandbox workspace-write for Codex,
--approval-mode=auto_edit for Gemini CLI, --approval-mode auto-edit for Qwen Code,
--allow-tool=write for Copilot CLI. In argument lists (tasks.json args, compose lists,
Dockerfile exec form) the fix uses the single-argument --flag=value form. YoloGuard never
removes or edits secrets.
- Activity bar: a YoloGuard icon opens the Agent bypass flags view. Findings are grouped by
file and each row names the exact place, for example
ci.yml job triage: claude --dangerously-skip-permissions with ANTHROPIC_API_KEY + contents: write on issues
or devcontainer.json postCreateCommand: claude --dangerously-skip-permissions with ~/.ssh mounted.
Click a row to jump to the flag, or use the inline lightbulb button to apply its Quick Fix. A badge
on the icon shows the number of findings.
- Status bar:
YoloGuard: N. Click it to open the view.
Open files are checked as you type. The rest of the workspace is scanned in the background.
Rules
| ID |
Rule |
Default |
Example |
| YG001 |
Bypass agent in a CI job with secrets, write permissions or untrusted triggers |
Error |
claude --dangerously-skip-permissions in a job with secrets.* in its env, contents: write / id-token: write / write-all, or on pull_request_target, issues, issue_comment, workflow_run and other outsider-driven triggers |
| YG002 |
Bypass agent on a bare CI runner |
Warning |
codex exec --yolo straight on ubuntu-latest with no job container and open network; self-hosted runners are called out |
| YG003 |
Bypass agent in a script or task on the developer's machine |
Warning |
Shell scripts, Makefile targets, package.json scripts (install hooks flagged as running on every npm install), .vscode/tasks.json, Taskfile, lefthook and husky hooks, devcontainer initializeCommand (runs on the host) |
| YG004 |
Bypass agent inside a container or sandbox |
Information |
docker run ... claude --dangerously-skip-permissions, Dockerfile RUN / CMD, compose services, dev container lifecycle commands, CI job containers, runners with blocked egress |
| YG005 |
Bypass agent in a container that mounts host credentials |
Error |
Dev container postCreateCommand with ~/.ssh, ~/.aws, docker.sock (also via the docker-outside-of-docker feature) or --privileged; docker run -v ~/.ssh:...; compose volumes; RUN --mount=type=ssh |
| YG006 |
defaultMode: bypassPermissions in a committed project settings file |
Information |
.claude/settings.json. Claude Code ignores this value in project settings, so the line misleads readers, and it switches every check off if the file is passed with --settings |
| YG007 |
Untrusted issue or PR text flows into a bypass agent's prompt |
Error |
${{ github.event.issue.body }}, PR title/body, comment or review body, branch names and commit messages reaching the agent's arguments, stdin (pipes, here-strings, heredocs), shell variables or env: values, or the prompt input of an agent action |
Each rule's severity can be changed or turned off. Aider findings are one step lower than the
table, because --yes-always still asks before running shell commands.
Agents and flags
| Agent CLI |
Bypass flags and settings detected |
| Claude Code |
--dangerously-skip-permissions, --permission-mode bypassPermissions, --settings JSON with defaultMode: bypassPermissions, the claude_args and settings inputs of anthropics/claude-code-action |
| Codex CLI |
--dangerously-bypass-approvals-and-sandbox, --yolo, --sandbox / -s danger-full-access, -c sandbox_mode=danger-full-access, the sandbox and codex-args inputs of openai/codex-action. --full-auto keeps the sandbox and is not flagged |
| Gemini CLI |
--yolo, -y, --approval-mode=yolo |
| Qwen Code |
--yolo, -y, --approval-mode yolo |
| Cursor CLI |
cursor-agent (or agent -p) with --force, -f, --yolo |
| Copilot CLI |
--allow-all-tools, --allow-all, --yolo, COPILOT_ALLOW_ALL=true |
| Kiro CLI |
--trust-all-tools |
| OpenCode |
--auto |
| Aider |
--yes-always (and its --yes abbreviation), AIDER_YES_ALWAYS |
Every flag was checked against the tool's official documentation on 2026-10-24.
How commands are read
Commands are parsed like a shell would: quotes, escapes, \ line continuations, &&, ||, ;,
pipes, subshells, if / for bodies, comments and heredoc data. Wrappers are followed: FOO=1
prefixes, env, sudo, timeout, nohup, npx / bunx / pnpm dlx / yarn dlx / npm exec
with the agent's npm package, uvx / pipx run / uv tool run, sh -c / bash -lc strings,
doppler run -- style secret injectors, and docker run / podman run / docker compose run /
devcontainer exec (whose mounts decide between YG004 and YG005). Flags kept in a variable
(FLAGS=--yolo, Makefile $(AGENT_FLAGS), ${{ env.FLAGS }}) are expanded. Arguments after a
bare -- and text passed to echo or grep are never treated as flags.
Files checked
GitHub Actions workflows (.github/workflows/*.yml), composite action.yml, *.sh / *.bash /
*.zsh, Makefile / *.mk, package.json scripts, .vscode/tasks.json, Dockerfile /
Containerfile, compose.yml / docker-compose*.yml, devcontainer.json, Taskfile.yml,
lefthook.yml, .husky/* and .githooks/* hooks, and .claude/settings.json.
To accept a launch you have reviewed (for example inside a disposable VM), put
yologuard-ignore in a comment on the same line or the line above.
Settings
| Setting |
Default |
Description |
yoloGuard.enabled |
true |
Turn the checks on or off. |
yoloGuard.rules |
{} |
Severity per rule (error, warning, information, hint) or off, e.g. { "YG004": "hint" }. |
yoloGuard.agentCommands |
{} |
Your own wrapper or alias names and the agent they run, e.g. { "ai-fix": "claude" }. |
yoloGuard.maxFiles |
3000 |
Maximum number of files scanned. Files over 1 MB are skipped. |
yoloGuard.exclude |
node_modules, .git, dist, build, out, vendor, venv, .venv, coverage |
Glob patterns that are never scanned. node_modules, .git and vendor are always excluded. |
In an untrusted (Restricted Mode) workspace YoloGuard still runs, but it reads every one of its
settings from your user settings only, so a repository can not switch it off, silence a rule,
exclude its own files or declare new agent commands.
Commands
- YoloGuard: Show Agent Bypass Flags - open the view.
- YoloGuard: Rescan Workspace - scan again (also a button in the view title).
- YoloGuard: Open Settings
Privacy
No network, no telemetry. YoloGuard reads files inside your workspace, never follows symlinks out of
it, runs no child processes and changes files only when you apply a Quick Fix.
Limitations
- CI context is understood for GitHub Actions. Other CI systems are not read; their shell scripts
are checked when they live in
.sh files.
- Secrets are recognised from
${{ secrets.* }} and github.token expressions in the workflow,
job and step env, the command itself and agent action inputs. Secrets written to
$GITHUB_ENV in an earlier step, or exposed only through a checked-out token in .git/config,
are not traced.
- Untrusted text is followed into the agent's arguments, pipes, heredocs and variables in the same
step. Text written to a file in one step and read by the agent in another is not traced.
- Scripts are not followed across files: a workflow that runs
./scripts/agent.sh is reported in
agent.sh (as YG003), not in the workflow.
- Docker Compose based dev containers: mounts declared in the compose file are not linked to the
dev container's lifecycle commands.
- Agent flags change often. Flags added to a CLI after this release are not known yet.
References
License
MIT - included with the extension.
| |