mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-29 00:06:05 +00:00
* feat: give an organization one fused abuse posture, because every existing control watches a single subject and an actor slightly wrong on several axes sits under all of them: organizations gains risk_state, risk_score, risk_reason and an append-only risk_signals evidence blob, modelled on the warmup participant health machine that already works rather than a second vocabulary for the same idea; restricted cuts per-mailbox cold volume to a quarter and forces the free warmup pool so a risky tenant cannot spend the paid pool's shared reputation, suspended stops sending at the send gate, and watch deliberately changes nothing a customer can feel so evidence accumulates before anything is taken away; an operator's suspension outranks the derived band so a detector clearing cannot release a workspace a human suspended, transitions ride the audit spine to every teammate's dashboard, a banner says which limit is active and why rather than letting volume drop silently, and the posture never travels in a workspace archive since it is one platform's verdict reached from evidence the destination never saw * feat: make the suspension actually stop sending, and emit the audit transitions the PR claimed: emailsend.SendEmail is only the manual and API path, so campaign and warmup sends went nowhere near the gate and a suspended workspace kept sending on its schedule, while the restricted multiplier floored every mailbox at one a day which quietly turned suspension into a trickle rather than a stop; the campaign scheduler now defers the whole campaign with a reason and the warmup task skips as org-suspended, since warmup is outbound mail from the same domains; separately the band change emitted no audit entry at all despite the entity type and the frontend spine entry both existing, so no banner moved for a teammate and there was no trail of who was restricted when, and only a real transition is logged so a detector re-recording the same finding cannot fill the feed; one of my own live tests also asserted how far out a slot lands, which depends on the hour the suite runs, and now asserts the property it was about * chore: drop a test that belongs to the signup-risk change and reached this branch by mistake, where the type it exercises does not exist
34 lines
1.6 KiB
SQL
34 lines
1.6 KiB
SQL
-- Per-organization risk state (issue #141).
|
|
--
|
|
-- Every abuse control was siloed: rate limits per user, warmup health per
|
|
-- mailbox, bans per user. Nothing fused them, so an actor weak on several axes
|
|
-- at once (fresh disposable signup, scraped list, mailboxes landing in junk)
|
|
-- never escalated as one subject. This is that subject.
|
|
--
|
|
-- Deliberately modelled on the warmup participant health machine, which has
|
|
-- worked: a band, a score, a reason, and the evidence behind it.
|
|
ALTER TABLE public.organizations
|
|
ADD COLUMN risk_state text NOT NULL DEFAULT 'trusted',
|
|
ADD COLUMN risk_score integer NOT NULL DEFAULT 0,
|
|
ADD COLUMN risk_reason text,
|
|
-- signals is append-only evidence for admin review, never the source of
|
|
-- the verdict: the state and score are.
|
|
ADD COLUMN risk_signals jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
ADD COLUMN risk_evaluated_at timestamptz;
|
|
|
|
ALTER TABLE public.organizations
|
|
ADD CONSTRAINT organizations_risk_state_check
|
|
CHECK (risk_state IN ('trusted', 'watch', 'restricted', 'suspended'));
|
|
|
|
ALTER TABLE public.organizations
|
|
ADD CONSTRAINT organizations_risk_score_check
|
|
CHECK (risk_score >= 0 AND risk_score <= 100);
|
|
|
|
-- The rebalancer and the admin list both filter by band.
|
|
CREATE INDEX idx_organizations_risk_state
|
|
ON public.organizations USING btree (risk_state)
|
|
WHERE risk_state <> 'trusted';
|
|
|
|
COMMENT ON COLUMN public.organizations.risk_state IS
|
|
'Fused abuse posture: trusted | watch | restricted | suspended. restricted lowers send caps and forces the free warmup pool; suspended stops sending.';
|