infisical-sync-skill
它能做什么
这个技能为处理自托管 Infisical 保险库中的密钥提供 API 参考和安全指导,包括使用机器身份登录和列出密钥。适合把凭据保存在安全存储中的开发者。
适用场景
- ✓当你需要列出、读取或更新 Infisical 保险库中存储的密钥时。
- ✓当你的智能体必须使用机器身份登录 Infisical 时。
- ✓当某次 Infisical API 调用失败,你需要理解错误原因时。
技能链接
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-hands/bundled/infisical-sync/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请列出我们 Infisical staging 环境中的密钥名称,以便与我们的配置文件进行比较。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能讲解如何使用客户端 ID 和客户端密钥登录以获得一个短期有效的令牌,然后针对正确的项目和环境调用密钥接口。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Infisical Sync Expert Knowledge
1. Infisical API Reference
Base URL
All requests go to $INFISICAL_URL. This is the self-hosted instance base URL, e.g. https://infisical.example.com.
Authentication — Universal Auth
Infisical uses Machine Identities with Universal Auth for agent-to-agent communication.
Endpoint: POST /api/v1/auth/universal-auth/login
Request:
{
"clientId": "<INFISICAL_CLIENT_ID>",
"clientSecret": "<INFISICAL_CLIENT_SECRET>"
}
Response (success):
{
"accessToken": "eyJ...",
"expiresIn": 7200,
"accessTokenMaxTTL": 43200,
"tokenType": "Bearer"
}
curl example:
RESPONSE=$(curl -s -X POST "$INFISICAL_URL/api/v1/auth/universal-auth/login" \
-H "Content-Type: application/json" \
-d "{\"clientId\":\"$INFISICAL_CLIENT_ID\",\"clientSecret\":\"$INFISICAL_CLIENT_SECRET\"}")
ACCESS_TOKEN=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['accessToken'])")
Token lifetime: expiresIn seconds (usually 7200 = 2 hours). Re-authenticate when expired.
List Secrets
Endpoint: GET /api/v4/secrets
Query parameters:
| Param | Required | Description |
|---|---|---|
projectId |
Yes | Infisical project ID |
environment |
Yes | Environment slug (e.g. prod, staging, dev) |
secretPath |
No | Path prefix, default / |
includeImports |
No | Include imported secrets, default false |
recursive |
No | Include secrets in sub-paths, default false |
curl example:
curl -s -X GET \
"$INFISICAL_URL/api/v4/secrets?projectId=$PROJECT_ID&environment=$ENVIRONMENT&secretPath=/" \
-H "Authorization: Bearer $ACCESS_TOKEN"
Response shape:
{
"secrets": [
{
"id": "uuid",
"version": 1,
"secretKey": "DATABASE_URL",
"secretValue": "postgres://...",
"secretComment": "",
"environment": "prod",
"workspace": "uuid"
}
],
"imports": []
}
Parse with:
echo "$RESPONSE" | python3 -c "
import sys, json
data = json.load(sys.stdin)
for s in data.get('secrets', []):
print(s['secretKey'])
"
Create or Update a Secret
The API does not provide a single upsert endpoint. POST creates only (returns 409 if the secret already exists); PATCH updates only (returns 404 if missing). Use the create-then-update pattern:
Step 1 — Try to create (POST)
Endpoint: POST /api/v4/secrets/{secretName}
Request body:
{
"projectId": "<PROJECT_ID>",
"environment": "<ENV>",
"secretValue": "<VALUE>",
"secretPath": "/"
}
HTTP_STATUS=$(curl -s -o /tmp/infisical_response.json -w "%{http_code}" \
-X POST "$INFISICAL_URL/api/v4/secrets/$SECRET_NAME" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"projectId\":\"$PROJECT_ID\",\"environment\":\"$ENVIRONMENT\",\"secretValue\":\"$SECRET_VALUE\",\"secretPath\":\"/\"}")
Returns 201 on success.
Step 2 — If 409, update via PATCH
Endpoint: PATCH /api/v4/secrets/{secretName}
if [ "$HTTP_STATUS" = "409" ]; then
HTTP_STATUS=$(curl -s -o /tmp/infisical_response.json -w "%{http_code}" \
-X PATCH "$INFISICAL_URL/api/v4/secrets/$SECRET_NAME" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"projectId\":\"$PROJECT_ID\",\"environment\":\"$ENVIRONMENT\",\"secretValue\":\"$SECRET_VALUE\",\"secretPath\":\"/\"}")
fi
Returns 200 on success. Any other status code is an error.
Important: URL-encode the secret name if it contains special characters.
Delete a Secret
Endpoint: DELETE /api/v4/secrets/{secretName}
Query parameters: projectId, environment, secretPath (default /)
curl example:
curl -s -X DELETE \
"$INFISICAL_URL/api/v4/secrets/$SECRET_NAME?projectId=$PROJECT_ID&environment=$ENVIRONMENT&secretPath=/" \
-H "Authorization: Bearer $ACCESS_TOKEN"
List Accessible Projects (Workspaces)
Endpoint: GET /api/v1/workspace
curl -s -X GET "$INFISICAL_URL/api/v1/workspace" \
-H "Authorization: Bearer $ACCESS_TOKEN"
Response: { "workspaces": [{ "id": "uuid", "name": "...", "environments": [...] }] }
2. HTTP Error Codes
| Code | Meaning | Action |
|---|---|---|
| 200/201 | Success | Continue |
| 400 | Bad Request | Log the response body — likely malformed JSON or missing |
常见问题
我需要机器身份吗?
需要。该技能使用 Universal Auth,通过客户端 ID 和客户端密钥登录。
登录令牌能持续多久?
该技能说明令牌通常约两小时有效,之后智能体必须重新登录。
保险库地址从哪里来?
它是你自托管的 Infisical 地址,该技能从环境变量中读取。
详情
作者的原始描述
Expert knowledge for the Infisical Sync Hand — Infisical API reference, vault operations, error patterns, security guidance
repo: RightNow-AI/openfang
热度
- GitHub 星标
- 18k
- 排名
- #10656
- 许可证
- Apache-2.0
- 更新时间
- 2026/7/2
评论
- …