Skip to content

πŸ”’ Security: Add Rate Limiting and Request ThrottlingΒ #22

@dannycab

Description

@dannycab

Security Issue

No rate limiting on HTTP requests to target wikis - can overwhelm servers or trigger IP bans.

Current Code

scraper.py:94 - No rate limiting on get_page_raw()

Risk Level

Medium - Can cause:

  • IP bans from target wikis
  • Denial of service (unintentional)
  • Poor netizen behavior

Solution

from ratelimit import limits, sleep_and_retry

class DokuWikiHTTPClient:
    def __init__(self, rate_limit='10/minute'):
        self.rate_limiter = RateLimiter(rate_limit)
    
    @sleep_and_retry
    @limits(calls=10, period=60)
    def get_page_raw(self, page_id: str):
        # existing code

Tasks

  • Add rate limiting to HTTP client
  • Make rate limit configurable
  • Add per-domain rate limiting
  • Add request timeout configuration
  • Log rate limit events

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/highHigh priority - Should be addressed soontype/securitySecurity-related changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions