test(ui): avoid a literal em dash in the em dash check
- test(ui): avoid a literal em dash in the em dash check - fix(cli): accept any positive int64 audit count and share the last active admin rule - fix(api): limit audit before_id to 2^53-1 - fix(api): audit unmatched api requests, bound every request body and record audit write failures - fix(ui): recheck the account in the login transaction and require existing zones on zone pages - fix(api): recheck the acting admin and the stored password hash in change transactions - fix(db): keep committed outcomes on lock release failure, narrow the records contract and trace sql statements - fix(db): make the initial migration restartable and verify the application schema - fix(auth): never move last_seen_at backwards on concurrent session touches - test(api): cover lock release failure after commit and handler tracing without secrets - fix(test): redact credentials from mysql setup errors - fix(audit): retain addressed objects on admin refusals - test(db): cover migration restarts and records contract ranges in mysql - test(api): verify account races and audit rollback in mysql - fix(auth): reject password changes after account deletion - docs: document unknown api audit entries - fix(audit): bound failure retries and redact sensitive sql parameters - fix(test): isolate docker resources and cover image cli commands - test(auth): expect unauthorized after an account deletion race - fix(db): verify application column widths and foreign keys
This commit is contained in:
1 parent
5f17aab6ca
commit
53444bec7a
40 files changed
+2332
-254
No files matched your search
+10
-8
@@ -133,7 +133,7 @@ func TestPasswordChange(t *testing.T) {
|
||||
h.store.setUser(gone)
|
||||
h.s.store = &deletedDuringRequest{fakeWebStore: h.store, user: gone}
|
||||
res = h.api("PUT", path, token, `{"current":"brand-new-password","password":"another-password"}`)
|
||||
expectError(t, res, 404, `{"error":"user not found"}`)
|
||||
expectError(t, res, 401, `{"error":"authentication required"}`)
|
||||
}
|
||||
|
||||
type deletedDuringRequest struct {
|
||||
@@ -425,10 +425,10 @@ func TestAPIUserRole(t *testing.T) {
|
||||
}
|
||||
}
|
||||
res = h.api("PUT", "/users/root/role", token, `{"role":"user"}`)
|
||||
expectError(t, res, 409, `{"error":"the last active admin cannot be demoted or deleted"}`)
|
||||
expectNoChange(t, res, opUserRole, 409)
|
||||
if h.stored("root").Role != roleAdmin {
|
||||
t.Fatal("last admin demoted")
|
||||
expectError(t, res, 403, `{"error":"admin role required"}`)
|
||||
expectNoChange(t, res, opUserRole, 403)
|
||||
if h.stored("root").Role != roleAdmin || h.stored("admin").Role != roleAdmin {
|
||||
t.Fatal("change by a demoted actor kept")
|
||||
}
|
||||
h.store.onLock = nil
|
||||
h.store.failOn["SetRole"] = errors.New("x")
|
||||
@@ -494,7 +494,8 @@ func TestAPIUserDelete(t *testing.T) {
|
||||
st.users[0].DeletedAt = sql.NullTime{Time: webNow, Valid: true}
|
||||
}
|
||||
res = h.api("DELETE", "/users/root", token, `{"confirm":"root"}`)
|
||||
expectError(t, res, 409, `{"error":"the last active admin cannot be demoted or deleted"}`)
|
||||
expectError(t, res, 403, `{"error":"admin role required"}`)
|
||||
expectNoChange(t, res, opUserDelete, 403)
|
||||
if h.stored("root").DeletedAt.Valid || h.stored("admin").DeletedAt.Valid {
|
||||
t.Fatal("rolled back state kept")
|
||||
}
|
||||
@@ -624,7 +625,7 @@ func TestAuditFilterParsing(t *testing.T) {
|
||||
"operation=login": {Operation: "login", Limit: 50},
|
||||
"kind=read&outcome=error": {Kind: "read", Outcome: "error", Limit: 50},
|
||||
"kind=change&outcome=success": {Kind: "change", Outcome: "success", Limit: 50},
|
||||
"before_id=9007199254740993&limit=200": {BeforeID: 9007199254740993, Limit: 200},
|
||||
"before_id=9007199254740991&limit=200": {BeforeID: 9007199254740991, Limit: 200},
|
||||
"limit=1": {Limit: 1},
|
||||
}
|
||||
for q, want := range good {
|
||||
@@ -644,6 +645,7 @@ func TestAuditFilterParsing(t *testing.T) {
|
||||
"before_id=-1": "before_id",
|
||||
"before_id=1e3": "before_id",
|
||||
"before_id=99999999999999999999": "before_id",
|
||||
"before_id=9007199254740992": "before_id",
|
||||
"limit=0": "limit",
|
||||
"limit=201": "limit",
|
||||
"limit=+5": "limit",
|
||||
@@ -1174,7 +1176,7 @@ func TestZoneAPIWriteHandlers(t *testing.T) {
|
||||
recordID int64
|
||||
serial bool
|
||||
}{
|
||||
{"zone_create", "", "", zoneAPITestCreate, 201, nil, []int64{1, 2, 3}, 0, false},
|
||||
{"zone_create", "", "", zoneAPITestCreate, 201, []int64{}, []int64{1, 2, 3}, 0, false},
|
||||
{"zone_delete", "", "", `{"confirm":"EXAMPLE.ORG"}`, 204, []int64{1, 2, 3, 4}, nil, 0, false},
|
||||
{"record_create", "", "", zoneAPITestRecord, 201, []int64{1}, []int64{1, 5}, 5, true},
|
||||
{"record_update", "3", recordETag(rows[2]), zoneAPITestRecord, 200, []int64{1, 3}, []int64{1, 3}, 3, true},
|
||||
|
||||
Reference in new issue
Block a user