Skip to content

Commit 24d8611

Browse files
committed
fix(gateway): rate-limit cron mutations
1 parent 1d54ce3 commit 24d8611

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎src/gateway/methods/core-descriptors.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,10 @@ const CORE_GATEWAY_METHOD_SPECS = [
342342
["cron.status", "cron", "operator.read", "<=2026.7"],
343343
["cron.scratch.get", "cron", "operator.admin", "2026.7"],
344344
["cron.scratch.set", "cron", "operator.admin", "2026.7"],
345-
["cron.add", "cron", "operator.admin", "<=2026.7"],
346-
["cron.update", "cron", "operator.admin", "<=2026.7"],
347-
["cron.remove", "cron", "operator.admin", "<=2026.7"],
348-
["cron.run", "cron", "operator.admin", "<=2026.7"],
345+
["cron.add", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
346+
["cron.update", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
347+
["cron.remove", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
348+
["cron.run", "cron", "operator.admin", "<=2026.7", { controlPlaneWrite: true }],
349349
["cron.runs", "cron", "operator.read", "<=2026.7"],
350350
["gateway.identity.get", "system", "operator.read", "<=2026.7"],
351351
// Deprecated read-only compatibility preview; new restart flows request the

‎src/gateway/server-methods-list.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,23 @@ describe("listGatewayMethods", () => {
203203
expect(descriptor?.controlPlaneWrite).toBeUndefined();
204204
});
205205

206+
it("classifies cron mutations as control-plane writes", () => {
207+
const descriptors = createCoreGatewayMethodDescriptors(coreGatewayHandlers);
208+
209+
for (const method of ["cron.add", "cron.update", "cron.remove", "cron.run"]) {
210+
expect(descriptors.find((descriptor) => descriptor.name === method)).toMatchObject({
211+
name: method,
212+
scope: "operator.admin",
213+
controlPlaneWrite: true,
214+
});
215+
}
216+
for (const method of ["cron.get", "cron.list", "cron.status", "cron.runs"]) {
217+
expect(
218+
descriptors.find((descriptor) => descriptor.name === method)?.controlPlaneWrite,
219+
).toBeUndefined();
220+
}
221+
});
222+
206223
it("does not advertise hidden core handlers", () => {
207224
const methods = listGatewayMethods();
208225
expect(methods).not.toContain("node.runnerInventory.update");

0 commit comments

Comments
 (0)