add ssrf-safe website analysis
This commit is contained in:
@@ -170,3 +170,21 @@ CREATE TABLE IF NOT EXISTS domain_candidates (
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE(organization_id,business_id,domain)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_domain_candidates_business ON domain_candidates(organization_id,business_id,rank,id);
|
||||
|
||||
-- Phase 8 passive website analysis history; each scan is retained.
|
||||
CREATE TABLE IF NOT EXISTS website_scans (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
organization_id TEXT NOT NULL REFERENCES organizations(id),
|
||||
business_id INTEGER NOT NULL REFERENCES businesses(id) ON DELETE CASCADE,
|
||||
website_id INTEGER REFERENCES websites(id) ON DELETE SET NULL,
|
||||
input_url TEXT NOT NULL,
|
||||
classification TEXT NOT NULL,
|
||||
result_json TEXT NOT NULL DEFAULT '{}',
|
||||
cache_key TEXT NOT NULL,
|
||||
scanned_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
cache_expires_at TEXT,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_website_scans_org ON website_scans(organization_id,created_at DESC,id DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_website_scans_business ON website_scans(organization_id,business_id,created_at DESC,id DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_website_scans_cache ON website_scans(organization_id,cache_key,cache_expires_at);
|
||||
|
||||
Reference in New Issue
Block a user