mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
fix(gateway): rate-limit cron mutations (#128287)
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
committed by
GitHub
parent
b0dafb2551
commit
bca206d794
@@ -342,10 +342,10 @@ const CORE_GATEWAY_METHOD_SPECS = [
|
||||
["cron.status", "cron", "operator.read", "<=2026.7"],
|
||||
["cron.scratch.get", "cron", "operator.admin", "2026.7"],
|
||||
["cron.scratch.set", "cron", "operator.admin", "2026.7"],
|
||||
["cron.add", "cron", "operator.admin", "<=2026.7"],
|
||||
["cron.update", "cron", "operator.admin", "<=2026.7"],
|
||||
["cron.remove", "cron", "operator.admin", "<=2026.7"],
|
||||
["cron.run", "cron", "operator.admin", "<=2026.7"],
|
||||
["cron.add", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
|
||||
["cron.update", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
|
||||
["cron.remove", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
|
||||
["cron.run", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
|
||||
["cron.runs", "cron", "operator.read", "<=2026.7"],
|
||||
["gateway.identity.get", "system", "operator.read", "<=2026.7"],
|
||||
// Deprecated read-only compatibility preview; new restart flows request the
|
||||
|
||||
@@ -203,6 +203,23 @@ describe("listGatewayMethods", () => {
|
||||
expect(descriptor?.controlPlaneWrite).toBeUndefined();
|
||||
});
|
||||
|
||||
it("classifies cron mutations as control-plane writes", () => {
|
||||
const descriptors = createCoreGatewayMethodDescriptors(coreGatewayHandlers);
|
||||
|
||||
for (const method of ["cron.add", "cron.update", "cron.remove", "cron.run"]) {
|
||||
expect(descriptors.find((descriptor) => descriptor.name === method)).toMatchObject({
|
||||
name: method,
|
||||
scope: "operator.admin",
|
||||
controlPlaneWrite: true,
|
||||
});
|
||||
}
|
||||
for (const method of ["cron.get", "cron.list", "cron.status", "cron.runs"]) {
|
||||
expect(
|
||||
descriptors.find((descriptor) => descriptor.name === method)?.controlPlaneWrite,
|
||||
).toBeUndefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("does not advertise hidden core handlers", () => {
|
||||
const methods = listGatewayMethods();
|
||||
expect(methods).not.toContain("node.runnerInventory.update");
|
||||
|
||||
Reference in New Issue
Block a user