Back to skill

Security audit

token-safety-checker

Security checks for vulnerabilities and agentic risk

Overview

The secret scanner fits its purpose, but uninstalling its Git protection can also delete your existing safety checks.

Read-only scanning is consistent with the advertised purpose. Before enabling the OpenClaw Git guard, save existing pre-commit hooks. If you manually combine hooks, remove only the guard command yourself: automatic uninstall can erase the whole hook. Prefer a corrected uninstaller. Review migration's dry run and protect the resulting secrets file and backups.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/safeclaw.py
Finding

Persistent hook installation relies solely on documentary confirmation

Content
View full analysis

Impact

Hooks survive the current invocation and can deny subsequent file writes or commits. The documented approval requirement is not enforced by the executable entry point.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · SKILL.md (reported line 93)May include surrounding context.

md
`SC install-guard --platform claude|openclaw|all` — the platform must be named explicitly; confirm it with the
user first, because this installs a persistent hook.

- **Claude Code**: adds a `PreToolUse` hook (`Write|Edit|MultiEdit|NotebookEdit`) to `~/.claude/settings.json`
  that denies writing a detected secret into memory / instruction files (CLAUDE.md, auto memory,
  `.claude/rules`, MEMORY.md, …). `--scope all` guards every file write. Existing settings and hooks are kept,
  a settings backup is written, and the hook script is copied to `~/.claude/hooks/token-safety-guard.py`.

Code capability 'env' detected in scripts/safeclaw.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'env' capability that is not covered by the declared 'allowed-tools' preapproval. Review the host runtime's actual enforcement policy; runtime permissions are unknown unless separately verified, and this declaration alone does not establish a permission ceiling.

Content

No source excerpt is available for this finding.

Code capability 'file_read' detected in scripts/safeclaw.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'file_read' capability that is not covered by the declared 'allowed-tools' preapproval. Review the host runtime's actual enforcement policy; runtime permissions are unknown unless separately verified, and this declaration alone does not establish a permission ceiling.

Content

No source excerpt is available for this finding.

Code capability 'file_write' detected in scripts/safeclaw.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'file_write' capability that is not covered by the declared 'allowed-tools' preapproval. Review the host runtime's actual enforcement policy; runtime permissions are unknown unless separately verified, and this declaration alone does not establish a permission ceiling.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/safeclaw.py (reported line 612)May include surrounding context.

python
return result

    try:
        r = subprocess.run(
            ["git", "rev-parse", "--show-toplevel"],
            capture_output=True, text=True, cwd=config_path.parent
        )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/safeclaw.py (reported line 633)May include surrounding context.

python
result["supported"] = False
        return result

    log = subprocess.run(
        ["git", "log", "--all", "--format=%H|%ai|%an", "--", rel_path],
        capture_output=True, text=True, cwd=git_root
    )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/safeclaw.py (reported line 645)May include surrounding context.

python
if len(parts) < 3:
            continue
        commit_hash, date, author = parts
        show = subprocess.run(
            ["git", "show", f"{commit_hash}:{rel_path}"],
            capture_output=True, text=True, cwd=git_root
        )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/safeclaw.py (reported line 1188)May include surrounding context.

python
def cmd_guard_git(args):
    """git pre-commit hook: block commits that add secrets."""
    r = subprocess.run(["git", "diff", "--cached", "--name-only", "--diff-filter=ACMR", "-z"],
                       capture_output=True)
    if r.returncode != 0:
        return 0

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/safeclaw.py (reported line 1194)May include surrounding context.

python
return 0
    blocked = []
    for name in [n for n in r.stdout.decode("utf-8", "replace").split("\0") if n]:
        show = subprocess.run(["git", "show", f":{name}"], capture_output=True)
        if show.returncode != 0 or b"\0" in show.stdout[:8000]:
            continue
        text = show.stdout.decode("utf-8", "replace")

Tainted flow: 'profile_path' from os.environ.get (line 1490, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/safeclaw.py (reported line 1559)May include surrounding context.

python
# 3. Profile gets only the loader line (no secret values)
    if needs_hook:
        with open(profile_path, "a", encoding="utf-8") as pf:
            pf.write(f"\n{hook_line}\n")
        print(f"[OK] {profile_path}: added a line that loads {secrets_path}")

Static analysis

No suspicious patterns detected.