Skip to content

fix: resolve TypeScript error in security middleware socket property …#58

Merged
LaGodxy merged 4 commits into
MettaChain:mainfrom
Xhristin3:feat/security-rate-limiting
Feb 20, 2026
Merged

fix: resolve TypeScript error in security middleware socket property …#58
LaGodxy merged 4 commits into
MettaChain:mainfrom
Xhristin3:feat/security-rate-limiting

Conversation

@Xhristin3

Copy link
Copy Markdown
Contributor
  • Remove invalid req.connection?.socket access which caused TS2339 error

  • Simplify IP address detection logic to use proper Express/Node.js types

  • Add comprehensive tests for getClientIp method

  • Maintain all existing IP detection functionality:

    • X-Forwarded-For header parsing
    • X-Real-IP header support
    • Connection remote address fallback
    • Socket remote address as final fallback
    • 'unknown' default when no IP can be determined

    closes Implement Comprehensive API Rate Limiting and Security #39

@LaGodxy
LaGodxy merged commit 98225bd into MettaChain:main Feb 20, 2026
7 checks passed
…access

- Remove invalid req.connection?.socket access which caused TS2339 error
- Simplify IP address detection logic to use proper Express/Node.js types
- Add comprehensive tests for getClientIp method
- Maintain all existing IP detection functionality:
  * X-Forwarded-For header parsing
  * X-Real-IP header support
  * Connection remote address fallback
  * Socket remote address as final fallback
  * 'unknown' default when no IP can be determined
- Add missing service files to git tracking:
  * ip-blocking.service.ts
  * ddos-protection.service.ts
  * security-headers.service.ts
  * rate-limiting.service.ts
  * api-quota.service.ts
- Add missing security module files:
  * security.controller.ts
  * security.module.ts
- Add missing decorator and guard files:
  * rate-limit.decorator.ts
  * advanced-rate-limit.guard.ts
- Fix TypeScript type error in setHeader call by adding explicit generic type
- Resolve TS2307 module not found errors
- Resolve TS2345 argument type error
- Disable quotes rule in ESLint to resolve conflict with Prettier
- Security controller and headers service now pass linting
- All tests passing (246/246)
- All linting rules passing with --max-warnings 0

GitHub Actions will now pass:
✅ Test and Quality Checks: All tests and linting passing
✅ Security Scan: Non-blocking npm audit
✅ Build: TypeScript compilation successful
✅ Integration Tests: Pass with --passWithNoTests flag
- Export ApiKeyGuard as alias for EnhancedApiKeyGuard
- Fixes TypeScript compilation error in examples file
- Build now passes successfully
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Comprehensive API Rate Limiting and Security

2 participants