令牌可能暴露在对话上下文或本机进程参数中
原文依据:3 处环境变量缺失时,Skill 要求用户向代理提供 API 密钥;正常对话并不是专用的秘密输入通道。示例还让 shell 把令牌展开到 curl 的命令行参数中,在某些共享系统上,其他本地进程或用户可能短暂看到该参数。虽然文档禁止回显令牌,但这不能消除令牌已进入对话上下文和进程参数的风险。
获得令牌的人可在该 Notion 集成权限范围内读取工作区内容,并可能创建、修改、归档或删除内容。
当环境中没有令牌时,Skill 明确要求用户在对话中提供 API 密钥,使凭据进入对话上下文。其 curl 示例还把环境变量展开为 Authorization 参数;在允许其他用户或进程查看进程参数的系统上,令牌可能短暂可见。禁止显示或记录令牌是有效的保护措施,但没有消除上述两条暴露路径。用户可要求作者改用平台的专用秘密输入/存储机制,并限制进程查看权限及令牌的 Notion 访问范围。
1. **Environment Variable**: Check if `NOTION_API_TOKEN` is available in the environment2. **User-Provided Key**: If the user provides an API key in context, use that instead3. **No Key Available**: If neither is available, use AskUserQuestion (or equivalent) to request the API key from the user**IMPORTANT**: Never display, log, or send `NOTION_API_TOKEN` anywhere except in the `Authorization` header. Confirm its existence, ask if missing, use it in requests—but never echo or expose it.查看另外 2 个位置
```bash-H "Authorization: Bearer $NOTION_API_TOKEN" \-H "Notion-Version: 2025-09-03" \-H "Content-Type: application/json"``````bashcurl -s "https://api.notion.com/v1/users/me" \ -H "Authorization: Bearer $NOTION_API_TOKEN" \ -H "Notion-Version: 2025-09-03" | jq```