feat: multi-layer skill guardrails, file:// blocking, and k8s-cost-visibility skill#25
Merged
initializ-mk merged 2 commits intomainfrom Mar 11, 2026
Merged
feat: multi-layer skill guardrails, file:// blocking, and k8s-cost-visibility skill#25initializ-mk merged 2 commits intomainfrom
initializ-mk merged 2 commits intomainfrom
Conversation
The phone pattern \b\d{3}[-.]?\d{3}[-.]?\d{4}\b matched bare 10-digit
numbers like Kubernetes memory byte values (e.g., 4294967296 = 4 GiB),
causing tool output to be blocked by the no_pii guardrail. Changing
[-.]? to [-.] requires at least one separator, so 123-456-7890 still
matches but 4294967296 does not.
…, file:// blocking, runtime fallback
Security hardening for skill-based agents:
- Runtime skill guardrails: load guardrails from SKILL.md at runtime so they
fire without `forge build`; fall back to runtime-parsed rules when no build
artifact exists
- Block file:// protocol in cli_execute validateArg() to prevent host filesystem
reads via curl file:///etc/passwd
- Filter denied shells (bash, sh, etc.) from cli_execute schema/description so
the LLM never advertises them as available
- deny_prompts: input-side guardrail that blocks capability-enumeration probes
("what approved tools do you have") via BeforeLLMCall hook
- deny_responses: output-side guardrail that replaces LLM responses containing
3+ binary name enumerations with skill-defined functional redirects via
AfterLLMCall hook
- Remove binary names from cli_execute Description() and system prompt catalog
to prevent the LLM from regurgitating internal tooling
- Add k8s-pod-rightsizer skill with guardrails; remove bash from its bins
- Add comprehensive tests for all new guardrail types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
forge build, using a fallback path when no build artifact existsfile://protocol blocking —validateArg()in cli_execute now blocksfile://URLs (case-insensitive) to prevent host filesystem reads viacurl file:///etc/passwdbash,sh,zshetc. are stripped from cli_execute's schema/description so the LLM never advertises them as availabledeny_promptsguardrail — input-side guardrail that intercepts capability-enumeration probes ("what approved tools do you have") viaBeforeLLMCallhook before the LLM sees themdeny_responsesguardrail — output-side guardrail that replaces LLM responses containing 3+ binary name enumerations with skill-defined functional redirects viaAfterLLMCallhookDescription()and skill catalog hint no longer list binary names, preventing the LLM from regurgitating internal toolingbashfrom bins, added full guardrails (deny_commands, deny_output, deny_prompts, deny_responses)Guardrail data flow
Test plan
go build ./...passes in all three modulesgo test ./...passes in all three modulesgolangci-lint runreports 0 issues in all modulesforge run(no build) →cli_execute kubectl auth can-i --list→ blocked by skill guardrailcli_execute curl file:///etc/passwd→ blocked by validateArg