Dependency Graph
View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
17126 | Bug reports | Encryption | public | 2021-02-24 13:43 | 2021-07-14 13:16 |
Reporter | annighoefer | Assigned To | p_teichmann | ||
Priority | high | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 4.4.7 | ||||
Fixed in Version | 4.5.x | ||||
Summary | 17126: encrypted questions do not work when multiple groups are used | ||||
Description | Encrypted data of encrypted question in database are encrypted again, if participant switch between groups with "previous" and "next" button or submit the survey. After that, data can't be decrypted and isn't readable in the backend under Responses (Screenshot). | ||||
Steps To Reproduce |
| ||||
Additional Information | Every time there is a change between the groups, the function encryptSave () is called with the current response object. But the response object contains encrypted attributes and with encryptSave these are encrypted again. My quick & dirty solution is before the encryptSave function is called, the encrypted attributes are decrypted. (see patch) | ||||
Tags | encryption | ||||
Attached Files | em_manager_helper.patch (1,903 bytes)
diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php index 25391f7d10..938a904b9b 100644 --- a/application/helpers/expressions/em_manager_helper.php +++ b/application/helpers/expressions/em_manager_helper.php @@ -5171,7 +5171,28 @@ class LimeExpressionManager return; } if ($oResponse->submitdate == null || Survey::model()->findByPk($this->sid)->alloweditaftercompletion == 'Y') { + + // -------------- BUG CODE IMPLEMENTATION DECRYPT FIRST ENCRYPTED FIELDS ------- + + // get all encrypted attributes of current survey + $encryptedAttributes = Response::getEncryptedAttributes($this->sid); + + if (count($encryptedAttributes) > 0) { + $decryptedAttributes = array(); + + foreach ($encryptedAttributes as $key => $value) { + if (isset($oResponse->$value) && $oResponse->$value) { + // decrypt all encrypted values of current survey + $decryptedAttributes[$value] = $oResponse->decrypt($oResponse->$value); + } + } + + // set decypted values to response object + $oResponse->setAttributes($decryptedAttributes, false); + } + $oResponse->setAttributes($aResponseAttributes, false); + if (!$oResponse->encryptSave()) { $message = submitfailed('', print_r($oResponse->getErrors(), true)); // $response->getErrors() is array[string[]], then can not join if (($this->debugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY) { | ||||
Bug heat | 6 | ||||
Complete LimeSurvey version number (& build) | Release 4.4.9+210219 da4b348 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | mysql Ver 8.0.23 | ||||
Server OS (if known) | |||||
Webserver software & version (if known) | |||||
PHP Version | PHP 7.4.15 | ||||
related to | 17409 | closed | p_teichmann | Exporting 3000 encrypted results (200 questions) to Excel requires too many ressources, export fails |
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=31559 |
|
Release done. |
|
LimeSurvey: master 052188f1 2021-04-08 09:46:14 Details Diff |
Fixed issue 17126: encrypted question causes error when multiple groups are used or question by question mode is activated |
Affected Issues 17126 |
|
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
mod - application/models/LSActiveRecord.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-02-24 13:43 | annighoefer | New Issue | |
2021-02-24 13:43 | annighoefer | File Added: em_manager_helper.patch | |
2021-02-24 13:43 | annighoefer | File Added: screenshot-1.png | |
2021-02-24 14:49 | ollehar | Tag Attached: encryption | |
2021-02-24 14:49 | ollehar | Assigned To | => p_teichmann |
2021-02-24 14:49 | ollehar | Status | new => assigned |
2021-02-24 14:49 | ollehar | Priority | none => normal |
2021-02-24 14:49 | ollehar | Severity | minor => partial_block |
2021-02-24 14:49 | ollehar | Steps to Reproduce Updated | |
2021-03-29 14:14 | c_schmitz | Priority | normal => high |
2021-03-29 14:14 | c_schmitz | Sync to Zoho Project | => |Yes| |
2021-04-08 12:13 | p_teichmann | Changeset attached | => LimeSurvey master 052188f1 |
2021-04-08 12:13 | p_teichmann | Note Added: 63866 | |
2021-04-08 12:13 | p_teichmann | Resolution | open => fixed |
2021-04-08 19:55 | kjnerhus | Issue Monitored: kjnerhus | |
2021-07-06 09:35 | p_teichmann | Status | assigned => resolved |
2021-07-06 09:35 | p_teichmann | Fixed in Version | => 4.5.x |
2021-07-12 11:53 | c_schmitz | Note Added: 65335 | |
2021-07-12 11:53 | c_schmitz | Status | resolved => closed |
2021-07-14 13:16 | Mazi | Relationship added | related to 17409 |