T09 · Insecure Skill Coding Practices
- Location
SKILL.md:176- Finding
Unsafe Collection and Plaintext Persistence of a Figma Access Token
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
Review recommended: the skill is mostly a coherent Figma-to-mobile-code helper, but it tells the agent to collect and store a Figma access token insecurely.
Use this skill only if you configure FIGMA_TOKEN outside the chat through your shell, platform secret settings, or another trusted secret mechanism. Do not paste Figma tokens into conversation; avoid plaintext .env storage when possible, ensure .env is gitignored if used, and rotate any token that was pasted, committed, logged, or shared.
SKILL.md:176Unsafe Collection and Plaintext Persistence of a Figma Access Token
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## 配置
1. 获取 Figma Personal Access Token:
Figma → 头像 → Settings → Security → Personal Access Tokens,新建 token(一般以 `figd_` 开头)。
2. 设置环境变量,或把下面一行写入项目根目录 `.env`(脚本会自动读取):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## 配置
1. 获取 Figma Personal Access Token:
Figma → 头像 → Settings → Security → Personal Access Tokens,新建 token(一般以 `figd_` 开头)。
2. 设置环境变量,或把下面一行写入项目根目录 `.env`(脚本会自动读取):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
│ ├── figma-fetch.js # Figma API:拉取 / 对比 / SVG
│ ├── project-scan.js # 工程资源轻量扫描
│ ├── feedback-analyze.js # 反馈日志分析
│ └── load-env.js # .env 加载
├── references/
│ ├── figma-interpretation.md
│ ├── figma-scan-usage.md
There is a clear material mismatch between the declared description and the supplied code. The description promises a Figma design conversion workflow for generating mobile UI code, but the code only analyzes a local markdown feedback log and summarizes issues by platform and keyword. It does not interact with Figma, does not generate any UI code, and its primary purpose is unrelated feedback analysis. This is not a supporting implementation detail; it is an entirely different function.
The declared description centers on transforming Figma designs into mobile UI implementation code. However, this code chunk only fetches and preprocesses Figma data: it parses Figma links, calls /files/.../nodes and /images endpoints, simplifies node JSON, compares two simplified trees, and prints JSON output. There is no logic for producing Android or iOS source code, no template/rendering layer, and no clarification or code emission behavior. The extra compare and SVG export features are also not mentioned in the declared purpose. While using the Figma REST API is consistent with part of the description, the primary behavior of this chunk is materially different from the claimed end-user function, so this is a mismatch.
This code chunk’s behavior is materially unrelated to the declared primary purpose. The description says the skill should process Figma links and generate mobile UI code, but the implementation shown is a generic environment-loader utility. While loading environment variables could be a supporting helper in a larger Figma-related project, this chunk by itself does not implement the declared functionality and instead accesses local filesystem resources that are not mentioned in the description or permissions. Therefore this is a description/behavior mismatch.
声明描述的是一个“Figma 设计稿转移动端 UI 代码生成器”。但代码实际是 project-scan.js 命令行工具:接收本地项目路径,识别 Android 或 iOS 工程;对 Android 解析 res/values 下的 colors/strings/dimens 和 drawable 文件名,构建索引后输出 JSON;对 iOS 仅检查是否存在 .xcodeproj 并返回占位说明。整个代码没有网络请求、没有 Figma 链接处理、没有代码生成逻辑、没有追问澄清机制。其主要目的与声明明显不同,且还执行了声明中未提到的本地工程扫描能力,因此属于明显不匹配。
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## 环境要求
- 环境变量 `FIGMA_TOKEN`(Figma → 头像 → Settings → Security → Personal Access Tokens)
- **Node.js 18+**(内置 `fetch`;脚本为纯 JavaScript,**无需** `npm install`)
- 脚本入口:在 `scripts/` 下执行 `node src/figma-fetch.js`,或 `npm run figma-fetch --`(`package.json` 仅用于声明 `type: module` 与 npm 脚本快捷方式,无第三方依赖)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## 环境要求
- 环境变量 `FIGMA_TOKEN`(Figma → 头像 → Settings → Security → Personal Access Tokens)
- **Node.js 18+**(内置 `fetch`;脚本为纯 JavaScript,**无需** `npm install`)
- 脚本入口:在 `scripts/` 下执行 `node src/figma-fetch.js`,或 `npm run figma-fetch --`(`package.json` 仅用于声明 `type: module` 与 npm 脚本快捷方式,无第三方依赖)
The skill explicitly instructs the agent to ask the user to paste a Figma personal access token into the conversation and then persist it to a local .env file. This is dangerous because secrets entered into chat may be logged, retained, or exposed to other tools, and writing them to disk broadens exposure beyond the immediate task.
The skill socially engineers the user to disclose a sensitive credential in natural-language conversation, which is exactly the kind of pattern that leads to secret compromise in agent systems. Because the skill's purpose is UI code generation, collecting raw credentials in chat is broader than necessary and especially risky in environments with conversation retention or tool chaining.
This instruction directly tells the agent to obtain a personal access token from the user. In a conversational agent context, requesting secrets in-band is dangerous because the credential may be stored in transcripts, leaked to plugins/tools, or reused beyond the user's expectation.
## 异常处理
- **`FIGMA_TOKEN` 未设置**(脚本打印 `FIGMA_TOKEN_NOT_SET`)→ **不要**让用户自行敲复杂命令。应:
1. 说明需要 Figma Personal Access Token
2. 指引:Figma → 头像 → Settings → Security → Personal Access Tokens
3. 请用户在对话中粘贴 token(通常以 `figd_` 开头)
4. 将 token 写入项目根目录 `.env`:`FIGMA_TOKEN=figd_xxx`(脚本会自动读取 `.env`)
This step compounds the prior issue by instructing persistence of the token in a project-local .env file after disclosure in chat. That creates both conversational exposure and on-disk exposure, increasing the risk of accidental source control commits, local compromise, or reuse by unrelated processes.
- **`FIGMA_TOKEN` 未设置**(脚本打印 `FIGMA_TOKEN_NOT_SET`)→ **不要**让用户自行敲复杂命令。应:
1. 说明需要 Figma Personal Access Token
2. 指引:Figma → 头像 → Settings → Security → Personal Access Tokens
3. 请用户在对话中粘贴 token(通常以 `figd_` 开头)
4. 将 token 写入项目根目录 `.env`:`FIGMA_TOKEN=figd_xxx`(脚本会自动读取 `.env`)
5. 再次执行 `node src/figma-fetch.js` 或 `npm run figma-fetch --`
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
<!-- 标准 TabLayout + ViewPager2 -->
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="0dp"
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
android:src="@drawable/placeholder" android:scaleType="centerInside" android:contentDescription="返回" />
### 图标 + 文字按钮
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
android:src="@drawable/placeholder" android:scaleType="centerInside" android:contentDescription="返回" />
### 图标 + 文字按钮
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
<item android:drawable="@drawable/bg_gender_card_unselected" />
</selector>
<!-- drawable/ic_check_selector.xml(可用透明度控制显隐) -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/ic_check_selected" />
<item android:drawable="@android:color/transparent" />
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
<item android:drawable="@drawable/bg_gender_card_unselected" />
</selector>
<!-- drawable/ic_check_selector.xml(可用透明度控制显隐) -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/ic_check_selected" />
<item android:drawable="@android:color/transparent" />
The manifest describes a skill that ingests Figma links, calls the Figma REST API, and generates Android/iOS UI code. This file instead implements a standalone local CLI that parses a markdown feedback log and outputs issue/rule summaries, which is unrelated to extracting Figma design trees or producing mobile UI code.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
/** 从项目根 `.env` 加载 KEY=value(不覆盖已有环境变量) */
export function loadDotEnv(cwd = process.cwd(), envPath) {
const p = envPath ?? resolve(cwd, ".env");
if (!existsSync(p)) return;
const raw = readFileSync(p, "utf8");
for (const line of raw.split("\n")) {
The README tells users to place a Figma personal access token in an environment variable or a project-root .env file, but it does not warn that the token is sensitive, should not be committed, and should be excluded from logs and generated artifacts. This creates a realistic secret-exposure risk because users commonly commit .env files or leave them in shared project directories, allowing unauthorized access to Figma resources tied to the token.
The skill declares access to environment variables and implies network use via Figma API calls, but it does not constrain tool scope with explicit permissions or allowed-tools. In an agent setting, missing scope boundaries can let the skill invoke broader capabilities than necessary, increasing the blast radius if the workflow is abused or the implementation drifts.
The workflow directs storage of a Figma token in a local .env file without warning users about chat logging, accidental commit risk, local file exposure, or secret reuse. That omission materially increases the chance of credential leakage, especially in developer workspaces where .env files may be copied, backed up, or committed.
The instructional content and headings are presented in Chinese, while examples and command details are mixed-language, with no indication that language choice is optional or that the skill is intentionally region-specific. Under the policy criteria, this can constitute a language/locale constraint without explicit user opt-in or justification.
This markdown file presents all guidance, examples, and instructions exclusively in Chinese. Under the policy rule for language/locale, forcing a specific language without user opt-in can be a natural-language policy violation when no alternative or justification is provided.