View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
17168Bug reports_ Unknownpublic2021-08-30 11:53
Reporterkpmg Assigned Top_teichmann  
PrioritynoneSeverityblock 
Status closedResolutionreopened 
Product Version4.4.7 
Summary17168: 500: Internal Server Error Argument 1 must be at least CRYPTO_SIGN_BYTES long
Description

We get CRYPTO_SIGN_BYTES must be argument 1 long on posting answers to questions, and send email requests to users.

Steps To Reproduce

Notify users of a new survey.
Posting answers to survey..

Additional Information

Server has been upgraded to MySQL 8 hosted by Microsoft Azure.
Webserver has been moved to Microsoft Azure App Service.

TagsNo tags attached.
Attached Files
Bug heat8
Complete LimeSurvey version number (& build) 4.4.12 210308
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionMySQL 8.0.15 (Windows)
Server OS (if known) Appservice Debian Buster - Database Win64 hosted
Webserver software & version (if known)Apache/2.4.38 (Debian)
PHP Version 7.4.15

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2021-03-09 12:48

administrator   ~62920

Duplicate of https://bugs.limesurvey.org/view.php?id=16499

ollehar

ollehar

2021-03-09 12:49

administrator   ~62921

Or wait, maybe similar issue but in other context?

ollehar

ollehar

2021-03-09 12:49

administrator   ~62922

For us to be able to investigate this issue please attach a 2 question sample survey demonstrating the issue, either as .lss file (survey structure) or (even better) as .lsa file (survey archive).

Just attach it to this issue and we will have a look.
Thank you!

kpmg

kpmg

2021-03-09 13:25

reporter   ~62923

Yes, I've had a look at that other issue as it seemed relevant, but the solution is not the same.
I've added a isa archive as requested.

I've also tired an earlier container with 4.4.8 and same issue as in 4.4.12. I suspect some setting is wrong for communicating with MySQL 8.0.16. In Limesurvey the MySQL version gets reported wrongly as 5.6.47.0.
We also have some issues with comfortupdate reporting integrity constraint violation 1052 column language in where clause is ambiguous.

ollehar

ollehar

2021-03-09 13:28

administrator   ~62924

For the second issue, can you enable debug = 2 in application/config/config.php and try again, please? Paste the complete error message here.

ollehar

ollehar

2021-03-09 14:04

administrator   ~62928

Cannot reproduce. What I did:

  1. Import the lsa file
  2. Click execute survey
  3. Answer question
  4. Submit

No problem.

Can you give me a list of the PHP extensions that are installed on your system? E.g. "php -m" from the command-line.

ollehar

ollehar

2021-03-09 14:06

administrator   ~62929

In Limesurvey the MySQL version gets reported wrongly as 5.6.47.0.

This is just an interface issue, though.

kpmg

kpmg

2021-03-10 11:35

reporter   ~62988

Ok, thanks for trying. My php modules output
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
memcached
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

kpmg

kpmg

2021-03-10 11:43

reporter   ~62989

I enabled the debug mode, but I noticed that the comfortupdate process changes the config-defaults.php file. Before hitting "finish" I went in to the console and changed the Mysql storage engine back to InnoDB, and set my memory back to 2Gb from the default 256Mb. Now it didn't complain about sql errors. Might be just luck.
Any way for the comfort update not to change these settings upon using comfort update?

I'll retry my survey now and see if the error still persists.

ollehar

ollehar

2021-03-10 12:00

administrator   ~62991

Sodium is the PHP extension that matters for this error. I don't have it installed right now, that's probably why I get another result.

Are you using encryption for any question or participant attribute?

kpmg

kpmg

2021-03-10 12:19

reporter   ~62994

We have tried both options. Same error message.

ollehar

ollehar

2021-03-10 14:26

administrator   ~62996

Are you using encryption for any question or participant attribute?

kpmg

kpmg

2021-03-10 15:33

reporter   ~62997

Yes, I tested that with the one example I sent you.

ollehar

ollehar

2021-03-10 16:09

administrator   ~63008

Cannot reproduce, even with sodium installed as php extension.

Exactly what did you enter as answers to the questions? Does it matter?

I did not test with MySQL 8.

kpmg

kpmg

2021-03-11 09:56

reporter   ~63286

Do you suspect MySQL version beeing an issue?
Should we do a downgrade?

ollehar

ollehar

2021-03-11 11:39

administrator   ~63295

Not sure. Can you enable debug = 2 in application/config/config.php and try again, please? Paste the complete error message here.

kpmg

kpmg

2021-03-11 15:08

reporter   ~63310

SodiumException
Argument 1 must be at least CRYPTO_SIGN_BYTES long.

/var/www/html/limesurvey/application/third_party/sodium_compat/src/Compat.php(2069)

2057 @psalm-suppress MixedArgument
2058
@psalm-suppress MixedInferredReturnType
2059 @psalm-suppress MixedReturnStatement
2060
/
2061 public static function crypto_sign_open($signedMessage, $publicKey)
2062 {
2063 / Type checks: /
2064 ParagonIE_Sodium_Core_Util::declareScalarType($signedMessage, 'string', 1);
2065 ParagonIE_Sodium_Core_Util::declareScalarType($publicKey, 'string', 2);
2066
2067 / Input validation: /
2068 if (ParagonIE_Sodium_Core_Util::strlen($signedMessage) < self::CRYPTO_SIGN_BYTES) {
2069 throw new SodiumException('Argument 1 must be at least CRYPTO_SIGN_BYTES long.');
2070 }
2071 if (ParagonIE_Sodium_Core_Util::strlen($publicKey) !== self::CRYPTO_SIGN_PUBLICKEYBYTES) {
2072 throw new SodiumException('Argument 2 must be CRYPTO_SIGN_PUBLICKEYBYTES long.');
2073 }
2074
2075 if (self::useNewSodiumAPI()) {
2076 /
2077 @psalm-suppress InvalidReturnStatement
2078
@psalm-suppress FalsableReturnStatement
2079 /
2080 return sodium_crypto_sign_open($signedMessage, $publicKey);
2081 }
Stack Trace
#0
– /var/www/html/limesurvey/application/core/LSSodium.php(118): ParagonIE_Sodium_Compat::crypto_sign_open()
113
/
114 public function decrypt($sEncryptedString, $bReturnFalseIfError = false)
115 {
116 if ($this->bLibraryExists === true) {
117 if (!empty($sEncryptedString) && $sEncryptedString != 'null') {
118 $plaintext = ParagonIE_Sodium_Compat::crypto_sign_open(base64_decode($sEncryptedString), $this->sEncryptionPublicKey);
119 if ($plaintext === false) {
120 throw new SodiumException(sprintf(gT("Wrong decryption key! Decryption key has changed since this data were last saved, so data can't be decrypted. Please consult our manual at %s.", 'unescaped'), 'https://manual.limesurvey.org/Data_encryption#Errors'));
121 } else {
122 return $plaintext;
123 }
#1
– /var/www/html/limesurvey/application/models/LSActiveRecord.php(353): LSSodium->decrypt()
348 {
349 // if $value is provided, it would decrypt
350 if (!empty($value)) {
351 // load sodium library
352 $sodium = Yii::app()->sodium;
353 return $sodium->decrypt($value);
354 }
355 }
356
357
358 /

#2
– /var/www/html/limesurvey/application/core/LimeMailer.php(131): LSActiveRecord::decryptSingle()
126 parent::__construct($exceptions);
127 / Global configuration for ALL email of this LimeSurvey instance /
128 $emailmethod = Yii::app()->getConfig('emailmethod');
129 $emailsmtphost = Yii::app()->getConfig("emailsmtphost");
130 $emailsmtpuser = Yii::app()->getConfig("emailsmtpuser");
131 $emailsmtppassword = LSActiveRecord::decryptSingle(Yii::app()->getConfig("emailsmtppassword"));
132 $emailsmtpdebug = Yii::app()->getConfig("emailsmtpdebug");
133 $emailsmtpssl = Yii::app()->getConfig("emailsmtpssl");
134 $defaultlang = Yii::app()->getConfig("defaultlang");
135 $emailcharset = Yii::app()->getConfig("emailcharset");
136

Same as in the PDF posted earlier

p_teichmann

p_teichmann

2021-05-17 14:06

administrator   ~64427

Hello, we have done multiple fixes to the encryption. If this is still an issue for you, please let us know.

galads

galads

2021-08-30 11:53

reporter   ~66168

Hello kpmg,
This should already be fixed in recent versions.
Can you please check if this issue still exists in the latest version of LimeSurvey and let us know?
Thank you!

Issue History

Date Modified Username Field Change
2021-03-09 12:45 kpmg New Issue
2021-03-09 12:45 kpmg File Added: Skjermbilde 2021-03-09 kl. 12.43.59.png
2021-03-09 12:48 ollehar Assigned To => ollehar
2021-03-09 12:48 ollehar Status new => closed
2021-03-09 12:48 ollehar Resolution open => duplicate
2021-03-09 12:48 ollehar Note Added: 62920
2021-03-09 12:49 ollehar Note Added: 62921
2021-03-09 12:49 ollehar Status closed => feedback
2021-03-09 12:49 ollehar Resolution duplicate => reopened
2021-03-09 12:49 ollehar Note Added: 62922
2021-03-09 13:25 kpmg Note Added: 62923
2021-03-09 13:25 kpmg File Added: survey_archive_838884.lsa
2021-03-09 13:25 kpmg File Added: Skjermbilde 2021-03-09 kl. 12.57.54.png
2021-03-09 13:25 kpmg Status feedback => assigned
2021-03-09 13:28 ollehar Note Added: 62924
2021-03-09 14:04 ollehar Note Added: 62928
2021-03-09 14:04 ollehar Status assigned => feedback
2021-03-09 14:06 ollehar Note Added: 62929
2021-03-10 11:35 kpmg Note Added: 62988
2021-03-10 11:35 kpmg Status feedback => assigned
2021-03-10 11:43 kpmg Note Added: 62989
2021-03-10 12:00 ollehar Note Added: 62991
2021-03-10 12:19 kpmg Note Added: 62994
2021-03-10 14:26 ollehar Note Added: 62996
2021-03-10 15:33 kpmg Note Added: 62997
2021-03-10 16:09 ollehar Note Added: 63008
2021-03-10 16:10 ollehar Status assigned => feedback
2021-03-11 09:56 kpmg Note Added: 63286
2021-03-11 09:56 kpmg Status feedback => assigned
2021-03-11 11:39 ollehar Note Added: 63295
2021-03-11 13:12 ollehar Status assigned => feedback
2021-03-11 15:08 kpmg Note Added: 63310
2021-03-11 15:08 kpmg Status feedback => assigned
2021-05-17 14:06 p_teichmann Assigned To ollehar => p_teichmann
2021-05-17 14:06 p_teichmann Status assigned => feedback
2021-05-17 14:06 p_teichmann Note Added: 64427
2021-08-30 11:53 galads Status feedback => closed
2021-08-30 11:53 galads Note Added: 66168
2021-08-30 11:53 galads Bug heat 6 => 8