Back to skill

Security audit

Rich

Security checks for vulnerabilities and agentic risk

Overview

This is a documentation-only Rich Python helper skill with normal installation and usage guidance, though users should be careful with package installs and traceback examples that reveal local variables.

Install only in a virtual environment when possible, prefer pinned PyPI releases over the optional GitHub source install, review before letting an agent modify requirements.txt, and avoid show_locals=True or traceback-local logging in production, CI, shared terminals, or any context containing secrets.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T08 · Insecure Dependencies

Warning
Location
guides/01-installation.md:64
Finding

Unpinned Installation from a Mutable Git Repository

Content
View full analysis

Vulnerability Details

File Location: guides/01-installation.md:64-69
Vulnerability Type: Unpinned third-party source dependency
Risk Level: Medium

bash
### 方法3: 从源码安装(最新开发版)

```bash
pip install git+https://github.com/Textualize/rich.git
text

### Technical Analysis

The documented command installs Rich directly from the current default branch of an external Git repository. It does not pin a reviewed commit, release tag, or immutable artifact hash.

A pip VCS installation retrieves repository content at execution time and may execute package build or installation logic with the privileges of the invoking user. Consequently, the effective code installed by this command can differ from the code available when the Skill was audited. Although the URL points to the declared official Rich repository, upstream account compromise, repository compromise, or an unsafe future commit could turn this instruction into a supply-chain execution channel.

### Attack Path

1. An attacker compromises the upstream repository, a maintainer account, or the repository's default branch.
2. The attacker adds malicious package source, build-backend behavior, or installation logic.
3. The user or AI agent follows the Skill and runs `pip install git+https://github.com/Textualize/rich.git`.
4. Pip downloads the mutable repository state and invokes the applicable build and installation process.
5. The malicious code executes or is installed into the selected Python environment.

### Impact Assessment

Malicious installation logic could execute with the privileges of the account running pip. Depending on that account and environment, it could read or modify user-accessible files, steal environment credentials, alter the Python environment, or install persistent malicious Python components. If the command is run with elevated privileges, the effect could extend to system-wide Python packages and files.
Remediation
View remediation

Remediation Suggestions

  • Remove the mutable default-branch installation from the recommended workflow.
  • Prefer a reviewed and pinned release from PyPI:
    bash
    python -m pip install "rich==13.9.4"
    
  • Use a lock file and require package hashes in production or automated environments.
  • If a VCS installation is necessary, pin an audited full commit SHA:
    bash
    python -m pip install "rich @ git+https://github.com/Textualize/rich.git@<full-commit-sha>"
    
  • Perform source installations only inside an isolated virtual environment.
  • Avoid running pip with administrator or root privileges.
  • Review the pinned revision and its build configuration before installation.

T09 · Insecure Skill Coding Practices

Warning
Location
guides/03-advanced-usage.md:109
Finding

Traceback Configuration Can Expose Sensitive Local Variables

Content
View full analysis

Vulnerability Details

File Location: guides/03-advanced-usage.md:109-123
Additional Locations: guides/03-advanced-usage.md:128-140, guides/03-advanced-usage.md:509-517
Vulnerability Type: Sensitive information exposure through exception output
Risk Level: Medium

python
import logging
from rich.logging import RichHandler
from rich.console import Console

# 自定义 Console(写入文件)
file_console = Console(file=open("app.log", "w"))

logging.basicConfig(
    level=logging.INFO,
    format="%(name)s: %(message)s",
    handlers=[
        RichHandler(
            rich_tracebacks=True,        # 美化异常追踪
            tracebacks_show_locals=True, # 显示局部变量
            show_time=True,              # 显示时间
            show_path=True,              # 显示文件路径
            markup=True,                 # 启用标记语法
        ),
        logging.FileHandler("app.log")
    ]
)

The same unsafe behavior is also recommended through global traceback installation:

python
from rich.traceback import install

install(
    show_locals=True,
    width=120,
    extra_lines=5,
    theme="monokai",
    word_wrap=True,
)
python
from rich import pretty, traceback

pretty.install()
traceback.install(show_locals=True)

Technical Analysis

The configurations enable tracebacks_show_locals=True or show_locals=True. When an exception is rendered, Rich can include the values of local variables from affected stack frames.

Application locals frequently contain passwords, API tokens, authorization headers, cookies, connection strings, personal information, request bodies, database records, or cryptographic material. Masking a password during interactive entry does not protect it after the value has been assigned to a local variable. Exception output may also be retained in log files, CI logs, terminal recordings, process-supervisor logs, or support artifacts.

Global traceback ...[truncated 1163 chars]

Remediation
View remediation

Remediation Suggestions

  • Use secure defaults:
    python
    RichHandler(
        rich_tracebacks=True,
        tracebacks_show_locals=False,
    )
    
    python
    traceback.install(show_locals=False)
    
  • Do not enable local-variable rendering in production, CI, shared terminals, or centrally collected logs.
  • If local rendering is required for controlled development, use synthetic or sanitized data and disable it immediately after debugging.
  • Redact passwords, tokens, cookies, authorization headers, connection strings, and personal data before logging.
  • Restrict access to logs and diagnostic artifacts, apply short retention periods, and encrypt sensitive logs where appropriate.
  • Add automated tests or log-scanning controls that detect credential patterns before diagnostic output is published.
  • Document that masked prompt input becomes an ordinary in-memory string after assignment and can therefore be exposed by traceback-local rendering.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

YARA rule 'agent_skill_remote_bootstrap_execution': Remote script or code download followed by execution/bootstrap installation [agent_skills]

High
Category
YARA Match
Confidence
89% confidence
Finding

pip install git+https://github.com/Textualize/rich.git pulls and installs code directly from a remote repository tip rather than a pinned package release, which is a classic remote bootstrap pattern. In an agent-execution context this is more dangerous than ordinary documentation because it combines network retrieval, dependency resolution, and code execution during install, increasing supply-chain and tampering risk.

Content

Scanner excerpt · guides/01-installation.md (reported line 68)May include surrounding context.

、安装 Rich

方法1: 使用 pip 安装(推荐)

AI 执行说明: AI 可以直接执行安装命令

bash
pip install rich

验证安装:

bash
python -c "import rich; print(rich.__version__)"

期望结果:

text
13.9.4

方法2: 使用 conda 安装

bash
conda install -c conda-forge rich

方法3: 从源码安装(最新开发版)

bash
pip install git+https://github.com/Textualize/rich.git

方法4: 使用 uv 安装(推荐用于现代项目)

bash
uv add rich

方法5: 添加到项目依赖

bash
# 写入 requirements.txt
echo "rich>=13.0.0" >> requirements.txt
pip install -r requirements.txt

或在 pyproject.toml 中添加:

toml
[project]
dependencies = [
    "rich>=13.0.0",
]

三、验证安装

运行 Rich 内置演示

AI 执行说明: AI 将运行演示命令确认安装成功

bash
# 运行 Rich 自带演示(展示所有功能)
python -m rich

这将

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The guide explicitly tells the AI it can directly run package installation commands, which would modify the user's environment without an upfront safety warning or confirmation step. Even though pip install rich is a normal package-management action, autonomous execution can change system state, install unreviewed dependencies, and create unintended side effects on the host.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document includes a shell command that appends to requirements.txt, causing a persistent project file modification without an explicit warning. In an agent setting, file-writing commands are risky because they can alter dependency state, affect future builds, and be executed without the user's informed consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

该文件从标题开始即以中文编写,且通篇以中文作为默认且唯一的交互/说明语言,没有提供语言切换、用户偏好选择或区域性适用说明。按规则,强制单一语言且无用户选择属于自然语言层面的语言/区域政策问题。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The logging example combines file logging with rich_tracebacks=True and tracebacks_show_locals=True, increasing the chance that exception details and local variables are persisted to disk. This can create durable leakage of secrets or sensitive business data, especially because log files are commonly aggregated, backed up, or accessible to broader operational personnel.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The guide recommends enabling Rich traceback rendering with show_locals=True, which can expose local variable values in terminal output or captured logs. In real applications, locals often contain secrets, tokens, credentials, personal data, or internal state, so uncaught exceptions may leak sensitive information to developers, support staff, CI logs, or shared terminals.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The troubleshooting guidance instructs users to set LANG=en_US.UTF-8 and LC_ALL=en_US.UTF-8, which imposes an English/US locale rather than only requiring UTF-8 encoding. This is a natural-language locale policy issue because it forces a specific language/region choice without offering alternatives or explaining why that locale is necessary.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file presents the skill name, description, workflow, and usage guidance entirely in Chinese, which effectively forces a specific language for users reading the skill documentation. Under the policy, language-specific behavior should offer user choice or clearly document a justified locale constraint, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The entire guide, including AI-facing execution instructions, is presented only in Chinese and does not indicate that the language is optional or region-specific. Under the policy, forcing a specific language without opt-in can be a natural-language policy concern unless the locale constraint is documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The file consistently presents headings, instructions, prompts, and examples solely in Chinese, including user-facing interaction text. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation when no language choice or justification is provided.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The export example writes rendered console content to HTML, SVG, and text files without warning that the exported output may contain secrets, tokens, user data, or internal diagnostics. If users export debugging or operational output and then share or publish those files, sensitive information may be disclosed outside the intended environment.

Content

No source excerpt is available for this finding.