- 1. Database Schema & Migrations
- Create
consumer_rate_limit_profilestable - Create
consumer_rate_limit_overridestable [x] Add migration + runfix-migrations.sh
- Create
- 2. Database Repository (
src/database/consumer_rate_limit_repository.rs) - 3. Extend Rate Limit Middleware (
src/middleware/rate_limit.rs)- Extract
AuthenticatedKeyconsumer_id/type - Multi-dimension keys (global/endpoint/tx-type/IP)
- Lua scripts: Sliding window + Token Bucket
- Endpoint sensitivity tiers
- Profile + override merging
- Extract
- 4. Admin Rate Limit Endpoints (
src/api/admin/rate_limits.rs)- GET/POST/DELETE
/api/admin/consumers/:id/rate-limits
- GET/POST/DELETE
- 5. Metrics & Logging (
src/middleware/rate_limit_metrics.rs)- Prometheus: checks/hits/utilisation
- Breach logs/alerts
- 6. Update Config (
rate_limits.yaml) - 7. Integration Tests (
tests/advanced_rate_limit_test.rs) - 8. Route Wiring (
src/main.rs,src/routes/) - 9. Verification
-
cargo test -
cargo check - Manual test concurrent requests
-
- 10. Git Branch/PR
-
git checkout -b blackboxai/rate-limiting-175 - Commit changes
-
gh pr create --title "Fix #175: Advanced Per-Consumer Rate Limiting"
-
Current Step: 1/10
Current Status: [In Progress]
Approved Plan: Extend src/pentest/ for type='third_party_audit'
- Update
migrations/20261301000000_pentest_security_framework.sql: Add vendor/type/completion_status/follow_up_scheduled_at/final_report_url to pentest_engagements; triage_notes/disputed/dispute_justification to pentest_findings. -
cargo sqlx prepare& fix checksums if needed (sqlx-cli N/A, handled by existing scripts).
- Edit
src/pentest/models.rs: Add ThirdPartyAuditType enum, extend PentestEngagement/Finding. - Update
models.rsfor new DTOs (CompletionRequest, ExecSummaryResponse).
Next Step: Phase 3 - Repository extensions.
- Edit
src/pentest/repository.rs: Queries for third-party specific (completion check, dispute, matrix, mint prereq). - Add report storage to append-only (assume api).
Next Step: Phase 4 - Service business logic.
- Edit
src/pentest/service.rs: Completion gate (crit/high closed), exec summary filter, schedule follow-ups, SLA triage/dispute. - Extend metrics/alerts for tp_audit gauges.
- Edit
src/pentest/routes.rs/handlers.rs: Add /third-party-audit/* endpoints. - Edit
src/admin/routes.rs: Nest under admin security. - Create
src/pentest/third_party.rsfor handlers.
Full third-party audit framework implemented:
- Extended pentest module for type='third_party_audit'
- All API endpoints /api/admin/security/third-party-audit/*
- Completion gate, SLA triage/dispute, mint prereq
- Exec summary (no PoC), matrix, schedule follow-ups
- Observability (gauges, alerts) leveraging existing
- Tests (lifecycle, gate)
- Docs template
Run: docker-compose up then curl endpoints or use Postman.
Test: cargo test --features integration
Deploy: sqlx migrate run (fix checksums if needed with fix-migrations.sh)
- Edit
src/metrics.rs: New Prometheus gauges (tp_open_crit, completion_gauge). - Add config.toml entries for triage windows.
- Edit
tests/pentest_integration.rs: Add tp_audit lifecycle tests. - Create
tests/third_party_audit_test.rs: Unit/SLA/completion/mint gate.
- Create
docs/third-party-audit.md: Framework template. - Script:
scripts/provision-audit-env.sh.
-
cargo check && cargo test -
sqlx migrate run - Integration test endpoints.
- [Complete] Manual lifecycle test.
Next Step: Phase 1 - Schema update.
Progress will be updated after each completed step.