mirror of
https://github.com/luxfi/bank.git
synced 2026-10-30 17:02:07 +00:00
CRITICAL: - F01: Explicit API rules on all collections (owner-scoped list/view) - F02: HMAC-SHA256 webhook auth replaces RequireSuperuserAuth - F03: RunInTransaction for atomic balance check+hold (no overdraft) - F04: Audit log immutable (block update/delete unconditionally) HIGH: - F05: math.Round() before all float-to-int casts (no truncation) - F08: Transfer destination ownership verified - F09: Fixed daily/monthly limit filter queries - F12: Added "cancelled" to allowed processing transitions - F13: Balance floor check (reject if available < 0) New files: hooks/hmac.go (HMAC middleware), hooks/audit.go (immutable guard) Env: WEBHOOK_HMAC_SECRET required for webhook endpoints (from KMS)
21 lines
588 B
Go
21 lines
588 B
Go
package hooks
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/hanzoai/base/core"
|
|
"github.com/luxfi/bank/collections"
|
|
)
|
|
|
|
// RegisterAuditHooks makes the audit_log collection immutable by blocking
|
|
// all update and delete operations unconditionally.
|
|
func RegisterAuditHooks(app core.App) {
|
|
app.OnRecordUpdate(collections.AuditCollectionName).BindFunc(func(e *core.RecordEvent) error {
|
|
return errors.New("audit log records are immutable")
|
|
})
|
|
|
|
app.OnRecordDelete(collections.AuditCollectionName).BindFunc(func(e *core.RecordEvent) error {
|
|
return errors.New("audit log records are immutable")
|
|
})
|
|
}
|