agentleFS
sunflowermmsunflowermm/XRK-AGT/.cursor/skills/xrk-auth/SKILL.md

xrk-auth

Skill140 starsChanged 8 months agoMITView on GitHub

当你需要解释/排查 HTTP 或 WebSocket 的 401、127 回环例外、API Key 机制时使用;确保业务层不重复鉴权。

The file

Files
SKILL.md

文档与代码

  • docs/AUTH.md
  • 门面:src/agent-runtime.js(_authMiddleware、checkApiAuthorization、wsConnect)
  • 实现:src/infrastructure/http/runtime-auth.js、runtime-ws.js、auth.js

原则

  • /api/ 由 HttpApi + AgentRuntime.checkApiAuthorization;公开路由 systemAuth: false。
  • 默认所有客户端须 API Key;server.auth.loopbackExempt===true 时才允许「本机 Host+127」免 Key(公网/反代勿开)。runEnabled=true 时即便 exempt 也强制 Key。
  • 控制台鉴权模式:公开 GET /api/system/auth-mode → requiresKey;禁止用无 Key 打受保护接口靠 401 探测。
  • WS:wsConnect → runtime-ws;AgentRuntime.wsf[path] 可为 { handler, skipAuth: true } 跳过系统 Key。

API Key 携带

Header:X-API-Key、Api-Key、Authorization: Bearer|Token|ApiKey <key>;查询仅 api_key / apiKey。不接受 body 与 token/key 等易撞字段。

Node 26

  • 扩展时判错用 Error.isError,勿 instanceof Error(skill xrk-node-runtime)。
  • 业务 Core 不重复实现鉴权;HTTP 超时仍用 AbortSignal.timeout。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.