sync: malware page, security alerts, review diagnostics, skill detail improvements

- Add malware security advisory page and SecurityAlertBanner component
- Add review diagnostics API and reviewed stats page
- Improve skill detail page with better scoring display and metadata
- Update review API endpoints with enhanced filtering and stats
- Add skill file serving improvements and cache enhancements
- Remove legacy curation scripts (moved to internal tooling)
- Update CLI search with score filtering support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-31 16:08:12 +02:00
parent 3e22d2e238
commit 16ee9e3beb
33 changed files with 1231 additions and 3404 deletions

View File

@@ -493,15 +493,23 @@ ALTER TABLE skills ADD COLUMN IF NOT EXISTS is_deprecated BOOLEAN DEFAULT FALSE;
-- Safe pre-filter function for raw_content (handles invalid UTF-8 gracefully)
-- Used by review pipeline queries (getPending, countPending, countReReviews)
-- NOTE: EXCEPTION handler returns TRUE (benefit of the doubt) — CJK skills with
-- encoding edge cases should not be silently excluded from the review pipeline.
-- Genuine content issues will be caught during the actual review.
CREATE OR REPLACE FUNCTION raw_content_passes_prefilter(content TEXT) RETURNS BOOLEAN AS $$
BEGIN
-- Length check (octet_length works on bytes, safe for any encoding)
IF octet_length(content) < 200 THEN RETURN FALSE; END IF;
IF position('<!-- generated' in content) > 0 THEN RETURN FALSE; END IF;
IF position('/Users/' in LEFT(content, 1000)) > 0 THEN RETURN FALSE; END IF;
IF position('C:\Users\' in LEFT(content, 1000)) > 0 THEN RETURN FALSE; END IF;
-- Content checks (may fail on encoding edge cases)
BEGIN
IF position('<!-- generated' in content) > 0 THEN RETURN FALSE; END IF;
IF position('/Users/' in LEFT(content, 1000)) > 0 THEN RETURN FALSE; END IF;
IF position('C:\Users\' in LEFT(content, 1000)) > 0 THEN RETURN FALSE; END IF;
EXCEPTION WHEN OTHERS THEN
-- Encoding error in string checks — content is long enough, let it through
RETURN TRUE;
END;
RETURN TRUE;
EXCEPTION WHEN OTHERS THEN
RETURN FALSE;
END;
$$ LANGUAGE plpgsql IMMUTABLE;
@@ -573,6 +581,10 @@ ALTER TABLE skills ADD COLUMN IF NOT EXISTS latest_ai_score INTEGER;
ALTER TABLE skills ADD COLUMN IF NOT EXISTS latest_review_date TIMESTAMPTZ;
CREATE INDEX IF NOT EXISTS idx_skills_ai_score ON skills(latest_ai_score) WHERE latest_ai_score IS NOT NULL;
-- Malicious skill detection (March 2026)
ALTER TABLE skills ADD COLUMN IF NOT EXISTS is_malicious BOOLEAN DEFAULT FALSE;
ALTER TABLE skill_reviews ADD COLUMN IF NOT EXISTS recommendation TEXT;
-- Grant permissions
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO postgres;