you are viewing a single comment's thread
view the rest of the comments
[–] 9 points 1 year ago* (2 children)

For Cloudflare users:
Security Rules:

(http.request.uri.path eq "/api/v3/comment/list" and not http.request.uri.query contains "post_id")

For Caddy users:

  # >>> Specific handler for /api/v3/comment/list with post_id check
  handle_path /api/v3/comment/list {
    # Check if the 'post_id' query parameter is present
    @hasPostId {
      query post_id=*
    }
    # Abort the connection if the parameter is missing
    handle @hasPostId {
      reverse_proxy http://localhost:8536/
    }
    # This handles all requests that did not match @hasPostId
    abort
  }
  • source
  • hideshow 2 child comments
  • [–] 6 points 1 year ago

    I found that the Caddy handler above blocked many third party clients and even Tesseract.

    So instead I'm using this CEL expression to return a 444 error on match of the unscoped old-sorted 50 per-page comments past page 99:

    @block_comment_spam expression <<CEL
        {http.request.uri.path} == "/api/v3/comment/list" &&
        {http.request.uri.query.limit} == "50" &&
        {http.request.uri.query.sort} == "Old" &&
        int({http.request.uri.query.page}) > 99 &&
        {http.request.uri.query.post_id} == ""
    CEL
    
    handle @block_comment_spam {
        respond 444
    }
    
  • source
  • parent
  • load more comments (1 reply)