跳转到正文
报告库
用途分类 / 其他用途

Extension Http Outcalls Skill 安全审计

作者说它能做什么(原文)

HTTP outcalls performed by the backend canister (not in the frontend), including mandatory local verification of external REST API requests.

第三方安全检查结论

先别安装或运行

已检查文件
1
发现的风险
2
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
高风险

强制 curl 重放可能再次执行真实的修改或删除操作

原文依据:3 处
发现了什么

该 Skill 同时支持 POST、PUT、DELETE、PATCH,并要求用 curl 重放完全相同的方法、请求头和正文。示例 PATCH 会把外部条目标记为 active。文档没有要求使用测试环境、一次性资源、幂等键或提供方的 dry-run 模式。

为什么需要注意

如果目标是生产 API,验证步骤可能重复创建、修改或删除真实记录,也可能重复下单、付款、发信或触发其他不可逆操作。

该技能明确要求对实现的请求用 curl 重放相同的方法、请求头和正文,而适用方法包括 POST、PUT、DELETE、PATCH。示例 PATCH 会把外部条目的 active 状态改为 true。若开发时连接真实服务且请求会修改或删除数据,本地验证会再执行一次真实操作;可要求作者限定测试环境、dry-run、一次性测试资源或幂等保护。风险来自验证指令与写操作的组合,并不证明示例已经执行。

SKILL.md:16来自说明文档打开原文件
This skill covers the requirements for HTTP requests from the backend canister,including GET, HEAD, POST, PUT, DELETE, and PATCH. Use it whenever integratingwith an external API or service.
查看另外 2 个位置
SKILL.md:146来自说明文档打开原文件
  func setItemActive() : async OutCall.Response {    await OutCall.httpRequest({      url = "https://api.example.com/items/123";      method = #patch;      headers = [{ name = "Content-Type"; value = "application/json" }];      body = ?("{\"active\":true}".encodeUtf8());      maxResponseBytes = 100_000;      transform;    });  };
SKILL.md:167来自说明文档打开原文件
Before considering an HTTP outcall complete, execute the equivalent requestlocally with `curl`. Do not rely only on remembered API documentation or on theMotoko code compiling. Every check below is required. If any check fails, theHTTP outcall is incomplete and MUST NOT proceed to deployment.1. **MUST test the exact request implemented in Motoko:** the same HTTP method,   API version, endpoint path, query parameters, headers, and body. Testing a   related endpoint or adding parameters that the implementation does not use   is not valid verification.2. **MUST trace one representative user input end to end** through every
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 1 项风险
中风险

示例允许未经限制的 URL 进入后端网络请求

原文依据:3 处
发现了什么

请求接口接受任意 Text URL,示例辅助函数直接把收到的 url 传给后端 HTTP 客户端,没有展示允许域名、协议、端口或重定向目标的校验。

为什么需要注意

如果应用把用户输入连接到该参数,用户可能诱使 canister 请求非预期或攻击者控制的端点,消耗 canister 资源,并把 URL 中的数据或以后添加的凭据发送到错误主机。

这段证据能说明什么

接口和示例确实接受 Text 类型 URL,并直接传给 HTTP 客户端,所示代码没有域名、协议、端口或重定向校验。但这是文档中的通用模块签名和内部辅助函数(不是 public),来源没有表明 URL 来自不受信任的用户,也没有提供模块真实实现或重定向行为。因此仅凭这些行不能确认存在用户可利用的任意后端请求。若应用会接收用户 URL,应要求固定允许的主机与 HTTPS,并验证重定向后的目标。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
SKILL.md:105来自说明文档打开原文件
  };  public type Request = {    url : Text;    method : Method;    headers : [Header];    body : ?Blob;    maxResponseBytes : Nat64;    transform : Transform;  };  public type Response = IC.HttpRequestResult;
查看另外 2 个位置
SKILL.md:157来自说明文档打开原文件
  func makeGetOutcall(url: Text) : async Text {    await OutCall.httpGetRequest(url, [], transform);  };};
SKILL.md:119来自说明文档打开原文件
  // Generic bounded request supporting GET, HEAD, POST, PUT, DELETE, and PATCH.  public func httpRequest(request : Request) : async Response;  // HTTP GET request with a transform callback function.  public func httpGetRequest(url : Text, extraHeaders: [Header], transform : Transform) : async Text;  // HTTP POST request, specifying a transform callback.  public func httpPostRequest(url : Text, extraHeaders: [Header], body : Text, transform : Transform) : async Text;};
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

1 个说明模块

该 Skill 用于让后端 canister 调用外部 REST API,范围包括读取请求以及 POST、PUT、DELETE、PATCH 等可能改变外部状态的方法。

查看原文
SKILL.md:16来自说明文档打开原文件
This skill covers the requirements for HTTP requests from the backend canister,including GET, HEAD, POST, PUT, DELETE, and PATCH. Use it whenever integratingwith an external API or service.

它要求服务端限制响应规模,每次响应最多 10,000 条、1 MB,并禁止先下载无界集合再在 canister 内筛选。

查看原文
SKILL.md:23来自说明文档打开原文件
Follow these rules:- **MUST use a provider-enforced bounded API request.** The request must limit  the response by identifier, pagination, time range, geographic area, result  count, or another server-side bound appropriate to the feature.  Limit each response to both at most 10_000 entries and at most 1 MB, then  paginate if needed.- **MUST pick the bound that matches the feature.** The five bounds are not
SKILL.md:35来自说明文档打开原文件
  a list the user deliberately pages through, not for searching.- **MUST put every bound in the actual Motoko http request.** A bound used only by a  local test does not protect the canister.- **NEVER fetch an unbounded collection and filter it in the canister.**  Expected response size, typical traffic, or a currently small dataset is not  a bound.- **MUST reject the API or narrow the feature if the provider cannot enforce a

该 Skill 要求用 curl 在本地重放与 Motoko 完全相同的方法、路径、参数、请求头和正文,并另行运行合规检查后才能部署。

查看原文
SKILL.md:167来自说明文档打开原文件
Before considering an HTTP outcall complete, execute the equivalent requestlocally with `curl`. Do not rely only on remembered API documentation or on theMotoko code compiling. Every check below is required. If any check fails, theHTTP outcall is incomplete and MUST NOT proceed to deployment.1. **MUST test the exact request implemented in Motoko:** the same HTTP method,   API version, endpoint path, query parameters, headers, and body. Testing a   related endpoint or adding parameters that the implementation does not use   is not valid verification.2. **MUST trace one representative user input end to end** through every
SKILL.md:185来自说明文档打开原文件
   app. A response that is merely valid JSON is not sufficient.4. **MUST run `check_canister_api_compliance` on the exact URL and method the   implementation uses.** It measures the response against the outcall byte   ceiling and entry bound and reports whether the URL is bounded server-side,   mechanically and behind the deploy gate, so an outcall to a host it never   cleared cannot ship. When it refuses an endpoint, choose a compatible public   API or narrow the feature honestly; do not implement an unbounded fetch-all   request and filter it in the canister.

文档只展示外部 outcall 模块的类型和函数声明;其所声称的 1 MB 上限及非复制执行无法从所提供源码中独立验证。

查看原文
SKILL.md:105来自说明文档打开原文件
  };  public type Request = {    url : Text;    method : Method;    headers : [Header];    body : ?Blob;    maxResponseBytes : Nat64;    transform : Transform;  };  public type Response = IC.HttpRequestResult;  public let defaultMaxResponseBytes : Nat64;  // Helper function for the transform callback used by the IC on HTTP outcalls.  public func transform(input : TransformationInput) : TransformationOutput;  // Generic bounded request supporting GET, HEAD, POST, PUT, DELETE, and PATCH.  public func httpRequest(request : Request) : async Response;
SKILL.md:130来自说明文档打开原文件
Use `httpRequest` when the status, headers, a custom response limit, or a methodother than GET or POST is needed. `maxResponseBytes` may set a lower limit; themodule caps every request at `defaultMaxResponseBytes` (1 MB). The moduleexecutes every HTTP outcall with `is_replicated = ?false`; callers cannot enablereplicated execution. The backward-compatible helper stays the shortest path fora simple GET:
从这里开始 · 工作说明SKILL.md
extension-http-outcalls
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。
文件与检查记录1 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明

代码和说明中提到的操作

连接外部网站
SKILL.md:3来自说明文档打开原文件
name: extension-http-outcallsdescription: HTTP outcalls performed by the backend canister (not in the frontend), including mandatory local verification of external REST API requests.version: 0.1.9
SKILL.md:12来自说明文档打开原文件
# HTTP OutcallsHTTP outcalls extension for [Caffeine AI](https://caffeine.ai?utm_source=caffeine-skill&utm_medium=referral).
SKILL.md:43来自说明文档打开原文件
  unsafe fallback.- **Test locally against curl implementation.** Ensure the 1:1 curl call succeeds  and returns every field the app consumes. When Motoko code changes, redo the
读取了多少行
210
文件校验值(用于核对版本)
2fee050d5c33465293bdcef0b4be49880d64cd3d091bc6c1e8782b7cf61752e0