← Back to PRs

#23783: Tools: add strict allowlist mode and fail closed on unknown entries

by bmendonca3 open 2026-02-22 17:54 View on GitHub →
agents size: S trusted-contributor
## Summary - add `tools.allowMode` with two modes: `strict` (default) and `compat` - fail closed when any `tools.allow` policy contains unknown tool/group entries in strict mode - keep legacy warning-only behavior when `tools.allowMode="compat"` - thread the mode through tool policy pipeline resolution ## Why This removes a hardening foot-gun where restrictive-looking allowlists containing unknown plugin tools could silently degrade into broader core-tool access. ## Tests - `pnpm vitest run src/agents/tool-policy-pipeline.test.ts src/config/config.tools-allow-mode.test.ts src/config/config.tools-alsoAllow.test.ts src/agents/pi-tools.policy.test.ts` - `pnpm lint` <!-- greptile_comment --> <h3>Greptile Summary</h3> Added `tools.allowMode` configuration with two modes: `strict` (default) and `compat`. In strict mode, unknown tool/group entries in allowlists now cause an error instead of just a warning, preventing a security foot-gun where restrictive-looking allowlists containing unknown plugin tools could silently degrade into broader core-tool access. **Key changes:** - New `tools.allowMode` config field with `strict` (default) and `compat` modes - `strict` mode throws error on unknown allowlist entries with clear remediation message - `compat` mode preserves legacy warning-only behavior - Mode threaded through tool policy pipeline from config to `applyToolPolicyPipeline` - Comprehensive test coverage including validation tests - Documentation added to schema help and labels <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The implementation is well-designed with proper error handling, backwards compatibility via `compat` mode, comprehensive test coverage, and clear documentation. The default behavior (strict mode) improves security by failing closed on unknown allowlist entries, while the compat mode provides an escape hatch for existing configurations. - No files require special attention <sub>Last reviewed commit: ae17ee8</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs