jorisschellekens / borb

borb is a library for reading, creating and manipulating PDF files in python.
https://borbpdf.com/
Other
3.4k stars 147 forks source link

BUG #186

Closed woidda closed 10 months ago

woidda commented 11 months ago

You should never just return True here. There is most likely some stressed junior dev out there that added a vulnerability into some big pile of corporate software:

 def check_signatures(self) -> bool:
        """
        This method verifies the signatures in the Document,
        it returns True if the signatures match the digest of the Document
        (or if the Document has no signatures), False otherwise
        """
        # TODO
        return True

a raise NotImplementedError would be so much safer.

jorisschellekens commented 11 months ago

I wish :smile: borb is currently a one-man project. So the error is entirely my own I'm afraid. It'll be fixed in the next release.

tpa10 commented 10 months ago

I certainly get that and I mean no disrespect, but until then, could you please update your response at https://stackoverflow.com/questions/74513853/check-if-a-pdf-is-signed-or-not ?

jorisschellekens commented 10 months ago

The question is titled "Check if a PDF is signed or not".

The question body starts with "I would like to write a python script to check if a pdf is signed or not. After quite a bit of looking around, I saw that pyPDF2 helps extract text from pdf files, but I am not sure if it can be used to extract the signature details such as Public Key etc."

borb is perfectly capable of checking whether a PDF is signed by means of the has_signatures method in DocumentInfo.

This bug deals with checking whether those signatures are valid or not.

tpa10 commented 10 months ago

My apologies for the misunderstanding.

jorisschellekens commented 10 months ago

Replaced with raise NotImplementedError() in v2.1.21