wulf-pulse/migrations/100_phishing_automation_gate.sql

29 lines
1.8 KiB
MySQL
Raw Permalink Normal View History

-- =============================================================================
-- Phishing automation gate table
-- =============================================================================
-- Controls whether the phishing triage pipeline's parse/classify/report-to-ticket
-- stages run automatically for a given Autotask company, or require the existing
-- manual Analyze/Classify/triage-note triggers. Opt-IN model (opposite polarity
-- from company_scope): companies without a row here have all three stages OFF.
--
-- auto_parse — automatically extract/parse .eml evidence on detection
-- auto_classify — automatically run campaign classification after parsing
-- auto_report — automatically post the acknowledge_user note ONLY for
-- USER_AWARENESS verdicts (D-04); never a general "auto-post
-- any note/action" gate. All other verdicts/actions still
-- require manual approval via the existing review UI even
-- when auto_report is enabled for the company.
-- =============================================================================
CREATE TABLE IF NOT EXISTS phishing_automation_gate (
company_id BIGINT PRIMARY KEY REFERENCES companies(id) ON DELETE CASCADE,
auto_parse BOOLEAN NOT NULL DEFAULT false,
auto_classify BOOLEAN NOT NULL DEFAULT false,
auto_report BOOLEAN NOT NULL DEFAULT false,
updated_by TEXT,
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
COMMENT ON TABLE phishing_automation_gate IS
'Opt-in per-company phishing pipeline automation gate. Absent row = all three stages OFF (manual-only). auto_report auto-posts ONLY the acknowledge_user action for USER_AWARENESS verdicts (D-04) -- it never auto-posts any other action.';