View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
14039Bug reportsSurvey takingpublic2021-07-12 11:53
Reporterjelo Assigned Togabrieljenik  
PriorityhighSeverityblock 
Status closedResolutionfixed 
Product Version3.19.2 
Summary14039: Captcha prevent panel integration. GET URL parameter not captured.
Description

When Captchas are activated GET URL parameter are not captured by LimeSurvey.

TagsNo tags attached.
Bug heat14
Complete LimeSurvey version number (& build)3.14.8+180829
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL
Server OS (if known)CentOS 7
Webserver software & version (if known)Apache 2.4.X
PHP Version 7.2.9

Users monitoring this issue

hkjoscsc

Activities

LouisGac

LouisGac

2018-09-10 11:51

developer   ~48997

is it in relation with this forum post? https://www.limesurvey.org/forum/installation-a-update-issues/116365-passthru-version-3-0#173625

hkjoscsc

hkjoscsc

2019-03-07 09:53

reporter   ~50821

Last edited: 2021-06-02 14:41

I also hit this problem, anyone knows that the issue is being investigated?

thomasleeca

thomasleeca

2021-02-24 03:15

reporter   ~62475

Last edited: 2021-06-02 14:41

I have the same problem. The get parameter lost if I enable "Use CAPTCHA for survey access"
LS Version 3.25.15+210223

ollehar

ollehar

2021-03-05 14:52

administrator   ~62764

Last edited: 2021-06-02 14:41

Can we please get an lss file and a detailed step-by-step description on how to reproduce? Developers read and test multiple bug reports per day, and guessing what should be done takes a lot of time. Thank you.

thomasleeca

thomasleeca

2021-03-05 16:29

reporter   ~62785

Last edited: 2021-06-02 14:41

Hi Ollehar,
See attached lss file.

Bug shown on Step 2 and Step 2a.
No bug on Step 1 and Step 1a.

Step 1. Under Publication & Access: Use CAPTCHA for survey access OFF
Step 1a. append "&uid=panelIDebug14039" when testing the survey

example if the survey number is 175717
https://somevalidpath/index.php/175717?newtest=Y&lang=en&uid=panelIDebug14039
text "panelIDebug14039" will be success captured on question Q1 [so as on the response datafile]

Step 2. Under Publication & Access: Use CAPTCHA for survey access ON
Step 2a append "&uid=panelIDebug14039" when testing the survey

Expect text "panelIDebug14039" capture at question Q1
text "panelIDebug14039" failed to captured on question Q1 [blank of response datafile]

gabrieljenik

gabrieljenik

2021-05-21 15:09

manager   ~64510

Last edited: 2021-06-02 14:41

What do you think?

Problem Diagnosis

The function that catches URL parameters is not called when showing token form or captcha.
As url parameters are not forwarded to the next screens, they get lost.

Technically Speaking

Prefill values are read from the URL parameters on prefillFromCommandLine(), which is called from buildsurveysession(). But buildsurveysession() is not called when the captcha page needs to be displayed.
So, when prefillFromCommandLine() runs (on captcha form submit), the prefill parameter are not in the URL anymore.

Solution Alternative A

Add URL parameters to the captcha form, so they are included in the next request:

  • On renderRenderWayForm(), retrieve the additional URL parameters (except reserved ones) and add them to the survey url (which is used as the form's action).

  • Modify prefillFromCommandLine() to also work on POST requests (it only processes GET requests, and the captcha form uses the POST method)

Solution Alternative B

If the captcha form needs to be displayed, store the additional URL parameter in the session:

  • On renderRenderWayForm(), retrieve the additional URL parameters (except reserved ones) and put them on $SESSION['survey'.$surveyid]['queryParams'].

  • On prefillFromCommandLine(), if the session has the 'queryParams' key, use them. Basically changing this:

if (Yii::app()->getRequest()->getRequestType()=='GET') {
    $getValues = array_diff_key($_GET,array_combine($reservedGetValues, $reservedGetValues));
    if(!empty($getValues)) {
        ...
    }
}

into this:

$params = [];
if (!empty($_SESSION['survey_'.$surveyid]['queryParams'])) {
    $params = $_SESSION['survey_'.$surveyid]['queryParams'];
    unset($_SESSION['survey_'.$surveyid]['queryParams']);
}
if (Yii::app()->getRequest()->getRequestType()=='GET') {
    $params = array_merge($params, $_GET);
}

if (!empty($params)) {
        $getValues = array_diff_key($params,array_combine($reservedGetValues, $reservedGetValues));
        if(!empty($getValues)) {
            ...
        }
    }

Option B caveats: If the captcha form is displayed and, instead of submitting the form, the user goes to a different page, the "saved" query parameters will remain in the session.

Solution Alternative C

Same as A but, parameters wouldn't forwarded in the URL but in hidden. We would need to create a specific twig extension that creates hidden inputs for query string parameters.

Downside: Custom themes would need amendment.

c_schmitz

c_schmitz

2021-05-21 16:15

administrator   ~64511

Last edited: 2021-06-02 14:41

Solution A sounds to be the most reasonable to me.

gabrieljenik

gabrieljenik

2021-05-26 18:30

manager   ~64574

Last edited: 2021-06-02 14:41

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1896

ollehar

ollehar

2021-05-27 16:06

administrator   ~64597

Last edited: 2021-06-02 14:41

@jelo Time to test this PR?

gabrieljenik

gabrieljenik

2021-06-04 13:56

manager   ~64740

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=31951

gabrieljenik

gabrieljenik

2021-06-04 13:58

manager   ~64741

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=31952

c_schmitz

c_schmitz

2021-07-12 11:53

administrator   ~65285

Release done.

Related Changesets

LimeSurvey: 3.x-LTS 395f9f83

2021-06-04 13:56:37

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 14039: Captcha prevent panel integration. GET URL parameter not captured (#1896)

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
14039
mod - application/core/LSHttpRequest.php Diff File
mod - application/helpers/frontend_helper.php Diff File

LimeSurvey: master fca9950f

2021-06-04 13:56:37

gabrieljenik


Committer: ollehar Details Diff
Fixed issue 14039: Captcha prevent panel integration. GET URL parameter not captured (#1896)

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
14039
mod - application/core/LSHttpRequest.php Diff File
mod - application/helpers/frontend_helper.php Diff File

Issue History

Date Modified Username Field Change
2018-09-08 00:58 jelo New Issue
2018-09-10 11:05 LouisGac Assigned To => LouisGac
2018-09-10 11:05 LouisGac Status new => feedback
2018-09-10 11:51 LouisGac Note Added: 48997
2019-03-07 09:46 hkjoscsc Issue Monitored: hkjoscsc
2019-03-07 09:53 hkjoscsc Note Added: 50821
2021-02-08 16:51 ollehar Product Version => 3.19.2
2021-02-24 03:15 thomasleeca Note Added: 62475
2021-03-01 15:53 c_schmitz Assigned To LouisGac =>
2021-03-01 15:53 c_schmitz Status feedback => acknowledged
2021-03-01 21:36 ollehar Priority none => high
2021-03-01 21:36 ollehar Severity crash => block
2021-03-05 14:52 ollehar Assigned To => ollehar
2021-03-05 14:52 ollehar Status acknowledged => feedback
2021-03-05 14:52 ollehar Note Added: 62764
2021-03-05 16:29 thomasleeca Note Added: 62785
2021-03-05 16:29 thomasleeca File Added: limesurvey_survey_175717.lss
2021-03-05 16:46 ollehar Status feedback => assigned
2021-05-21 15:09 gabrieljenik Note Added: 64510
2021-05-21 16:15 c_schmitz Note Added: 64511
2021-05-26 18:30 gabrieljenik Note Added: 64574
2021-05-27 16:06 ollehar Status assigned => ready for testing
2021-05-27 16:06 ollehar Note Added: 64597
2021-06-02 14:41 ollehar Sync to Zoho Project => |Yes|
2021-06-04 13:56 gabrieljenik Changeset attached => LimeSurvey 3.x-LTS 395f9f83
2021-06-04 13:56 gabrieljenik Note Added: 64740
2021-06-04 13:56 gabrieljenik Assigned To ollehar => gabrieljenik
2021-06-04 13:56 gabrieljenik Resolution open => fixed
2021-06-04 13:58 ollehar Changeset attached => LimeSurvey master fca9950f
2021-06-04 13:58 gabrieljenik Note Added: 64741
2021-06-05 11:19 ollehar Status ready for testing => resolved
2021-07-12 11:53 c_schmitz Note Added: 65285
2021-07-12 11:53 c_schmitz Status resolved => closed
2021-08-02 20:30 guest Bug heat 12 => 14