feat(ingest-api): ingestion hardening — fingerprints, per-key rate limits (BIT-735)
- Migration: er_ingest_keys.rate_limit_max and rate_limit_window_ms (nullable overrides). - Fingerprint policy v2: server-side digest includes normalized stacktrace (UUID/hex/line noise). - In-memory fixed-window limits: per API key after auth; per-IP for unauthenticated POSTs (INGEST_ANON_IP_*). Removed @fastify/rate-limit dependency. - OpenAPI documents 429; runbook at docs/operations/ingest-hardening-runbook.md. Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376 Paperclip-Issue: BIT-735 Paperclip-Run: 0a91be22-6f8f-4c60-b889-44b99048d3a2 Made-with: Cursor
This commit is contained in:
1 parent
c6e4305c79
commit
f5f62571fd
17 files changed
+353
-36
No files matched your search
@@ -0,0 +1,7 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE er_ingest_keys
|
||||
DROP COLUMN rate_limit_window_ms,
|
||||
DROP COLUMN rate_limit_max;
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,17 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE er_ingest_keys
|
||||
ADD COLUMN rate_limit_max INT NULL
|
||||
COMMENT 'Max ingest requests per window for this key; NULL inherits INGEST_RATE_LIMIT_MAX'
|
||||
AFTER revoked_at,
|
||||
ADD COLUMN rate_limit_window_ms INT NULL
|
||||
COMMENT 'Rate limit window in ms; NULL inherits INGEST_RATE_LIMIT_WINDOW_MS'
|
||||
AFTER rate_limit_max;
|
||||
|
||||
ALTER TABLE er_ingest_keys
|
||||
ADD CONSTRAINT er_ingest_keys_rate_limit_max_chk
|
||||
CHECK (rate_limit_max IS NULL OR rate_limit_max > 0),
|
||||
ADD CONSTRAINT er_ingest_keys_rate_limit_window_ms_chk
|
||||
CHECK (rate_limit_window_ms IS NULL OR rate_limit_window_ms > 0);
|
||||
|
||||
COMMIT;
|
||||
Reference in new issue
Block a user