← 返回 Skills 市场
Portkey Guardrails
作者
Nissan Dookeran
· GitHub ↗
· v1.0.0
· MIT-0
99
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install portkey-guardrails
功能描述
Portkey-inspired guardrails for OpenClaw: 5 configurable rules that block prompt injection, redact PII, flag off-scope responses, enforce agent budgets, and...
安全使用建议
Do not enable this hook in production without further checks. Specifically: 1) Verify where the handler will import runPreDispatchGuards/runPostDispatchGuards — inspect the host workspace path projects/portkey-gateway-integration/implementation/guardrails/index.ts the handler tries to load; if that file does not exist in your workspace, the handler as-written will fail to load the guardrail module or may import unintended code if a different project provides that path. 2) Confirm the external module's source before allowing it to execute — dynamic import of workspace-relative files can run arbitrary code with the gateway's privileges. 3) Decide whether Ollama should be optional: the package marks it as required in metadata though SKILL.md says it's optional; if you don't want Ollama installed, adjust the metadata or confirm the hook tolerates Ollama absence. 4) Review and test file access policies: G-04 reads agents/<agentId>/BUDGET.json and the system expects to append audit logs to agents/<agentId>/guardrails-audit.md — ensure those paths and permissions are acceptable and that sensitive files are not exposed. 5) If you cannot audit the external guardrails module, prefer running the included rules locally by creating a safe index that imports the provided rules/* files (or ask the publisher to supply a self-contained index) so behavior is deterministic and limited to the packaged code.
功能分析
Type: OpenClaw Skill
Name: portkey-guardrails
Version: 1.0.0
The skill bundle contains a significant security risk in `hook/handler.ts`, which dynamically imports executable code from a hardcoded path outside the skill's own directory (`../../projects/portkey-gateway-integration/implementation/guardrails/index.ts`). This 'out-of-bundle' import breaks encapsulation and creates a potential Remote Code Execution (RCE) vector if an attacker can influence the workspace file structure. While the included logic in the `rules/` directory (such as the PII redaction in `G-02-pii-leakage.ts`) appears benign and functional, the handler's mechanism for loading its core logic from an external, unverified path is highly irregular and dangerous.
能力评估
Purpose & Capability
The skill's stated purpose is to run five local guardrail rules offline (no external service). The repository includes rule implementations for G-01..G-05, and no credentials are requested. However, the hook's handler is written to dynamically import a guardrails implementation from projects/portkey-gateway-integration/implementation/guardrails/index.ts (outside the packaged rules). That import target is not present in the package manifest, creating an incoherence between the claimed self-contained implementation and what the hook actually tries to load. Also, the registry metadata lists 'ollama' as a required binary even though the SKILL.md and code describe Ollama as optional (semantic cache only).
Instruction Scope
The hook handler extracts many context fields, sets process.env.OPENCLAW_WORKSPACE_ROOT (if unset), and then performs a dynamic import of a workspace-relative path. Dynamic import of an external workspace path means the hook may execute code that lives outside the skill bundle (the skill expects runPreDispatchGuards/runPostDispatchGuards to exist in that external module). The included rule files (rules/*.ts) appear to implement the rules but are not wired into handler.ts — the handler will not use them unless the external index re-exports or assembles them. This mismatch could cause unexpected behavior or execution of host workspace code. The handler also reads and relies on agent-local files (BUDGET.json) and documents audit logs under agents/<agentId>/guardrails-audit.md; those file accesses are coherent with the stated budget/audit features, but you should confirm file paths and permissions are acceptable for your environment.
Install Mechanism
No install spec / downloads are present; the skill is instruction-only plus shipped source files. Nothing is fetched from external URLs during install, so there is no high-risk installer observed. Runtime, however, may dynamically import files from the workspace as noted above (not an installer risk but an execution-time risk).
Credentials
The skill declares no required environment variables or credentials, which matches the 'no external service / no API key' claim. Minor incoherence: metadata requires the 'ollama' binary, but the SKILL.md and code say Ollama is optional (semantic cache Phase 3). Requiring Ollama as mandatory is disproportionate if you intend to run the guardrails offline. The handler also sets OPENCLAW_WORKSPACE_ROOT if unset, which modifies process-level environment state (potentially affecting other hooks/processes).
Persistence & Privilege
The skill does not request 'always: true' and allows normal autonomous invocation. However, the handler's dynamic import of a workspace-relative path can cause the hook to execute code from elsewhere in the host workspace, which increases its effective privilege/persistence because it can piggyback on code outside the skill bundle. The handler also writes environment state (OPENCLAW_WORKSPACE_ROOT) if unset. These behaviors are not inherently malicious but raise privilege and scope concerns and should be audited before enabling in production.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install portkey-guardrails - 安装完成后,直接呼叫该 Skill 的名称或使用
/portkey-guardrails触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: G-01 prompt injection, G-02 PII redaction, G-03 off-scope filter, G-04 budget guard, G-05 context length. Declarative per-agent YAML config, semantic cache via local Ollama. Fail-open hook design. Live in production.
元数据
常见问题
Portkey Guardrails 是什么?
Portkey-inspired guardrails for OpenClaw: 5 configurable rules that block prompt injection, redact PII, flag off-scope responses, enforce agent budgets, and... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 99 次。
如何安装 Portkey Guardrails?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install portkey-guardrails」即可一键安装,无需额外配置。
Portkey Guardrails 是免费的吗?
是的,Portkey Guardrails 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Portkey Guardrails 支持哪些平台?
Portkey Guardrails 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Portkey Guardrails?
由 Nissan Dookeran(@nissan)开发并维护,当前版本 v1.0.0。
推荐 Skills