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:
1 parent
23bec143e3
commit
99fa5de747
28 files changed
+6591
-243
No files matched your search
+3
-6
@@ -376,15 +376,12 @@ func TestUserStoreUpdates(t *testing.T) {
|
||||
|
||||
func TestAuditUserJSON(t *testing.T) {
|
||||
u := userRow{ID: 7, Username: "alice", Role: "admin", PasswordHash: "$secret", CreatedAt: time.Date(2026, 1, 2, 3, 4, 5, 6000, time.UTC)}
|
||||
b, err := auditUserJSON(u)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b := auditUserJSON(u)
|
||||
if string(b) != `{"id":7,"username":"alice","role":"admin","created_at":"2026-01-02T03:04:05.000006Z","deleted_at":null}` {
|
||||
t.Fatal(string(b))
|
||||
}
|
||||
u.DeletedAt = sql.NullTime{Time: time.Date(2026, 2, 3, 4, 5, 6, 0, time.FixedZone("x", 7200)), Valid: true}
|
||||
b, _ = auditUserJSON(u)
|
||||
b = auditUserJSON(u)
|
||||
if !strings.Contains(string(b), `"deleted_at":"2026-02-03T02:05:06.000000Z"`) || strings.Contains(string(b), "secret") {
|
||||
t.Fatal(string(b))
|
||||
}
|
||||
@@ -636,7 +633,7 @@ func TestAuditFilterSQL(t *testing.T) {
|
||||
t.Fatalf("%q lacks %q", where, f)
|
||||
}
|
||||
}
|
||||
if len(args) != 3+len(auditStoreChangeOperations)+3 || args[len(args)-1] != int64(5) || args[len(args)-3] != int64(99) {
|
||||
if len(args) != 3+len(auditChangeOperations)+3 || args[len(args)-1] != int64(5) || args[len(args)-3] != int64(99) {
|
||||
t.Fatalf("args %v", args)
|
||||
}
|
||||
where, _, _ = auditFilterSQL(auditFilter{Kind: "change", Outcome: "success"})
|
||||
|
||||
Reference in new issue
Block a user