Fix outbound confirmation and verification safety

This commit is contained in:
gitea committed 2026-10-12 00:13:22 +08:00
1 parent b17bd09194
commit 67a461452c
20 files changed
+313 -74

No files matched your search

+13
View File
@@ -158,6 +158,19 @@ describe("option helpers", () => {
expect(() => parseHoseExpireSeconds("invalid")).toThrow("必须为有效时长");
});
test("overflowing --expire literals are usage errors before reaching auth", () => {
for (const parse of [parseDelegationExpireHours, parseHoseExpireSeconds]) {
for (const literal of ["9".repeat(309), "9".repeat(309) + "s", "9".repeat(308) + "d"]) {
expect(() => parse(literal)).toThrow();
try {
parse(literal);
} catch (error) {
expect((error as { exitCode: number }).exitCode).toBe(2);
}
}
}
});
test("both --expire flags read a unitless literal the same way", () => {
// Regression: the two parsers used to each carry their own copy of the
// unitless heuristic, so `--expire 300` meant 5 minutes on one path and