T09 · Insecure Skill Coding Practices
- Location
SKILL.md:176- Finding
Insecure Collection and Plaintext Storage of Figma Personal Access Tokens
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly coherent, but it tells the agent to collect and save a Figma access token in an unsafe way.
Review before installing. Do not paste a Figma access token into chat. Configure FIGMA_TOKEN yourself through a trusted environment or secret manager, keep any .env file out of version control, and rotate any token that was pasted into a conversation or stored insecurely.
SKILL.md:176Insecure Collection and Plaintext Storage of Figma Personal Access Tokens
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
声明描述的是一个“Figma 设计稿转移动端 UI 代码生成器”。但实际代码仅实现了对 feedback-log.md 的离线解析与统计:从 markdown 分段中提取平台、问题和规则候选,统计关键词并输出 JSON 总结。代码中没有任何网络请求、Figma API 交互、设计树/token 提取、澄清逻辑或代码生成逻辑。其主要目的与声明完全不同,因此属于明显的不匹配。
The declared description centers on converting Figma designs into production-ready mobile UI code. This code chunk does not perform any code generation for Android or iOS frameworks. Its actual primary purpose is data retrieval and preprocessing: it fetches Figma node documents, simplifies their JSON structure, compares two trees, and exports SVG URLs. Using the Figma API is consistent with the description, but the core promised behavior—transforming designs into UI code—is absent in this chunk. Additionally, the compare mode and SVG export are extra capabilities not mentioned in the declared purpose. Therefore the description does not accurately represent what this code actually does.
The supplied code chunk does not implement Figma design conversion, design tree extraction, token processing, clarification prompts, or mobile UI code generation. Its sole purpose is a generic utility to read a local .env file from disk and populate process.env. While loading environment variables could be a supporting utility in a larger project, this chunk by itself performs a materially different function from the declared skill behavior and accesses local filesystem resources not mentioned in the description. Therefore this code chunk does not accurately represent the declared purpose.
The declared description centers on Figma-to-code generation: ingesting a Figma link, querying the Figma REST API, extracting design structure/tokens, and producing mobile UI code. The supplied code instead performs repository/project introspection on local filesystem paths. Its primary function is to scan existing Android/iOS project resources and serialize them into a JSON report. This is materially different from the declared purpose, and the key promised capabilities—handling Figma links, calling Figma APIs, extracting design trees/tokens, and generating Compose/XML/SwiftUI/UIKit code—are absent. Therefore this is a clear description-behavior mismatch.
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 chat and then write it into a local .env file. This is dangerous because it normalizes credential collection through an unsafe channel, increases exposure in chat logs, and creates persistent local secret storage without strong justification or controls.
The instructions collect and persist a Figma personal access token without presenting a clear security warning, retention notice, or safer alternative. Users may unknowingly disclose sensitive credentials into conversation history and local files, creating avoidable account and project exposure.
This is a direct natural-language instruction to solicit a secret from the user and retain it locally. In a skill that already has env and file access, that materially increases the chance of credential theft, accidental logging, unauthorized reuse, or later disclosure through filesystem access or debugging output.
This finding points to the instruction to obtain a Figma personal access token from the user. Soliciting credentials directly in conversation is a high-risk anti-pattern because chat transcripts may be retained, exposed to operators, or reused beyond the immediate task.
## 异常处理
- **`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`)
The skill not only asks for the access token but also directs writing it into a local .env file. That creates persistent credential material on disk that may be accidentally committed, read by other tools, or exposed through later file operations, making the skill context substantially more dangerous.
- **`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" />
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 explicitly encourages storing a Figma personal access token in a project-root .env file that is auto-loaded, but gives no warning about keeping that file out of version control, rotating leaked tokens, or minimizing token scope. This increases the chance of accidental credential exposure through commits, logs, support bundles, or agent access to the workspace.
The skill declares access to environment variables and performs network-capable operations, but it does not define an explicit tool or permission scope. That weakens least-privilege controls and makes it harder to constrain what the skill may access at runtime, especially given it also handles credentials and external URLs.
The line states that the body text is in Chinese, establishing a language constraint for the skill's instructions. Because there is no indication that the user can choose another language or opt in to Chinese, this is a natural-language locale policy issue under the stated rule.
The file explicitly encourages storing user corrections along with generated code snippets, but it provides no guidance to avoid copying sensitive Figma content, proprietary UI code, internal URLs, tokens, or other confidential data into the log. In this skill context, that omission is meaningful because design-to-code workflows often handle private product designs and generated code derived from non-public assets, making accidental retention and later reuse of sensitive information more likely.
The title and the entire instruction set are written as mandatory Chinese-language rules for code generation, with no indication that the user may choose another language or locale. This creates a natural-language locale policy issue because it implicitly enforces Chinese output/instructions without opt-in or justification.