Back to skill

Security audit

AFFiNE Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent AFFINE CLI helper, but it can install and run an unpinned npm tool with an API token and perform delete, bulk update, and public publish actions without enough safety guidance.

Install only if you trust the npm package source and are comfortable giving the CLI access to your AFFINE workspace. Prefer a pinned reviewed package version, avoid putting tokens directly in shell commands, keep credential files out of repositories with restrictive permissions, and require explicit confirmation before delete, permanent cleanup, bulk database mutation, or publishing actions.

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
SKILL.md:24
Finding

Unpinned Third-Party Package Installation and Execution

Content
View full analysis
``` ``` ### Technical Analysis The Skill instructs the user or Agent to install and execute `affine-cli` without specifying an exact package version or validating an integrity digest. Both `npm install -g affine-cli` and `npx affine-cli` resolve a mutable package release from the configured npm registry. Consequently, the executable code used at runtime can differ from the code that existed when this Skill was audited. Global installation also adds package-provided executables to the user's environment. Because the CLI is expected to handle an AFFINE API token and authenticated workspace data, a compromised dependency would execute in a sensitive context. No evidence shows that the current `affine-cli` package is malicious. The vulnerability is the unsafe, unpinned supply-chain trust model documented by the Skill. ### Attack Path 1. An attacker compromises the npm package, its publisher account, or the registry resolution path and publishes a malicious release. 2. A user or Agent follows the documented `npm install -g affine-cli` or `npx affine-cli` instruction. 3. npm resolves and executes the attacker-controlled release because no exact version or integrity value is enforced. 4. The package runs with the invoking user's permissions. 5. During authentication or subsequent operations, it may access the AFFINE token, configuration files, local files intentionally supplied to the CLI, and workspace data available to that token. ### Impact Assessment Successful exploitation could provide arbitrary code execution wi ...[truncated 448 chars]
Remediation
View remediation
-- affine-cli ` after validating that version. 5. Document the expected package publisher, registry URL, version, and integrity hash so package substitution can be detected. 6. Review package lifecycle scripts and consider installing with scripts disabled if the package does not require them. 7. Run the CLI with least privilege and expose only the minimum required environment variables and files. 8. Establish a controlled update process in which new versions are reviewed and tested before the pinned version is changed. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:49
Finding

AFFINE API Token Exposed Through Command-Line Arguments

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (19)

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 · SKILL.md (reported line 14)May include surrounding context.

md
AFFINE_API_TOKEN: required
        AFFINE_BASE_URL: "optional — defaults to https://app.affine.pro"
        AFFINE_WORKSPACE_ID: optional
    note: Configuration loads from: env > local .env > ~/.affine-cli/affine-cli.env
---

# Affine CLI

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 · SKILL.md (reported line 177)May include surrounding context.

md
AFFINE_API_TOKEN: required
        AFFINE_BASE_URL: "optional — defaults to https://app.affine.pro"
        AFFINE_WORKSPACE_ID: optional
    note: Configuration loads from: env > local .env > ~/.affine-cli/affine-cli.env
---

# Affine CLI

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · commands/basics.md (reported line 23)May include surrounding context.

| --token | -t | No | API token. If not provided, interactive login | | --workspace | -w | No | Workspace ID to use as default | | --local | - | No | Save to local .env instead of global config | | --force | -f | No | Overwrite existing config without prompts |

Examples:

bash

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The documentation recommends running the tool via npx affine-cli without pinning a specific version. This causes execution of whatever package version is current at runtime, creating a supply-chain risk where a compromised or maliciously updated package could run arbitrary code on the user's system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill advertises destructive operations such as delete, clear, clean, remove, and unpublish without any warning, confirmation guidance, or rollback discussion. In an agent-assisted context this increases the chance of accidental irreversible data loss, especially when operating on documents, folders, databases, files, or comments at scale.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

Daily Journal

bash
# Create today's journal
affine-cli journal create

# Append to today's journal

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file documents a doc delete command that removes a document, but it provides no warning about data loss, reversibility, or whether the operation prompts for confirmation. For markdown files, destructive operations that could affect user data should include a clear warning so users understand the risk before invoking the command.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill documents a public publishing command without any warning that it exposes document contents to anyone with access to the published link or public endpoint. In a documentation-driven agent context, this omission can lead users or downstream agents to unintentionally disclose sensitive internal content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file documents a delete operation with only the brief instruction 'Delete a collection' and no warning about whether the action is destructive, reversible, or affects user data organization. For markdown files, safety-relevant behaviors that could affect user data or system integrity should include an explicit warning, and this section omits one.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file documents a delete operation for comments, but it does not include any warning about data removal, reversibility, or the need to confirm the target before executing it. For markdown files, destructive behaviors that can affect user data should be accompanied by a clear warning so users understand the impact.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file documents database delete as deleting an entire database, but provides no warning that the action is destructive or irreversible. Under the markdown-specific missing-warning rule, skills should disclose behaviors that could affect user data or system integrity.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The database remove section documents deleting rows, including query-based bulk removal, but does not warn users that matching rows will be deleted and may not be recoverable. This omission is safety-relevant because it can affect user data at scale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation exposes destructive deletion functionality, including a --permanently option, without any warning about irreversible data loss, recommended confirmation steps, or safer operational guidance. In an agent skill context, this increases the chance that an automated system or user will invoke permanent deletion without understanding the consequences, leading to unintended loss of attachments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file clean command is documented as freeing storage by removing soft-deleted files, but it does not clearly state that this may permanently remove recoverable data. In a skill used by agents, cleanup commands can be run mechanically or at scale, so the absence of a clear warning raises the risk of irreversible bulk data loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file documents an update command that replaces the entire journal content, which is a potentially destructive action affecting user data. Although line L109 notes that it replaces entire content, the documentation does not provide a clear caution or warning about overwrite/irreversibility risk before showing usage examples.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation exposes a destructive tags delete operation without any caution about scope, irreversibility, or consequences for tagged documents. In an agent skill context, terse destructive commands can be executed or suggested automatically, increasing the chance of accidental metadata loss or misuse by a user who does not understand the impact.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The folder delete command is documented as a simple action with no warning about what happens to contained documents, subfolders, or workspace organization. In a skill used by an agent, this omission can lead to destructive actions being taken without sufficient user awareness, causing accidental data disorganization or potential loss depending on backend semantics.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

folder clear performs an automatic bulk cleanup of empty folders, but the documentation provides no warning that multiple folders may be removed at once. Bulk destructive operations are especially risky in agent workflows because they can be triggered broadly and silently, making unintended organizational changes harder to detect and recover from.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The database update command supports --query to modify multiple rows, but the description does not warn that a filter can change many records at once. In markdown documentation, bulk data-modifying behavior should be disclosed when it can materially affect user data.

Content

No source excerpt is available for this finding.