feat(auth): add argon2id passwords, sessions, rate limiter, authorization and audit builders

- feat(auth): add argon2id passwords, sessions, rate limiter, authorization and audit builders
- feat(cli): add check and audit commands
- feat(api): add api framework, login, page routes and account, user, delegation and audit handlers
- test(auth): cover passwords, sessions, rate limiter, authorization and audit builders
- test(api): cover the api framework, sessions, client origin, headers and cross-origin refusal
- test(api): cover account, user, delegation and audit handlers and the authorization matrix
- test(ui): cover login, logout, page routes and the page authorization matrix
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 23bec143e3
commit 99fa5de747
28 files changed
+6591 -243

No files matched your search

+18 -3
View File
@@ -176,15 +176,30 @@ func TestIntegrationCheckAndAuditCommands(t *testing.T) {
t.Parallel()
d := newITDatabase(t, itOptions{prefix: "dns_"})
c := d.cli(t, "", time.Now())
if code := c.run("check"); code != 1 || c.stderr.String() != "coredns-web-ui: check: not implemented\n" {
t.Fatalf("%d %q", code, c.stderr.String())
if code := c.run("check"); code != 0 || c.stdout.String() != "ZONE NAME TYPE ID SEVERITY PROBLEM\n" {
t.Fatalf("%d %q %q", code, c.stdout.String(), c.stderr.String())
}
if d.count(t, "SELECT `version` FROM `dns_webui_schema`") != 1 {
t.Fatal("check did not migrate")
}
if code := c.run("audit", "5"); code != 1 || c.stderr.String() != "coredns-web-ui: audit: not implemented\n" {
d.rootExec(t, "INSERT INTO `dns_records` (`zone`, `name`, `ttl`, `content`, `record_type`) VALUES ('example.org.', 'www', NULL, '{\"ip\": \"192.0.2.1\"}', 'A')")
c = d.cli(t, "", time.Now())
if code := c.run("check", "EXAMPLE.org"); code != 3 || !strings.Contains(c.stdout.String(), "ttl_null") || !strings.Contains(c.stdout.String(), "soa_missing") {
t.Fatalf("%d %q %q", code, c.stdout.String(), c.stderr.String())
}
c = d.cli(t, "", time.Now())
if code := c.run("check", "missing.example"); code != 1 || c.stderr.String() != "coredns-web-ui: the zone has no records\n" {
t.Fatalf("%d %q", code, c.stderr.String())
}
c = d.cli(t, "a-long-password\n", time.Date(2026, 11, 18, 9, 0, 0, 0, time.UTC))
if code := c.run("user", "add", "alice", "admin"); code != 0 {
t.Fatalf("%d %q", code, c.stderr.String())
}
c = d.cli(t, "", time.Now())
if code := c.run("audit", "5"); code != 0 || c.stdout.String() != "TIME ACTOR ORIGIN OPERATION STATUS ZONE RECORD TARGET_USER\n"+
"2026-11-18T09:00:00Z cli local user_create - - - alice\n" {
t.Fatalf("%d %q %q", code, c.stdout.String(), c.stderr.String())
}
if code := c.run("audit", "x"); code != 2 {
t.Fatal(code)
}