fix(agent-teams): enforce T-prefixed task id validation
This commit is contained in:
parent
2103061123
commit
11766b085d
@ -71,8 +71,9 @@ describe("agent-teams name validation", () => {
|
|||||||
test("validates task ids", () => {
|
test("validates task ids", () => {
|
||||||
//#then
|
//#then
|
||||||
expect(validateTaskId("T-123")).toBeNull()
|
expect(validateTaskId("T-123")).toBeNull()
|
||||||
|
expect(validateTaskId("123")).toBe("task_id_invalid")
|
||||||
expect(validateTaskId("")).toBe("task_id_required")
|
expect(validateTaskId("")).toBe("task_id_required")
|
||||||
expect(validateTaskId("../../etc/passwd")).toBe("task_id_invalid")
|
expect(validateTaskId("../../etc/passwd")).toBe("task_id_invalid")
|
||||||
expect(validateTaskId("a".repeat(129))).toBe("task_id_too_long")
|
expect(validateTaskId(`T-${"a".repeat(127)}`)).toBe("task_id_too_long")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const VALID_NAME_RE = /^[A-Za-z0-9_-]+$/
|
const VALID_NAME_RE = /^[A-Za-z0-9_-]+$/
|
||||||
const MAX_NAME_LENGTH = 64
|
const MAX_NAME_LENGTH = 64
|
||||||
const VALID_TASK_ID_RE = /^[A-Za-z0-9_-]+$/
|
const VALID_TASK_ID_RE = /^T-[A-Za-z0-9_-]+$/
|
||||||
const MAX_TASK_ID_LENGTH = 128
|
const MAX_TASK_ID_LENGTH = 128
|
||||||
|
|
||||||
function validateName(value: string, label: "team" | "agent"): string | null {
|
function validateName(value: string, label: "team" | "agent"): string | null {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user