5 Commits

Author SHA1 Message Date
Dogan Can Bakir 0dc2c9fe61 fix(db): persist CPE column in postgres and mysql writers (#2494)
* fix(db): persist CPE in postgres and mysql (#2487)

Adds cpe column to both SQL schemas, idempotent migration for
existing tables, and JSON binding in InsertBatch.

* adding comment note

* fixing lint

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-05-13 21:22:02 +02:00
Mzack9999 579fa0547e using explicit syntax 2026-03-04 12:35:05 +01:00
Doğan Can Bakır 30032e69bd fix: suppress errcheck for deferred stmt.Close 2026-03-03 21:07:09 +03:00
Doğan Can Bakır f2690f50af fix: address CodeRabbitAI review comments for database output
- Fix SQL injection in postgres.go using pq.QuoteIdentifier for table/index names
- Fix SQL injection in mysql.go using custom quoteIdentifier function
- Fix race condition in writer.go by checking closed state before channel send
- Add missing idx_url index in mysql.go for parity with PostgreSQL schema
- Include RawHeaders in omitRaw check for consistency
2026-01-12 12:25:22 +03:00
Doğan Can Bakır 2ea576f175 feat: add database output support for storing scan results
Add support for storing httpx scan results directly to databases with
both CLI flags and YAML config file options.

Supported databases:
- MongoDB
- PostgreSQL
- MySQL

Features:
- Batched writes for performance (configurable batch size)
- Auto-flush with configurable interval
- Individual columns for each Result field (not JSON blob)
- Support for environment variable HTTPX_DB_CONNECTION_STRING
- Option to omit raw request/response data (-rdbor)

New CLI flags under OUTPUT group:
- -rdb, -result-db: enable database storage
- -rdbc, -result-db-config: path to YAML config file
- -rdbt, -result-db-type: database type (mongodb, postgres, mysql)
- -rdbcs, -result-db-conn: connection string
- -rdbn, -result-db-name: database name (default: httpx)
- -rdbtb, -result-db-table: table/collection name (default: results)
- -rdbbs, -result-db-batch-size: batch size (default: 100)
- -rdbor, -result-db-omit-raw: omit raw data

Closes #1973
Closes #2360
Closes #2361
Closes #2362
2026-01-12 12:25:22 +03:00