mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(github): bound guard response bodies
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
// Security Sensitive Guard Script tests cover sensitive file guard behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
GITHUB_RESPONSE_BODY_MAX_BYTES,
|
||||
allowSecuritySensitiveCommand,
|
||||
collectSecuritySensitiveChanges,
|
||||
findSecuritySensitiveOverrideCommand,
|
||||
findSecuritySensitiveOverrideCommandAsync,
|
||||
findTrustedSecuritySensitiveGuardActor,
|
||||
githubApi,
|
||||
isSecuritySensitiveFile,
|
||||
isSecuritySensitiveGuardAuthorizedForHead,
|
||||
isSecuritySensitiveGuardMarkerComment,
|
||||
@@ -245,4 +247,19 @@ describe("security-sensitive guard script", () => {
|
||||
new Set(["vincentkoc", "steipete", "joshavant"]),
|
||||
);
|
||||
});
|
||||
|
||||
it("bounds successful GitHub API response bodies", async () => {
|
||||
const request = githubApi("token", {
|
||||
responseMaxBodyBytes: 64,
|
||||
fetchImpl: (() =>
|
||||
Promise.resolve(
|
||||
new Response("x".repeat(65), {
|
||||
headers: { "content-length": "65" },
|
||||
}),
|
||||
)) as typeof fetch,
|
||||
}).request("/repos/openclaw/openclaw");
|
||||
|
||||
await expect(request).rejects.toThrow("GitHub response body exceeded 64 bytes");
|
||||
expect(GITHUB_RESPONSE_BODY_MAX_BYTES).toBeGreaterThan(64);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user