You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`AfterToolExec` hooks can modify `hctx.ToolOutput` to redact sensitive content before it enters the LLM context. The agent loop reads back `ToolOutput` from the `HookContext` after all hooks fire.
79
79
80
-
The runner registers a guardrail hook that scans tool output for secrets and PII patterns. See [Tool Output Scanning](security/guardrails.md#tool-output-scanning) for details.
80
+
The runner registers a guardrail hook that scans tool output for secrets and PII patterns. The hook passes `hctx.ToolName` to the guardrail engine, enabling per-tool exemptions via `allow_tools` config. See [Tool Output Scanning](security/guardrails.md#tool-output-scanning) for details.
Copy file name to clipboardExpand all lines: docs/security/guardrails.md
+35-2Lines changed: 35 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ All four built-in guardrails (`content_filter`, `no_pii`, `jailbreak_protection`
75
75
76
76
## Tool Output Scanning
77
77
78
-
The guardrail engine scans tool output via an `AfterToolExec` hook, catching secrets and PII before they enter the LLM context or outbound messages.
78
+
The guardrail engine scans tool output via an `AfterToolExec` hook, catching secrets and PII before they enter the LLM context or outbound messages. The hook passes the tool name to enable per-tool exemptions (see [Per-Tool PII Exemptions](#per-tool-pii-exemptions) below).
79
79
80
80
| Guardrail | What it detects in tool output |
81
81
|-----------|-------------------------------|
@@ -86,11 +86,44 @@ The guardrail engine scans tool output via an `AfterToolExec` hook, catching sec
86
86
87
87
| Mode | Behavior |
88
88
|------|----------|
89
-
|`enforce`| Returns a generic error (`"tool output blocked by content policy"`), blocking the result from entering the LLM context. The error message intentionally omits which guardrail matched to avoid leaking security internals to the LLM or channel. |
89
+
|`enforce`| Returns an error identifying the guardrail that triggered (e.g., `"tool output blocked by no_pii guardrail (PII detected in output)"`), blocking the result from entering the LLM context. |
90
90
|`warn`| Replaces matched patterns with `[REDACTED]`, logs a warning, and allows the redacted output through |
91
91
92
92
The hook writes the redacted text back to `HookContext.ToolOutput`, which the agent loop reads after all hooks fire. This is backwards-compatible — existing hooks that don't modify `ToolOutput` leave it unchanged.
93
93
94
+
### Per-Tool PII Exemptions
95
+
96
+
Some tools legitimately return PII as part of their function (e.g., `github_get_user` returning public email addresses). The `allow_tools` config option lets specific tools bypass a guardrail entirely.
97
+
98
+
```json
99
+
{
100
+
"guardrails": [
101
+
{
102
+
"type": "no_pii",
103
+
"config": {
104
+
"allow_tools": [
105
+
"github_get_user",
106
+
"github_pr_author_profiles",
107
+
"github_stargazer_profiles",
108
+
"file_create",
109
+
"code_agent_write",
110
+
"code_agent_edit"
111
+
]
112
+
}
113
+
}
114
+
]
115
+
}
116
+
```
117
+
118
+
**Key behaviors:**
119
+
120
+
| Behavior | Detail |
121
+
|----------|--------|
122
+
| Per-guardrail scope |`allow_tools` on `no_pii` does **not** bypass `no_secrets` — each guardrail has its own allowlist |
123
+
| Write tools included |`file_create`, `code_agent_write`, and `code_agent_edit` are included because they echo back content the LLM already has — blocking the echo is redundant |
124
+
| Default config | The default policy scaffold pre-configures `allow_tools` for GitHub profile tools and write tools |
125
+
| Custom overrides | Override via `policy-scaffold.json` to add or remove tools from the allowlist |
126
+
94
127
## Path Containment
95
128
96
129
The `cli_execute` tool confines filesystem path arguments to the agent's working directory. This prevents social-engineering attacks where an LLM is tricked into listing or reading files outside the project.
|`weather`| 🌤️ | utilities | Get weather data for a location | — (binary-backed) |
169
169
|`tavily-search`| 🔍 | research | Search the web using Tavily AI search API |`tavily-search.sh`|
@@ -365,7 +365,7 @@ The `github` skill provides a complete git + GitHub workflow through script-back
365
365
forge skills add github
366
366
```
367
367
368
-
This registers eight tools:
368
+
This registers fourteen tools:
369
369
370
370
| Tool | Purpose |
371
371
|------|---------|
@@ -377,9 +377,19 @@ This registers eight tools:
377
377
|`github_create_pr`| Create a pull request |
378
378
|`github_create_issue`| Create a GitHub issue |
379
379
|`github_list_issues`| List open issues for a repository |
380
+
|`github_list_prs`| List pull requests with state filter and pagination |
381
+
|`github_get_user`| Get a GitHub user's public profile |
382
+
|`github_list_stargazers`| List stargazers for a repository with pagination |
383
+
|`github_list_forks`| List forks of a repository with pagination |
384
+
|`github_pr_author_profiles`| List PR authors and fetch their full profiles (compound 2-step) |
385
+
|`github_stargazer_profiles`| List stargazers and fetch their full profiles (compound 2-step) |
380
386
381
387
**Workflow:** Clone → explore → edit → status → commit → push → create PR. The skill's system prompt enforces this sequence and prevents raw `git` commands via `cli_execute`.
382
388
389
+
**Pagination:** List tools (`github_list_prs`, `github_list_stargazers`, `github_list_forks`, `github_pr_author_profiles`, `github_stargazer_profiles`) support `page` (1-based) and `per_page` (default 30, max 100) parameters. Responses include `pagination.has_next_page` to indicate more results are available.
390
+
391
+
**PII exemption:** Profile-returning tools (`github_get_user`, `github_pr_author_profiles`, `github_stargazer_profiles`) are pre-configured in the default policy scaffold's `no_pii``allow_tools` list, so they can return public profile data (emails, bios) without triggering PII guardrails. See [Per-Tool PII Exemptions](security/guardrails.md#per-tool-pii-exemptions).
0 commit comments