warden-service
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWarden Service
Warden Service
Query Warden Service with a read-only personal token and return a bounded, evidence-based answer.
使用只读个人令牌查询Warden Service,并返回有依据的限定性答案。
Workflow
工作流程
- Identify the Warden Service origin and confirm is set without displaying its value.
WARDEN_PAT - If the token is missing, direct the user to API access in the Warden Service dashboard. Have them create a personal token and export it as ; never ask them to paste it into chat or a command literal.
WARDEN_PAT - Read to select the exact route, supported filters, pagination behavior, and response fields for the question.
references/read-api.md - Narrow the request to the user's repository, time range, skill, severity, or other stated scope. Use a bounded for runs and findings.
limit - Send a request with the token read from the environment. URL-encode every query value.
GET - Follow only while more results are needed. Preserve all original filters and stop when the requested scope is satisfied or the response omits
nextCursor.nextCursor - Summarize the relevant JSON fields. State the route and filters used, and distinguish an empty result from a failed request.
- 确定Warden Service的源地址,确认已设置,但不显示其具体值。
WARDEN_PAT - 如果令牌缺失,引导用户前往Warden Service控制台的API访问页面。让他们创建个人令牌并将其导出为;切勿要求用户将令牌粘贴到聊天框或命令文本中。
WARDEN_PAT - 阅读文档,为当前问题选择准确的路由、支持的过滤器、分页规则以及响应字段。
references/read-api.md - 根据用户指定的代码库、时间范围、Skill、严重程度或其他限定范围缩小请求范围。对运行记录和检测结果使用限定的参数。
limit - 使用从环境变量中读取的令牌发送请求。对所有查询参数值进行URL编码。
GET - 仅在需要更多结果时才跟随。保留所有原始过滤器,当满足请求范围或响应中没有
nextCursor时停止请求。nextCursor - 总结相关的JSON字段。说明使用的路由和过滤器,并区分空结果与请求失败的情况。
Request Pattern
请求模式
Use with instead of assembling a query string manually:
--get--data-urlencodebash
curl --fail-with-body --silent --show-error --get \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${WARDEN_PAT}" \
--data-urlencode 'severity=high' \
--data-urlencode 'skill=security-review' \
--data-urlencode 'limit=30' \
"${WARDEN_SERVICE_URL%/}/api/v1/findings"Keep the token in . Do not enable verbose or trace output that could expose the authorization header.
WARDEN_PAT使用和参数,而非手动拼接查询字符串:
--get--data-urlencodebash
curl --fail-with-body --silent --show-error --get \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${WARDEN_PAT}" \
--data-urlencode 'severity=high' \
--data-urlencode 'skill=security-review' \
--data-urlencode 'limit=30' \
"${WARDEN_SERVICE_URL%/}/api/v1/findings"将令牌保存在中。不要启用可能暴露授权头的详细或跟踪输出。
WARDEN_PATPagination
分页
Only and use cursor pagination. Treat as opaque and pass it back unchanged through URL encoding:
/api/v1/runs/api/v1/findingsnextCursorbash
curl --fail-with-body --silent --show-error --get \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${WARDEN_PAT}" \
--data-urlencode "cursor=${NEXT_CURSOR}" \
--data-urlencode 'severity=high' \
--data-urlencode 'limit=100' \
"${WARDEN_SERVICE_URL%/}/api/v1/findings"只有和接口使用游标分页。将视为不透明值,通过URL编码后原样传递:
/api/v1/runs/api/v1/findingsnextCursorbash
curl --fail-with-body --silent --show-error --get \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${WARDEN_PAT}" \
--data-urlencode "cursor=${NEXT_CURSOR}" \
--data-urlencode 'severity=high' \
--data-urlencode 'limit=100' \
"${WARDEN_SERVICE_URL%/}/api/v1/findings"Errors
错误处理
Use the HTTP status and the JSON and together:
error.codeerror.message| Status | Meaning | Action |
|---|---|---|
| 400 | Invalid query filters | Correct the parameter names, values, or RFC 3339 timestamps. |
| 401 | Missing, invalid, or expired authentication | Verify the origin and replace the personal token through API access. |
| 403 | Insufficient role or disallowed personal-token operation | Keep the request read-only and within the token's repository scope. |
| 404 | Unknown or unauthorized route/resource | Verify the documented route or ID without assuming the resource exists. |
| 429 | Rate limited | Wait and retry later; do not create a tight retry loop. |
结合HTTP状态码以及JSON中的和进行处理:
error.codeerror.message| 状态码 | 含义 | 操作 |
|---|---|---|
| 400 | 查询过滤器无效 | 修正参数名称、参数值或RFC 3339格式的时间戳。 |
| 401 | 身份验证缺失、无效或过期 | 验证源地址,并通过API访问页面更换个人令牌。 |
| 403 | 角色权限不足或个人令牌操作被禁止 | 保持请求为只读,并在令牌的代码库权限范围内操作。 |
| 404 | 路由/资源未知或未授权 | 验证文档中记录的路由或ID,不要假设资源存在。 |
| 429 | 请求频率受限 | 等待后重试;不要创建频繁重试的循环。 |
Boundaries
边界限制
- Use personal tokens only for or
GET. Never attemptHEAD,POST,PUT, orPATCHwith them.DELETE - Never reveal, log, persist, embed as a command literal, or ask the user to paste a token.
- Respect the token's tenant, role, and repository restrictions. Never attempt to bypass them.
- Use only routes, filters, and response fields documented in .
references/read-api.md - Fetch and display only the data required for the user's stated scope. Use the export route only when the user explicitly requests an export.
- If the read API cannot answer the question, say so. Do not substitute an ingest, memory-recall, token-management, retention, or deletion request.
- 个人令牌仅用于或
GET请求。切勿使用其尝试HEAD、POST、PUT或PATCH操作。DELETE - 切勿泄露、记录、持久化、嵌入到命令文本中,或要求用户粘贴令牌。
- 遵守令牌的租户、角色和代码库限制。切勿尝试绕过这些限制。
- 仅使用文档中记录的路由、过滤器和响应字段。
references/read-api.md - 仅获取并显示用户指定范围内所需的数据。仅当用户明确要求导出时才使用导出路由。
- 如果只读API无法回答问题,直接说明。不要替换为数据摄入、记忆召回、令牌管理、数据保留或删除请求。