Skip to content

Guardrails / claude

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.

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

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.

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

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 them is a violation.--dangerously-skip-permissions,--allow-dangerously-skip-permissionsGUARDRAIL_INPUT_DANGEROUSFLAGS

How to fix ​

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

bash
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 ​

All 3 claude guardrails

Buildnote Limited
Registered in England and Wales, Reg: 16140412