feat(08-01): add custom_dorks table and CRUD for user-authored dorks
- schema.sql: CREATE TABLE IF NOT EXISTS custom_dorks with unique dork_id, source/category indexes, and tags stored as JSON TEXT - custom_dorks.go: Save/List/Get/GetByDorkID/Delete with JSON tag round-trip - Tests: round-trip, newest-first ordering, not-found, unique constraint, delete no-op, schema migration idempotency
This commit is contained in:
@@ -37,3 +37,21 @@ CREATE TABLE IF NOT EXISTS settings (
|
||||
CREATE INDEX IF NOT EXISTS idx_findings_scan_id ON findings(scan_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_findings_provider ON findings(provider_name);
|
||||
CREATE INDEX IF NOT EXISTS idx_findings_created ON findings(created_at DESC);
|
||||
|
||||
-- Phase 8: user-authored dork definitions complementing the embedded
|
||||
-- YAML-based dork registry (pkg/dorks/definitions). Embedded dorks are
|
||||
-- read-only; custom_dorks stores rows created via `keyhunter dorks add`.
|
||||
CREATE TABLE IF NOT EXISTS custom_dorks (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
dork_id TEXT NOT NULL UNIQUE,
|
||||
name TEXT NOT NULL,
|
||||
source TEXT NOT NULL,
|
||||
category TEXT NOT NULL,
|
||||
query TEXT NOT NULL,
|
||||
description TEXT,
|
||||
tags TEXT, -- JSON array
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_custom_dorks_source ON custom_dorks(source);
|
||||
CREATE INDEX IF NOT EXISTS idx_custom_dorks_category ON custom_dorks(category);
|
||||
|
||||
Reference in New Issue
Block a user