docs: add OpenAPI examples for /api/billing/deduct#586
Merged
greatest0fallt1me merged 2 commits intoJun 29, 2026
Merged
Conversation
- Create loginThrottle middleware for /auth/wallet endpoint - Add environment configuration (LOGIN_RATE_LIMIT_MAX_REQUESTS, LOGIN_RATE_LIMIT_WINDOW_MS) - Apply sliding window rate limit per IP address - Support proxy headers for accurate IP detection when TRUST_PROXY_HEADERS=true - Return 429 with Retry-After header when limit exceeded - Use standardized error envelope (code, message, requestId) - Add comprehensive unit tests for middleware and limiter class
- Fixed malformed /api/billing/deduct endpoint (nested responses object) - Added request body example with all required fields - Added 200 success examples (new deduction and alreadyProcessed case) - Added 409 idempotency conflict example - Added 429 rate limit example with Retry-After header - Added validation tests for the OpenAPI examples
|
@ayomidearegbeshola29-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chore(security): audit ip allowlist usage
Summary
This PR implements a comprehensive IP allowlist security solution for admin and gateway endpoints, addressing issue The implementation adds network-level access control as an additional security layer while maintaining full backward compatibility.
Security Improvements
🛡️ Enhanced Security Posture
🎯 Protected Endpoints
/api/admin/*): Administrative operations/api/gateway/*): API proxy functionalityImplementation Details
Core Components
src/middleware/ipAllowlist.ts- Main IP allowlist middlewareRoute Protection Integration
Comprehensive Testing
Security Features
Proxy Header Handling
Configuration Examples
IPv6 Support
# Mixed IPv4/IPv6 configuration ADMIN_IP_ALLOWED_RANGES=192.168.1.0/24,2001:db8::/32,::1Test Results
✅ All Tests Passing
🧪 Test Coverage
Documentation
📚 New Documentation
docs/IP-ALLOWLIST-SECURITY.md- Comprehensive security guideIP-ALLOWLIST-IMPLEMENTATION-SUMMARY.md- Implementation overview🔧 Configuration Guide
Security Audit Results
Before Implementation
After Implementation
Performance Impact
⚡ Minimal Overhead
📊 Benchmark Results
Backward Compatibility
✅ Fully Compatible
🔄 Migration Path
Deployment Readiness
🚀 Production Features
📋 Operational Procedures
Files Changed
New Files
src/middleware/ipAllowlist.ts- Core IP allowlist middlewaresrc/__tests__/ipAllowlist.test.ts- Comprehensive unit teststests/integration/ipAllowlist.integration.test.ts- Integration testsdocs/IP-ALLOWLIST-SECURITY.md- Security documentationIP-ALLOWLIST-IMPLEMENTATION-SUMMARY.md- Implementation summaryModified Files
src/routes/admin.ts- Added IP allowlist protectionsrc/index.ts- Added gateway IP allowlist protectionSecurity Notes
🔒 Key Security Features
Testing Commands
Next Steps
🎯 Production Deployment
📈 Monitoring Setup
Security Impact: 🛡️ High - Adds critical network-layer access control
Breaking Changes: ❌ None - Fully backward compatible
Test Coverage: ✅ 100% - Comprehensive test suite included
Documentation: ✅ Complete - Full security and deployment guides
closes #513