Claude runs in CI without bypassing its permissions
claude/cli-safe-flags@v1
No Claude CLI invocation the build executed asked for its approval step to be skipped.
| Id | claude/cli-safe-flags |
| Version | v1 |
| Category | claude |
| Default severity | error |
| Interpreter | python3 |
| Timeout | 30 seconds |
| Violations tolerated | 0 |
| Collects | commands |
Collectors
This guardrail gathers nothing itself. It depends on the collectors below, which the CLI runs once per build before any check, and reads what they found out of GUARDRAIL_FACTS. A collector that collects nothing skips this guardrail rather than failing it.
| Collector | Gathers | Inputs it is given |
|---|---|---|
commands | Every command the build executed, read from the session a running buildnote monitor records on the runner. Gathering is dynamic rather than static: this is what the job actually ran, not what a pipeline file says it would run. | none |
The inputs above are this guardrail's own, passed straight through. Configuring one in buildnote.json changes what is collected, and two guardrails configured the same way share the one collection.
Configuration
{
"guardrails": {
"failOn": "error",
"checks": [
{
"use": "claude/cli-safe-flags@v1",
"severity": "error",
"with": {
"dangerousFlags": "--dangerously-skip-permissions,--allow-dangerously-skip-permissions"
},
"exemptions": []
}
]
}
}Inputs
| Input | Description | Default | Environment variable |
|---|---|---|---|
dangerousFlags | Comma separated flags that remove the approval step, any one of which is a violation. | --dangerously-skip-permissions,--allow-dangerously-skip-permissions | GUARDRAIL_INPUT_DANGEROUSFLAGS |
How to fix
Remove --dangerously-skip-permissions from the invocation and name the tools the job actually needs instead:
claude -p --output-format json --allowedTools "Read" "Grep" "Bash(git diff:*)" 'review this diff'The flag exists for a sandbox nobody minds losing. In CI it is granted to a model reading a pull request somebody outside the repository wrote, holding the runner's checkout, its environment and whatever credentials the job was given: a prompt in a diff is then a command on the runner. --allowedTools grants the same run what it needs and nothing else.
More in claude
claude/cli-structured-output. Every headless Claude CLI invocation the build executed asked for structured output.claude/instructions-symlinked.CLAUDE.mdis a symbolic link toAGENTS.mdrather than a second copy of it or nothing at all.