There were few improvements discussed in #23162 (comment)
Sanitize any strings coming from the faucet. Require the captcha to be in a specific image format (this is currently left open), by making the input -:svg. This is a compromise as it would limit flexibility to change image formats in the future. Limit the size/complexity of the SVG, limit dimensions—don't know if ImageMagick has introspection into this before actually rendering the thing, you might need a sifferent SVG parser.
I could also find one recommendation in https://lgtm.com/projects/g/bitcoin/bitcoin/rev/a6d9675d604827892e31a47994af3b64440f66db:
Except block directly handles BaseException. Handling 'BaseException' means that system exits and keyboard interrupts may be mis-handled.
I am not sure what is the best way to handle exceptions in python however improving other things related to captcha and security are important.
Useful skills:
- Python
- Secure Coding
Want to work on this issue?
For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.