Back to skill

Security audit

FastAPI

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent FastAPI documentation skill, but it needs review because it encourages automatic environment changes and includes insecure production-style authentication examples.

Review before installing or using this skill to generate production code. Ask the agent to get permission before installing packages, changing pip configuration, binding servers publicly, or running Docker. Replace all sample tokens, JWT keys, database credentials, and .env values with unique secrets from a proper secret source, and avoid copying the authentication snippets into production unchanged.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
guides/03-advanced-usage.md:284
Finding

Hardcoded JWT Signing Key Allows Token Forgery

Content
View full analysis
str: to_encode = {**data} expire = datetime.now(timezone.utc) + (expires_delta or timedelta(minutes=15)) to_encode.update({"exp": expire}) return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM) async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]) -> User: credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials", headers={"WWW-Authenticate": "Bearer"}, ) try: payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM]) username: str = payload.get("sub") if username is None: raise credentials_exception token_data = TokenData(username=username) except jwt.InvalidTokenError: raise credentials_exception user = get_user(fake_users_db, username=token_data.username) if user is None: raise credentials_exception return user ``` ### Technical Analysis The guide describes itself as suitable for building production-grade FastAPI applications and states that the AI can generate authentication code. The JWT implementation uses HS256, a symmetric signature algorithm for which token issuers and validators share the same secret. Because the signing key is embedded directly in publicly distributed guidance, an application generated from this example may retain a key known to every reader of the Skill. Possession of the key permits an attacker to create crypt ...[truncated 1396 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
guides/03-advanced-usage.md:139
Finding

Fixed Header Token Can Be Used to Bypass Protected Routes

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

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

Unpinned Dependency Installation Produces Non-Reproducible and Mutable Builds

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
guides/01-installation.md:295
Finding

Troubleshooting Guidance Persistently Replaces the Global Python Package Index

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (14)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- [高级用法](./guides/03-advanced-usage.md)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · guides/03-advanced-usage.md (reported line 612)May include surrounding context.

access_token_expire_minutes: int = 30

text
class Config:
    env_file = ".env"

settings = Settings()

text

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

The guide includes a concrete .env example containing a live-looking database connection string with embedded username/password and a plaintext SECRET_KEY. Even if intended as an example, publishing credential-shaped values in documentation normalizes hardcoded secrets and can lead users to copy them into real deployments or accidentally commit actual secrets.

Content

Scanner excerpt · guides/03-advanced-usage.md (reported line 618)May include surrounding context.

text

```bash
# .env
APP_NAME=Production API
DEBUG=false
DATABASE_URL=postgresql://user:pass@localhost/mydb

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown file contains user-facing descriptive text in Chinese from the title and overview onward, but it does not indicate that the skill is region-specific or provide an opt-in language choice. That can violate language/locale policy because it effectively forces one language for all users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide explicitly tells an AI it can execute package installation and environment-changing commands such as creating virtual environments and running pip installs, including use of external package indexes. In an agent setting, this is dangerous because it authorizes network access and system modification without requiring explicit user confirmation, review of side effects, or trust checks on package sources.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The guide recommends running Uvicorn with --host 0.0.0.0, which exposes the development server on all network interfaces. In a quickstart context, readers may copy this command without realizing the app becomes reachable from the local network or, in some environments, externally, increasing the risk of unintended access to an unauthenticated development service.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · guides/02-quickstart.md (reported line 159)May include surrounding context.

发送 POST 请求:

bash
curl -X POST "http://127.0.0.1:8000/items/" \
  -H "Content-Type: application/json" \
  -d '{"name": "Foo", "price": 45.2}'

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file documents a DELETE endpoint that permanently removes records from the database, but the surrounding guide provides no warning about its destructive effect or the need for safeguards. For markdown files, SQP-2 applies when user-impacting or irreversible behavior is described without disclosure.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · troubleshooting.md (reported line 139)May include surrounding context.

排查步骤:

bash
# 检查请求体格式
curl -X POST http://localhost:8000/items/ \
  -H "Content-Type: application/json" \
  -d '{"name": "test", "price": 10.5}'

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file presents all user-facing instructions in Chinese and does not provide an opt-in, alternative language, or justification for a Chinese-only locale. Under the stated policy, forcing a specific language without user choice can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

文件标题、说明、步骤和注释均固定为中文,没有提供用户可选语言或解释该语言限制的上下文。按规则,若技能强制单一语言且无用户 opt-in 或正当区域性说明,可视为自然语言策略问题。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The entire skill file is written in Chinese and does not indicate that language selection is optional or user-configurable. Under SQP-3, forcing a specific language without user opt-in can violate language/locale policy expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file uses Chinese throughout, beginning with the title on L001, and does not indicate that the user can choose another language. Under the policy, forcing a specific language without opt-in is a natural-language policy concern unless the locale restriction is explicitly documented and justified.

Content

No source excerpt is available for this finding.