Skip to content

[luv-201] feat: add Infra Commands category with 7 opt-in policies (cuts 0.0.7)#202

Merged
NiveditJain merged 1 commit into
mainfrom
luv-201
Apr 27, 2026
Merged

[luv-201] feat: add Infra Commands category with 7 opt-in policies (cuts 0.0.7)#202
NiveditJain merged 1 commit into
mainfrom
luv-201

Conversation

@NiveditJain

Copy link
Copy Markdown
Member

Summary

  • Adds a new Infra Commands policy category with 7 opt-in policies that block infrastructure CLIs and CI/CD pipeline triggers: block-kubectl, block-terraform (terraform/tofu), block-aws-cli, block-gcloud, block-az-cli, block-helm, block-gh-pipeline.
  • All seven default to defaultEnabled: false and accept an allowPatterns param that reuses the existing matchesAllowedPattern helper (inherits its shell-operator-injection defenses, verified by the block-sudo allowPattern test suite).
  • block-gh-pipeline matches only mutating subcommands (workflow run/enable/disable, run rerun/cancel, pr merge, release create/delete, cache delete, secret set/delete). Read-only gh calls (gh pr view, gh run list, gh api ...) are intentionally allowed because failproofai's own workflow policies depend on them.
  • Cuts the 0.0.7 release: bumps package.json from 0.0.7-beta.00.0.7 and rolls the ## Unreleased changelog section into ## 0.0.7 — 2026-04-27.

Built-in policy count: 32 → 39. All seven new policies live under the exospherehost/ namespace.

Test plan

  • Unit tests: bun run test:run — 1043/1043 passing (added 41 tests across 7 new describe blocks)
  • Lint: bun run lint — clean (only pre-existing <img> warning in tool-input-output.tsx)
  • Typecheck: bunx tsc --noEmit — clean
  • E2E: bun run test:e2e — 207/207 passing
  • Local smoke test: failproofai p -i -c <custom> registers cleanly with new policies in the registry
  • Docker clean-install (oven/bun:latest + npm install -g failproofai-0.0.7.tgz --ignore-scripts): version reports 0.0.7, custom hook validated, opt-in default behavior verified (kubectl invocation passes through when policy is disabled)
  • Confirm block-gh-pipeline does NOT block read-only gh pr view, gh pr list, gh run list, gh api ... (covered by 4 explicit positive-allow tests)
  • Shell-injection defense: kubectl get pods; rm -rf / with allowPatterns: ["kubectl get *"] is still denied (the existing matchesAllowedPattern operator check handles it; replicated test from block-sudo)

🤖 Generated with Claude Code

…cut 0.0.7

Adds a new built-in policy category that prevents coding agents from
running infrastructure CLIs or triggering CI/CD pipelines without explicit
opt-in:

- block-kubectl, block-terraform (terraform/tofu), block-aws-cli,
  block-gcloud, block-az-cli, block-helm
- block-gh-pipeline targets only mutating gh subcommands (workflow run,
  pr merge, release create, etc.) — read-only forms used by other
  failproofai workflow policies remain allowed

All seven default to opt-in (defaultEnabled: false) and accept an
allowPatterns param that reuses the existing matchesAllowedPattern
helper, inheriting its shell-operator-injection defenses (verified by
the block-sudo allowPattern test suite).

Built-in policy count: 32 → 39. Bumps version 0.0.7-beta.0 → 0.0.7 and
cuts the 0.0.7 changelog section.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@NiveditJain has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 37 minutes and 17 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5cfa0628-8557-4f2f-a597-f8561be983e6

📥 Commits

Reviewing files that changed from the base of the PR and between fa53f75 and f4bb7cf.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • __tests__/hooks/builtin-policies.test.ts
  • docs/built-in-policies.mdx
  • package.json
  • src/hooks/builtin-policies.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch luv-201

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@NiveditJain NiveditJain merged commit 942777c into main Apr 27, 2026
9 checks passed
NiveditJain added a commit that referenced this pull request Apr 27, 2026
…fore-stop (#204)

The MERGED-PR reconciliation logic ran git fetch + git log + git diff
against origin/<base> to verify the work had shipped before allowing Stop.
Those probes assume regular-merge semantics (branch commits become
ancestors of base). They never converge for:

- Squash-merge: GitHub creates a new commit on base with rewritten
  parentage; the original branch commit is orphaned.
- Rebase-merge: same problem with different SHAs.
- Any post-merge change to base (release auto-bumps, follow-up commits):
  introduces extra diff that the probe reads as "work hasn't shipped".

All three applied when PR #202 was squash-merged and the publish workflow
auto-bumped main to 0.0.8-beta.0, producing the misleading deny:

  Pull request for branch "luv-201" is merged. Run now: gh pr create

Replace the 28-line reconciliation with a direct allow when state ===
MERGED — GitHub's PR state is itself authoritative proof the work shipped.
The allow message hints to switch off the branch (git checkout main &&
git pull) before stopping again.

Mirrors the fix shape from #196 for require-no-conflicts-before-stop.

Tests: regression test for the orphaned-commit + diverged-main scenario,
plus an assertion that the policy no longer invokes git fetch on MERGED
PRs. Removed the prior "denies when merged + diff" and "falls through to
deny when fetch fails" tests — both codified the buggy behavior.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant