Claude runs in CI without bypassing its permissions
claude/cli-safe-flags@v1
No Claude CLI invocation the build ran asked to skip its approval step.
| 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 doesn't gather anything itself. It relies on the collectors below, which the CLI runs once per build before any check, and reads what they found from GUARDRAIL_FACTS. If a collector collects nothing, this guardrail is skipped, not failed.
| Collector | Gathers | Inputs it is given |
|---|---|---|
commands | Every command the build executed, read from the session a running buildnote monitor records on the runner. 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 inputs, passed straight through to the collector. Setting one in buildnote.json changes what is collected, and two guardrails configured the same way share a single 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 them is a violation. | --dangerously-skip-permissions,--allow-dangerously-skip-permissions | GUARDRAIL_INPUT_DANGEROUSFLAGS |
How to fix
Remove --dangerously-skip-permissions from the invocation, and list the tools the job actually needs instead:
claude -p --output-format json --allowedTools "Read" "Grep" "Bash(git diff:*)" 'review this diff'The flag is meant for a sandbox you don't mind losing. In CI, it hands that freedom to a model reading a pull request someone outside the repository wrote, while it holds the runner's checkout, its environment and any credentials the job was given. A prompt hidden in a diff then becomes a command on the runner. --allowedTools gives the run what it needs and nothing more.
More in claude
claude/cli-structured-output. Every headless Claude CLI invocation the build ran asked for structured output.claude/instructions-symlinked.CLAUDE.mdis a symbolic link toAGENTS.md, not a second copy of it or missing altogether.