Skip to content
BETAGuardrails are in beta. The library, the configuration format and the CLI command can still change.

Guardrails / claude

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.

Idclaude/cli-safe-flags
Versionv1
Categoryclaude
Default severityerror
Interpreterpython3
Timeout30 seconds
Violations tolerated0
Collectscommands

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.

CollectorGathersInputs it is given
commandsEvery 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

json
{
  "guardrails": {
      "failOn": "error",
      "checks": [
          {
              "use": "claude/cli-safe-flags@v1",
              "severity": "error",
              "with": {
                  "dangerousFlags": "--dangerously-skip-permissions,--allow-dangerously-skip-permissions"
              },
              "exemptions": []
          }
      ]
  }
}

Inputs

InputDescriptionDefaultEnvironment variable
dangerousFlagsComma separated flags that remove the approval step, any one of which is a violation.--dangerously-skip-permissions,--allow-dangerously-skip-permissionsGUARDRAIL_INPUT_DANGEROUSFLAGS

How to fix

Remove --dangerously-skip-permissions from the invocation and name the tools the job actually needs instead:

bash
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

All 3 claude guardrails

Buildnote Limited
Registered in England and Wales, Reg: 16140412