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

Validate queue_id is a positive integer before passing to the BAO #14355

Merged
merged 1 commit into from
May 29, 2019

Conversation

seamuslee001
Copy link
Contributor

Overview

Just a small hardening ping @eileenmcnaughton @totten

@civibot
Copy link

civibot bot commented May 27, 2019

(Standard links)

@civibot civibot bot added the 5.14 label May 27, 2019
extern/open.php Outdated
@@ -11,6 +12,11 @@
exit();
}

if (!CRM_Utils_Rule::positiveInteger($queue_id)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - or use retrieveValue rather that $_GET directly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeh maybe i dunno however this just felt sensible way of managing it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I prefer to go with a retrieve fn variant is we should be able to grep our code base for instances of $_GET & find very few - so eliminating them makes future audits easier

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have switched it to that now hopefully @eileenmcnaughton

@@ -2,10 +2,12 @@
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
require_once 'CRM/Core/Error.php';
require_once 'CRM/Utils/Array.php';
require_once 'CRM/Utils/Type.php';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 do we need Type & Rule here now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are used by the Request function and given that we aren't actually loading the class loader here we can't be certain they are loaded at this point. I don't think Array is used now for this

extern/open.php Outdated

$config = CRM_Core_Config::singleton();
$queue_id = CRM_Utils_Array::value('q', $_GET);
$queue_id = CRM_Utils_Request::retrieveValue('q', 'positive', NULL, FALSE, 'GET');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 I tested this locally but it needs to be 'Positive' or it fails

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @eileenmcnaughton have updated now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to go now - I note that when you pass a string it drops it & then declares 'missing input parameters' rather than the validation error bubbling up. I don't really have an opinion on that though - at the margins it could cause a debugger to take a fee more minutes debugging

Switch to using retrieveValue as per Eileen
@seamuslee001
Copy link
Contributor Author

Jenkins re test this please

@seamuslee001
Copy link
Contributor Author

Test fail unrelated merging

@seamuslee001 seamuslee001 merged commit 80b41f5 into civicrm:5.14 May 29, 2019
@seamuslee001 seamuslee001 deleted the harden_extern_open branch May 29, 2019 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants