• 4 Posts
  • 307 Comments
Joined 3 years ago
cake
Cake day: November 27th, 2023

help-circle







  • Even dealing with a security issue the code is shit. Why are they chaining multiple ors in a if single statements

    |                                        |                                                                                                                        |
    | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
    | `def is_invalid_get_request_uri(uri):` |                                                                                                                        |
    |                                        | `if current_app.debug:`                                                                                                |
    |                                        | `return False`                                                                                                         |
    |                                        | `try:`                                                                                                                 |
    |                                        | `ip = ipaddress.ip_address(furl(uri).host)`                                                                            |
    |                                        | `except:`                                                                                                              |
    |                                        | `ip = None`                                                                                                            |
    |                                        | ``                                                                                                                     |
    |                                        | `if ip:`                                                                                                               |
    |                                        | `return ip.is_private or ip.is_link_local or ip.is_reserved or ip.is_loopback or ip.is_multicast or ip.is_unspecified` |
    |                                        | `return False`                                                                                                         |
    |                                        | ``                                                                                                                     |
    |                                        | ``                                                                                                                     |
    |                                        | `def is_invalid_post_request_uri(uri):`                                                                                |
    |                                        | `return is_inv`                                                                                                        |
    

    https://codeberg.org/rimu/pyfedi/commit/ada8e2ea35ec687000b7e7c2343288d44a219c3a











  • Comment I saw earlier today really drives home this image

    Would you rather vote for someone who leaves things as they are, or someone who actively wants to make things worse and kill minorities?

    Sorry that “leaves things alone” isn’t good enough for you and you’ll throw all the trans kids under the bus, but personally I don’t want Republicans in power so I’ll do what it takes to keep them out of power, even if that means I have to vote for a spineless Democrat