Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error signature - TCPDF #889

Closed
Alexis-M51 opened this issue Aug 12, 2022 · 11 comments
Closed

Error signature - TCPDF #889

Alexis-M51 opened this issue Aug 12, 2022 · 11 comments
Labels
bug Something isn't working

Comments

@Alexis-M51
Copy link

Describe the bug
When I try to sign a document, libresign gives me an error saying that I must contact the administrator

To Reproduce

From any file click on the details (three dots at the right)
In the LibreSign tab click on "Request"
Fill the email and click in "Add"
Click on "Submit Request"
A popup ask if we want to configure visible signatures, should be a YES/NO dialog but is a OK/CANCEL dialog
Click "Yes"
I add a signature
I go to the email where the signature request was made
I click on "sign"
I type the password
Is it when validating the password that I get the error that appears

Expected behavior
The goal is to have a validation of the signature

Screenshots
avant signature
apres signature
Inkedpost

Log

Erreur | libresign | array_map(): Argument #2 ($array) must be of type array, bool given

{"reqId":"Q1qtzCJ3MCjWJ8Kn0wD4","level":3,"time":"2022-08-12T08:16:01+00:00","remoteAddr":"ipv6","user":"email","app":"libresign","method":"POST","url":"/index.php/apps/libresign/api/0.1/sign/uuid/ab3fd2b7-b7f5-4eff-91e9-655603b279f7","message":"array_map(): Argument #2 ($array) must be of type array, bool given","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.3.2","data":{"app":"libresign"}}

Environment information (please complete the following information):

  • OS: Ubuntu Server 20.04
  • Browser firefox, edge, chrome
  • LibreSign Version 5.1.4
  • Nextcloud Server Version 24.03
@Alexis-M51 Alexis-M51 added the bug Something isn't working label Aug 12, 2022
@vitormattos
Copy link
Member

Hi Alexis, thanks for always you send an excellent report with all steps to reproduce the scenarios.

We only have a point in code with the message "Internal error. Contact admin." and this occurs when is an unidentified error. LibreSign send the error message to Nextcloud log as you described. I reproduced your scenario and variants of him, but I couldn't reproduce the problem. I searched by function array_map in LibreSign, but we have only a place with this function and the second argument haven't $array. Searching in the entire codebase of Nextcloud I found two places when the second argument is the var $array, I reproduced the scenario, but the two rows isn't trigged.

Could you help a bit more to identify what happening?

Is here the place that send the error to log file and return the error to client:
https://github.com/LibreSign/libresign/blob/main/lib/Controller/SignFileController.php#L237-L238
Could you put the following row before the previous two rows and return here with the backtrace that will be send to Nextcloud log?
$this->logger->error(json_encode($th->getTrace()));
Maybe we can put this row in next version to identify other corner cases.

@Alexis-M51
Copy link
Author

Alexis-M51 commented Aug 13, 2022

I added the line of code as requested, here is what I have in addition in the logs

log

{"reqId":"QFXnYakPDLQkYkmGL9OJ","level":3,"time":"2022-08-13T11:32:52+00:00","remoteAddr":"IPV4","user":"user","app":"libresign","method":"POST","url":"/index.php/apps/libresign/api/0.1/sign/uuid/13177c1b-0f25-4acd-9438-32fbead8a981","message":"[{"file":"\/var\/www\/nextcloud\/apps\/libresign\/vendor\/tecnickcom\/tcpdf\/include\/tcpdf_fonts.php","line":2004,"function":"array_map"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/vendor\/tecnickcom\/tcpdf\/tcpdf.php","line":6394,"function":"UTF8StringToArray","class":"TCPDF_FONTS","type":"::"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Handler\/Pkcs12Handler.php","line":187,"function":"Write","class":"TCPDF","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Service\/SignFileService.php","line":788,"function":"writeFooter","class":"OCA\\Libresign\\Handler\\Pkcs12Handler","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Service\/SignFileService.php","line":672,"function":"getPdfToSign","class":"OCA\\Libresign\\Service\\SignFileService","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Service\/SignFileService.php","line":595,"function":"getFileToSing","class":"OCA\\Libresign\\Service\\SignFileService","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Controller\/SignFileController.php","line":202,"function":"sign","class":"OCA\\Libresign\\Service\\SignFileService","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Controller\/SignFileController.php","line":180,"function":"sign","class":"OCA\\Libresign\\Controller\\SignFileController","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":225,"function":"signUsingUuid","class":"OCA\\Libresign\\Controller\\SignFileController","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/AppFramework\/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/Route\/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"\/var\/www\/nextcloud\/lib\/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"\/var\/www\/nextcloud\/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}]","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.54","version":"24.0.3.2","data":{"app":"libresign"},"id":"62f78bf1aa9d8"}

@Fr0ggys
Copy link

Fr0ggys commented Sep 8, 2022

Hello,
i've got the same issue. I can relate all the stuff posted by Alexis-M51.
Configuration : Ubuntu Server 20.04 - Nextcloud server version 24.0.4 - Libresign version : 5.1.4 Used Browsers : chrome, chromium, firefox
Error while clicking on sign the document : "internal server error - contact your system administrator"
Concerning the logs, same stuff related to browser " ($array) must be of type array, bool given","userAgent".
Thanks for any clue or ideas, config checks, etc.
Have a nice day
Eric

@Alexis-M51
Copy link
Author

Hello, I come back to the bug which is still relevant.
I'm on Nextcloud version 25.0.1 with LibreSign version 6.1.2
I add that the bug occurs even if I enter the wrong password. I don't get a message saying the password is wrong.

@Alexis-M51
Copy link
Author

I redid the last update and I still have the same problem I just have an additional log error

array_map(): Argument #2 ($array) must be of type array, bool given

@unnilennium
Copy link

unnilennium commented Dec 16, 2022

same 422 error on NC 24.0.8
libresign: 5.2.1

{"reqId":"x","level":3,"time":"2022-12-16T06:16:22+00:00","remoteAddr":"192.168.1.9","user":"u","app":"libresign","method":"POST","url":"/apps/libresign/api/0.1/sign/uuid/ID","message":"Error to sign PDF. null","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0","version":"24.0.8.2","data":{"app":"libresign"}}
{"reqId":"x","level":3,"time":"2022-12-16T06:16:22+00:00","remoteAddr":"192.168.1.9","user":"u","app":"libresign","method":"POST","url":"/apps/libresign/api/0.1/sign/uuid/ID","message":"[{\"file\":\"\\/usr\\/share\\/nextcloud\\/apps\\/libresign\\/vendor\\/jsignpdf\\/jsignpdf-php\\/src\\/JSignPDF.php\",\"line\":29,\"function\":\"sign\",\"class\":\"Jeidison\\\\JSignPDF\\\\Sign\\\\JSignService\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/apps\\/libresign\\/lib\\/Handler\\/JSignPdfHandler.php\",\"line\":105,\"function\":\"sign\",\"class\":\"Jeidison\\\\JSignPDF\\\\JSignPDF\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/apps\\/libresign\\/lib\\/Handler\\/JSignPdfHandler.php\",\"line\":77,\"function\":\"signUsingVisibleElements\",\"class\":\"OCA\\\\Libresign\\\\Handler\\\\JSignPdfHandler\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/apps\\/libresign\\/lib\\/Handler\\/Pkcs12Handler.php\",\"line\":120,\"function\":\"sign\",\"class\":\"OCA\\\\Libresign\\\\Handler\\\\JSignPdfHandler\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/apps\\/libresign\\/lib\\/Service\\/SignFileService.php\",\"line\":607,\"function\":\"sign\",\"class\":\"OCA\\\\Libresign\\\\Handler\\\\Pkcs12Handler\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/apps\\/libresign\\/lib\\/Controller\\/SignFileController.php\",\"line\":202,\"function\":\"sign\",\"class\":\"OCA\\\\Libresign\\\\Service\\\\SignFileService\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/apps\\/libresign\\/lib\\/Controller\\/SignFileController.php\",\"line\":180,\"function\":\"sign\",\"class\":\"OCA\\\\Libresign\\\\Controller\\\\SignFileController\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php\",\"line\":225,\"function\":\"signUsingUuid\",\"class\":\"OCA\\\\Libresign\\\\Controller\\\\SignFileController\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php\",\"line\":133,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/lib\\/private\\/AppFramework\\/App.php\",\"line\":172,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/lib\\/private\\/Route\\/Router.php\",\"line\":298,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/lib\\/base.php\",\"line\":1030,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\"},{\"file\":\"\\/usr\\/share\\/nextcloud\\/index.php\",\"line\":36,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\"}]","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0","version":"24.0.8.2","data":{"app":"libresign"}}


a files with .signé is added even if the error occurs, it is a copy of the orirginal file without any signature.

@vitormattos vitormattos changed the title Error signature Error signature - TCPDF Dec 31, 2022
@vitormattos
Copy link
Member

@Alexis-M51 I launched a new release bumping the TCPDF package and I think that could solve this problem.

@Fr0ggys and @unnilennium We dropped the support to version 24 of Nextcloud because we have no one helping the libresign developers with funding to maintain the support to version 24. If you want to use LibreSign with the newest features and changes, upgrade your server to 25, or, if you prefer to use version 24 will be necessary talk with us to identify how much is necessary to funding the project and maintain the support to server with version 24.

@freelock
Copy link

Hi,
I just installed LibreSign on my NextCloud, got it successfully configured, and sent a signing request to myself for a document.

When I followed the link, it asked me to create a pw, and then confirm a pw (I used my NextCloud pw for this -- should it be different?)

And then I got this message - Error creating new password, please contact the administrator.

The logs are showing this:

[libresign] Error: Cannot set non existing property OCA\Libresign\Handler\CfsslHandler->set = array (
0 => 'United States',
).

POST /apps/libresign/api/0.1/account/signature
from x.x.x.x by john at 2023-02-16T18:45:02+00:00

... that is what I entered in cfssl:config, for country...

NextCloud 25.0.3
LibreSign 6.2.6

@sergeng
Copy link

sergeng commented Feb 26, 2023

Exactly same error

@freelock
Copy link

So the "country" setting should be the ISO 2-character country code, not the full country.

To fix this, use the "Regenerate root certificate" button on the Libresign settings page, and set this value correctly. This solved my issue...

Although for some reason this button didn't show up at first. How I actually fixed this was by finding the incorrect setting in the database oc_appconfig table, with appid = 'libresign' and configkey = 'rootCert'. Deleting that value made it so I could regenerate it in the UI.

@vitormattos
Copy link
Member

I made a lot of changes and removed the interaction of TCPDF at this point. I created a new release of LibreSign. Could you test and check if this issue was solved?

I will close this issue as resolved.

I think that this issue is outdated and this already was solved. If you identify a behavior related to this, create a new issue with the steps to reproduce your scenario and put the #889 code to make reference to this issue.

Thanks for all by comments here.

PS: If you like this app, don't hesitate to help us to maintain the development sponsoring by GitHub sponsor https://github.com/sponsors/LibreSign or also contacting us to have Enterprise support: https://libresign.coop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

6 participants