Commit 03040d2164

03040d2164851d376faa1404efc954b3c3e3c8ea

parent: 1ed9fb9399

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-28 07:41 UTC

control: keys add refuses --ttl 0h and negative

Ref #277

Layout: unified · split

internal/control/keyexpiry_test.go +6
@@ -47,6 +47,12 @@ func TestKeysAddTTLAndList(t *testing.T) {
4747 if _, _, code := run(authorizedKey(t, "x"), "keys", "add", "--ttl", "soon"); code != protocol.ExitUsage {
4848 t.Fatalf("bad ttl: exit %d", code)
4949 }
50 if _, _, code := run(authorizedKey(t, "x"), "keys", "add", "--ttl", "0h"); code != protocol.ExitUsage {
51 t.Fatalf("zero ttl: exit %d", code)
52 }
53 if _, _, code := run(authorizedKey(t, "x"), "keys", "add", "--ttl", "-1h"); code != protocol.ExitUsage {
54 t.Fatalf("negative ttl: exit %d", code)
55 }
5056
5157 keys, err := st.ListSSHKeys(uid)
5258 if err != nil || len(keys) != 2 {