View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 18375 | Bug reports | Plugins | public | 2022-09-26 18:23 | 2026-11-19 22:22 |
| Reporter | gabrieljenik | Assigned To | gabrieljenik | ||
| Priority | none | Severity | feature | ||
| Status | closed | Resolution | fixed | ||
| Summary | 18375: Security : Some plugin settings need encryption | ||||
| Description | Some plugin settings as API keys could need some encryption when saved. | ||||
| Tags | No tags attached. | ||||
| Bug heat | 8 | ||||
| Complete LimeSurvey version number (& build) | |||||
| I will donate to the project if issue is resolved | |||||
| Browser | |||||
| Database type & version | |||||
| Server OS (if known) | |||||
| Webserver software & version (if known) | |||||
| PHP Version | |||||
| Git branch / Pull Request URL | |||||
|
It must case for password by default ? No ? |
|
|
Issue about handling by defualt for passwords is backward compatibility. |
|
|
Draft PR: https://github.com/LimeSurvey/LimeSurvey/pull/2645 |
|
|
Discussion closed : you don't update $data if decrypt didn't work. Then : you can just set a value as crypted, it was crypted when you save it :). |
|
|
This will not work on survey settings. |
|
|
Survey settings use get and set. You have a micro plugin to test ? |
|
Yes, but that was not intended to it. Not sure I want to rely on that.
I picture this:
Also:
|
|
Remind : get and save can save anything too. There can have issue if a plugin use same system ;) to save value Remind too : plugin can save array of settings etc … |
|
MyPassword is saved with 2 settings ? MyPassword There are potential (but surely rare) plugin using MySettingIsCrypted Maybe : add a column to DB ? |
|
Not sure I follow.
Using which type of control? |
|
MyPasswordIsCrypted --> That's the same setting i was referring to by |
|
By default : dropdown with multiple for example : receive an array of value, save a array of value. But since plugin dev can update settings before saving : it can be a object or a multiple array. Maybe i have one using this for multilingual, must check. |
|
Yes :) |
|
|
Let me work on that a bit... Having this first draft, I believe you can now work on 09056 for completing the whole thing, right? |
|
Multiple here : https://gitlab.com/SondagesPro/managament/responseListAndManage/-/blob/master/responseListAndManage.php#L525 Language (set in plugin code) here : https://gitlab.com/SondagesPro/managament/responseListAndManage/-/blob/master/responseListAndManage.php#L429 |
|
Ok, maybe we need to do some json_encode before encrypting if it is not scalar |
|
|
It's done for DB : https://github.com/LimeSurvey/LimeSurvey/blob/cbffb1482a9c193f4bfc2b239954a54268628503/application/libraries/PluginManager/Storage/DbStorage.php#L112 It's the task of the storage https://github.com/LimeSurvey/LimeSurvey/blob/cbffb1482a9c193f4bfc2b239954a54268628503/application/libraries/PluginManager/Storage/iPluginStorage.php#L16 data @mixed for set |
|
Maybe we can just restrict to scalar ? |
|
|
Yes, maybe better :) |
|
|
More easy ;) and scalar is really needed for resolve bug. If not scalar when save : throw exception if debug is set ? And log as error if not ? |
|
|
We will handle non scalars with json_encode (at last, dbengine does that). |
|
|
Another approach we were thinking, for the future, is
Then we could:
Then DbEngine wouldn't need to decide if what is being saved is a scalar or not. Still, this is something for the future :) |
|
Feels like a middleware kind of issue, where encrypt/decrypt is part of a pipeline. Dunno how to apply that here tho. Unless you let plugins attach middleware classes to the save-load-procedure https://www.php-fig.org/psr/psr-15/ So the PSR middleware takes a request and returns a response class, but there's no reason we can't adapt that to a database situation. :) |
|
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=34137 |
|
|
New tests added: https://github.com/LimeSurvey/LimeSurvey/pull/2891 |
|
|
Plugins in LimeSurvey 7 can list settings in PluginBase::$encryptedSettings to have them stored encrypted (added in PR #2645, with tests in PR #2891). Closing as fixed. |
|
|
LimeSurvey: master fb967c7a 2022-11-24 15:27 Committer: GitHub Details Diff |
New feature 18375: [security] Some plugin settings need encryption (#2645) Co-authored-by: encuestabizdevgit <devgit@encuesta.biz> Co-authored-by: Michael Hernandez <michael.hernandez@bairesdev.com> Co-authored-by: lapiudevgit <devgit@lapiu.biz> |
Affected Issues 18375 |
|
| mod - application/libraries/PluginManager/PluginBase.php | Diff File | ||
| add - tests/data/plugins/SettingsPlugin.php | Diff File | ||
| add - tests/functional/backend/SettingsPluginTest.php | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2022-09-26 18:23 | gabrieljenik | New Issue | |
| 2022-09-26 18:23 | gabrieljenik | Issue generated from: 09056 | |
| 2022-09-26 18:23 | gabrieljenik | Relationship added | related to 09056 |
| 2022-09-26 18:35 | DenisChenu | Note Added: 71955 | |
| 2022-09-26 18:35 | DenisChenu | Bug heat | 0 => 2 |
| 2022-09-26 20:08 | gabrieljenik | Note Added: 71959 | |
| 2022-09-26 20:08 | gabrieljenik | Bug heat | 2 => 4 |
| 2022-10-04 22:44 | gabrieljenik | Note Added: 72092 | |
| 2022-10-04 22:45 | gabrieljenik | Assigned To | => gabrieljenik |
| 2022-10-04 22:45 | gabrieljenik | Status | new => assigned |
| 2022-10-05 14:37 | DenisChenu | Note Added: 72107 | |
| 2022-10-05 14:37 | DenisChenu | Assigned To | gabrieljenik => |
| 2022-10-05 14:37 | DenisChenu | Status | assigned => ready for testing |
| 2022-10-05 14:38 | gabrieljenik | Note Added: 72108 | |
| 2022-10-05 14:39 | DenisChenu | Note Added: 72109 | |
| 2022-10-05 14:42 | gabrieljenik | Note Added: 72110 | |
| 2022-10-05 14:47 | DenisChenu | Note Added: 72111 | |
| 2022-10-05 14:47 | DenisChenu | Assigned To | => DenisChenu |
| 2022-10-05 14:47 | DenisChenu | Status | ready for testing => in code review |
| 2022-10-05 14:50 | DenisChenu | Note Added: 72112 | |
| 2022-10-05 14:50 | gabrieljenik | Note Added: 72113 | |
| 2022-10-05 14:52 | gabrieljenik | Note Added: 72114 | |
| 2022-10-05 14:52 | DenisChenu | Note Added: 72115 | |
| 2022-10-05 14:52 | DenisChenu | Note Added: 72116 | |
| 2022-10-05 14:54 | gabrieljenik | Note Added: 72117 | |
| 2022-10-05 14:55 | DenisChenu | Note Added: 72118 | |
| 2022-10-05 14:58 | gabrieljenik | Note Added: 72119 | |
| 2022-10-05 15:34 | DenisChenu | Note Added: 72120 | |
| 2022-10-05 15:35 | DenisChenu | Note Added: 72121 | |
| 2022-10-05 16:52 | gabrieljenik | Note Added: 72123 | |
| 2022-10-05 17:11 | DenisChenu | Note Added: 72124 | |
| 2022-10-05 21:33 | gabrieljenik | Note Added: 72132 | |
| 2022-10-05 21:33 | gabrieljenik | Note Edited: 72132 | |
| 2022-10-05 21:39 | gabrieljenik | Note Added: 72133 | |
| 2022-10-06 00:17 | ollehar | Note Added: 72134 | |
| 2022-10-06 00:17 | ollehar | Bug heat | 4 => 6 |
| 2022-10-06 00:17 | ollehar | Note Edited: 72134 | |
| 2022-10-06 10:09 | ollehar | Note Edited: 72134 | |
| 2022-10-07 19:40 | DenisChenu | Assigned To | DenisChenu => |
| 2022-10-07 19:40 | DenisChenu | Status | in code review => ready for testing |
| 2022-12-15 13:54 | gabrieljenik | Changeset attached | => LimeSurvey master fb967c7a |
| 2022-12-15 13:54 | gabrieljenik | Note Added: 73127 | |
| 2022-12-15 13:54 | gabrieljenik | Assigned To | => gabrieljenik |
| 2022-12-15 13:54 | gabrieljenik | Resolution | open => fixed |
| 2023-02-06 15:57 | gabrieljenik | Note Added: 73699 | |
| 2026-11-19 22:22 | c_schmitz | Note Added: 87672 | |
| 2026-11-19 22:22 | c_schmitz | Bug heat | 6 => 8 |
| 2026-11-19 22:22 | c_schmitz | Status | ready for testing => closed |