Commit Graph

371 Commits

Author SHA1 Message Date
salvacybersec
83894f4dbb Merge branch 'worktree-agent-a853fbe0' 2026-04-06 18:08:35 +03:00
salvacybersec
8d0c2992e6 docs(18-01): complete web dashboard foundation plan
- SUMMARY.md with chi v5 router, auth middleware, overview page
- STATE.md updated with position, decisions, metrics
- ROADMAP.md and REQUIREMENTS.md updated
2026-04-06 18:04:03 +03:00
salvacybersec
268a769efb feat(18-01): implement chi server, auth middleware, overview handler
- Server struct with chi router, embedded template parsing, static file serving
- AuthMiddleware supports Basic and Bearer token with constant-time comparison
- Overview handler renders stats from providers/recon/storage when available
- Nil-safe: works with zero config (shows zeroes, no DB required)
- All 7 tests pass
2026-04-06 18:02:41 +03:00
salvacybersec
3541c82448 test(18-01): add failing tests for web server, auth middleware, overview handler
- Test overview returns 200 with KeyHunter in body
- Test static asset serving for htmx.min.js
- Test auth returns 401 when configured but no credentials
- Test basic auth and bearer token pass through
- Test overview shows stat cards
2026-04-06 18:02:04 +03:00
salvacybersec
dd2c8c5586 feat(18-01): chi v5 dependency, go:embed static assets, HTML layout and overview templates
- Add chi v5.2.5 to go.mod
- Vendor htmx v2.0.4 minified JS in pkg/web/static/
- Create go:embed directives for static/ and templates/
- Create layout.html with nav bar and Tailwind CDN
- Create overview.html with stat cards and findings table
2026-04-06 18:01:37 +03:00
salvacybersec
e2f87a62ef docs(18): create web dashboard phase plan 2026-04-06 17:58:13 +03:00
salvacybersec
cd93703620 docs(18): web dashboard context 2026-04-06 17:51:41 +03:00
salvacybersec
17c17944aa docs(phase-17): complete Telegram bot + scheduler 2026-04-06 17:50:49 +03:00
salvacybersec
0319d288db feat(phase-17): Telegram bot + scheduler + serve/schedule CLI commands
pkg/bot: Bot struct with telego long-polling, command handlers (/scan, /verify,
/recon, /status, /stats, /providers, /help, /key), /subscribe + /unsubscribe,
notification dispatcher.

pkg/scheduler: gocron v2 wrapper with SQLite-backed job persistence,
Start/Stop/AddJob/RemoveJob lifecycle.

cmd/serve.go: keyhunter serve [--telegram] [--port=8080]
cmd/schedule.go: keyhunter schedule add/list/remove
2026-04-06 17:50:43 +03:00
salvacybersec
8dd051feb0 merge: phase 17 wave 3 CLI wiring 2026-04-06 17:48:25 +03:00
salvacybersec
7020c57905 docs(17-05): complete serve & schedule CLI commands plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:48:06 +03:00
salvacybersec
292ec247fe feat(17-05): implement serve and schedule commands replacing stubs
- cmd/serve.go: starts scheduler, optionally starts Telegram bot with --telegram flag
- cmd/schedule.go: add/list/remove/run subcommands for scheduled scan job CRUD
- pkg/scheduler/: gocron v2 based scheduler with DB-backed jobs and scan execution
- pkg/storage/scheduled_jobs.go: scheduled_jobs table CRUD with tests
- Remove serve and schedule stubs from cmd/stubs.go

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:46:24 +03:00
salvacybersec
41a9ba2a19 fix(phase-17): align bot handler signatures and resolve merge conflicts 2026-04-06 17:39:36 +03:00
salvacybersec
387d2b5985 fix: resolve go.mod merge conflict 2026-04-06 17:37:09 +03:00
salvacybersec
230dcdc98a merge: phase 17 wave 2 2026-04-06 17:36:54 +03:00
salvacybersec
52988a7059 merge: phase 17 wave 2 2026-04-06 17:36:53 +03:00
salvacybersec
f49bf57942 docs(17-03): complete bot command handlers plan
- SUMMARY.md with implementation details and self-check passed
- STATE.md updated with progress, metrics, decisions
- Requirements TELE-01, TELE-02, TELE-03, TELE-04, TELE-06 marked complete
2026-04-06 17:36:39 +03:00
salvacybersec
202473a799 test(17-03): add unit tests for bot command handlers
- Test extractArg parsing for all command formats
- Test isPrivateChat detection (private vs group vs supergroup)
- Test commandHelp contains all 8 commands with descriptions
- Test storageToEngine conversion fidelity
- Test New constructor wires startedAt correctly
2026-04-06 17:35:23 +03:00
salvacybersec
9ad58534fc feat(17-03): implement Telegram bot command handlers
- Add telego v1.8.0 dependency for Telegram Bot API
- Create pkg/bot package with Bot struct holding engine, verifier, recon, storage, registry deps
- Implement 8 command handlers: /help, /scan, /verify, /recon, /status, /stats, /providers, /key
- /key enforced private-chat-only for security (never exposes unmasked keys in groups)
- All other commands use masked keys only
- Handler registration via telego's BotHandler with CommandEqual predicates
2026-04-06 17:34:44 +03:00
salvacybersec
a7daed3b85 docs(17-04): complete subscribe/unsubscribe + notification dispatcher plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:34:28 +03:00
salvacybersec
2643927821 feat(17-04): implement notification dispatcher with tests
- NotifyNewFindings sends to all subscribers on scan completion with findings
- NotifyFinding sends real-time individual finding notifications (always masked)
- formatNotification/formatErrorNotification/formatFindingNotification helpers
- Zero findings = no notification; errors get separate error format
- Per-subscriber error handling: log and continue on individual send failures
- 6 tests pass: subscribe DB round-trip, no-subscriber no-op, zero-finding skip,
  message format validation, error format, masked key enforcement

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:33:32 +03:00
salvacybersec
f7162aa34a test(17-04): add failing tests for notification dispatcher
- TestSubscribeUnsubscribe: DB round-trip for add/remove subscriber
- TestNotifyNewFindings_NoSubscribers: zero messages with empty table
- TestNotifyNewFindings_ZeroFindings: no notification for 0 findings
- TestFormatNotification: message contains job name, count, duration
- TestFormatFindingNotification: masked key, never full key

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:32:58 +03:00
salvacybersec
d671695f65 feat(17-04): implement /subscribe and /unsubscribe handlers
- handleSubscribe checks IsSubscribed, calls AddSubscriber with chat ID and username
- handleUnsubscribe calls RemoveSubscriber, reports rows affected
- Both use storage layer from Plan 17-02
- Removed stub implementations from bot.go

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:32:18 +03:00
salvacybersec
77e8956bce fix(17-04): resolve go.sum merge conflict
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:31:22 +03:00
salvacybersec
80e09c12f6 fix: resolve go.mod merge conflict 2026-04-06 17:29:41 +03:00
salvacybersec
6e0024daba merge: phase 17 wave 1 2026-04-06 17:29:18 +03:00
salvacybersec
cc7c2351b8 Merge branch 'worktree-agent-a4699f95' 2026-04-06 17:29:18 +03:00
salvacybersec
8b992d0b63 docs(17-01): complete Telegram Bot package foundation plan
- Summary: telego bot skeleton with auth, rate limiting, 10 command stubs
- Updated STATE.md, ROADMAP.md, REQUIREMENTS.md
2026-04-06 17:29:05 +03:00
salvacybersec
d8a610758b docs(17-02): complete scheduler + storage plan
- Add 17-02-SUMMARY.md with execution results
- Update STATE.md position and metrics
- Mark SCHED-01 complete in REQUIREMENTS.md
2026-04-06 17:28:30 +03:00
salvacybersec
2d51d31b8a test(17-01): add unit tests for Bot creation and auth filtering
- TestNew_EmptyToken: verify empty token returns error from telego
- TestIsAllowed_EmptyList: verify open access when no restrictions set
- TestIsAllowed_RestrictedList: verify allowlist filtering
- TestCheckRateLimit: verify cooldown enforcement and per-user isolation
2026-04-06 17:28:05 +03:00
salvacybersec
0d00215a26 feat(17-01): add telego dependency and create Bot package skeleton
- Add telego v1.8.0 as direct dependency for Telegram bot
- Create pkg/bot/bot.go with Bot struct, Config, New, Start, Stop
- Implement isAllowed chat authorization and per-user rate limiting
- Add command dispatch with handler stubs for all 10 commands
- Long polling lifecycle with context cancellation for graceful shutdown
2026-04-06 17:27:41 +03:00
salvacybersec
c71faa97f5 feat(17-02): implement scheduler package with gocron wrapper and job lifecycle
- Scheduler wraps gocron with Start/Stop lifecycle
- Start loads enabled jobs from DB and registers cron schedules
- AddJob/RemoveJob persist to DB and sync with gocron
- RunJob for manual trigger with OnComplete callback
- JobResult struct for notification bridge
- Promote gocron/v2 v2.19.1 to direct dependency
2026-04-06 17:27:00 +03:00
salvacybersec
89cc133982 test(17-02): add failing tests for scheduler package
- Storage round-trip test for SaveScheduledJob/ListScheduledJobs
- Subscriber round-trip test for Add/Remove/List/IsSubscribed
- Scheduler Start loads enabled jobs from DB
- Scheduler AddJob/RemoveJob persists and registers
- Scheduler RunJob manual trigger with callback
2026-04-06 17:26:20 +03:00
salvacybersec
c8f7592b73 feat(17-02): add gocron dependency, subscribers and scheduled_jobs tables with CRUD
- Add gocron/v2 v2.19.1 as direct dependency
- Append subscribers and scheduled_jobs CREATE TABLE to schema.sql
- Implement full subscriber CRUD (Add/Remove/List/IsSubscribed)
- Implement full scheduled job CRUD (Save/List/Get/Delete/UpdateLastRun/SetEnabled)
2026-04-06 17:25:43 +03:00
salvacybersec
a38e535488 docs(17): create phase plan — Telegram bot + scheduled scanning 2026-04-06 17:24:14 +03:00
salvacybersec
e6ed545880 docs(17): telegram bot + scheduler context 2026-04-06 17:18:58 +03:00
salvacybersec
0e87618e32 docs(phase-16): complete threat intel, mobile, DNS, API marketplaces 2026-04-06 16:48:35 +03:00
salvacybersec
6eb5b69845 feat(phase-16): wire all 9 Phase 16 sources + VT/IX/ST API keys 2026-04-06 16:48:35 +03:00
salvacybersec
6bcb011cda merge: phase 16 resolve conflicts 2026-04-06 16:47:10 +03:00
salvacybersec
a8bcb44912 merge: phase 16 resolve conflicts 2026-04-06 16:47:10 +03:00
salvacybersec
94238eb72b Merge branch 'worktree-agent-aa3f0a8f' 2026-04-06 16:47:10 +03:00
salvacybersec
6064902aa5 docs(16-02): complete APKMirror, crt.sh, SecurityTrails plan
- SUMMARY.md with implementation details and verification results
- STATE.md updated with progress and decisions
- REQUIREMENTS.md marks RECON-MOBILE-01, RECON-DNS-01, RECON-DNS-02 complete
2026-04-06 16:46:56 +03:00
salvacybersec
68277768c5 docs(16-01): complete threat intelligence sources plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 16:46:17 +03:00
salvacybersec
a195ef33a0 feat(16-02): add SecurityTrails source and wire all three Phase 16-02 sources
- SecurityTrailsSource enumerates subdomains via API, probes config endpoints
- Credential-gated via SECURITYTRAILS_API_KEY env var
- RegisterAll extended to 70 sources (67 Phase 10-15 + 3 Phase 16)
- cmd/recon.go wires SecurityTrails API key from env/viper
2026-04-06 16:46:09 +03:00
salvacybersec
3192cea9e3 docs(16-03): complete Postman, SwaggerHub, RapidAPI plan
- SUMMARY with 2 tasks, 6 files, all tests passing
- STATE.md updated with progress and decisions
- REQUIREMENTS.md: RECON-API-01, RECON-API-02 marked complete
2026-04-06 16:45:50 +03:00
salvacybersec
35fa4ad174 feat(16-01): add URLhaus recon source
- URLhausSource searches abuse.ch URLhaus API for malicious URLs with API keys
- Credentialless source (Enabled always true, no API key needed)
- Tag lookup with payload endpoint fallback
- ciLogKeyPattern used for content matching
- Tests with httptest mocks for happy path and empty results

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 16:45:23 +03:00
salvacybersec
297ad3dc2b feat(16-03): add RapidAPI recon source
- RapidAPISource searches public API listings for leaked keys
- Scrapes HTML search pages with ciLogKeyPattern matching
- Credentialless, httptest-based tests
2026-04-06 16:44:57 +03:00
salvacybersec
edde02f3a2 feat(16-03): add Postman and SwaggerHub recon sources
- PostmanSource searches public collections via internal search proxy
- SwaggerHubSource searches published API specs for embedded keys
- Both credentialless, use BuildQueries + ciLogKeyPattern
- httptest-based tests for both sources
2026-04-06 16:44:47 +03:00
salvacybersec
e02bad69ba feat(16-01): add VirusTotal and IntelligenceX recon sources
- VirusTotalSource searches VT Intelligence API for files containing API keys
- IntelligenceXSource searches IX archive with 3-step flow (search/results/read)
- Both credential-gated (Enabled returns false without API key)
- ciLogKeyPattern used for content matching
- Tests with httptest mocks for happy path and empty results

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 16:44:41 +03:00
salvacybersec
09a8d4cb70 feat(16-02): add APKMirror and crt.sh ReconSource modules
- APKMirrorSource searches APK metadata pages for key patterns
- CrtShSource discovers subdomains via CT logs and probes config endpoints
- Both credentialless, emit findings on ciLogKeyPattern match
2026-04-06 16:44:37 +03:00