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:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 5f17aab6ca
commit 53444bec7a
40 files changed
+2332 -254

No files matched your search

+5 -2
View File
@@ -70,6 +70,7 @@ func nullJSON(b []byte) any {
}
func (s auditStore) InsertAudit(ctx context.Context, e auditEntry) (int64, error) {
defer traceStore(ctx, "auditStore.InsertAudit")()
if len(e.Operation) > auditMaxOperationLen {
return 0, errors.New("insert audit: operation name too long")
}
@@ -77,7 +78,7 @@ func (s auditStore) InsertAudit(ctx context.Context, e auditEntry) (int64, error
if errMsg.Valid {
errMsg.String = cropRunes(errMsg.String, auditMaxErrorRunes)
}
res, err := s.q.ExecContext(ctx,
res, err := s.q.ExecContext(privateSQLArgs(ctx, 7, 11, 12),
s.t.sql("INSERT INTO {audit} (`time`, `user_id`, `actor`, `origin`, `operation`, `status`, `error`, `zone`, `record_id`, `target_user_id`, `before_value`, `after_value`) "+
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),
dbTime(e.Time), e.UserID, cropRunes(e.Actor, auditMaxActorRunes), cropRunes(e.Origin, auditMaxOriginRunes), e.Operation,
@@ -150,6 +151,7 @@ func auditFilterSQL(f auditFilter) (string, []any, error) {
}
func (s auditStore) ListAudit(ctx context.Context, f auditFilter) ([]auditRow, error) {
defer traceStore(ctx, "auditStore.ListAudit")()
if f.Limit < 1 || f.Limit > auditMaxListLimit {
return nil, errors.New("list audit: invalid limit")
}
@@ -161,7 +163,8 @@ func (s auditStore) ListAudit(ctx context.Context, f auditFilter) ([]auditRow, e
return s.queryAudit(ctx, s.t.sql(auditSelect+where+"ORDER BY a.`id` DESC LIMIT ?"), args...)
}
func (s auditStore) LatestAudit(ctx context.Context, n int) ([]auditRow, error) {
func (s auditStore) LatestAudit(ctx context.Context, n int64) ([]auditRow, error) {
defer traceStore(ctx, "auditStore.LatestAudit")()
if n < 1 {
return nil, errors.New("latest audit: invalid count")
}