-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
CRM-20166: Making CVV always required for front-end pages. #11205
Conversation
Is there a legitimate use-case for allowing the front-end forms to not validate cvv2? Seems dangerous. Folks might disable it thinking that it's more convenient, not realizing how interesting this will become for people testing stolen card numbers. (I agree with the fix, and realize that not having a setting might cause regressions.. but we could also consider it a security issue). |
@mlufty - agreed - giving admins the option to |
@mlutfy @KarinG - thanks for your comments. The situation currently in CiviCRM is that there is one setting: "CVV required for backoffice" which determines if CVV is required on:
This does not make sense and is counter-intuitive. Why impact on front-end at all? It's not even what the field label states! This PR separates the functionality so that:
There are very legitimate situations where backoffice processing requires CVV to be DISABLED. But you want the frontend CVV to still be ENABLED. This PR provides the flexibility to determine when CVV should be required. |
If CiviCRM currently disables CVV on front end contribution forms when people check a box that says disable CVV on backoffice forms, then that’s a bug - and should be fixed urgently. CVV on front end should -always- be enabled as non-CVV public contribution pages are all but certainly going to be subjected to card tumbling and the org is going to risk having their merchant account closed; |
@mlutfy Personally, I don't object to that idea - frontend CVV being ALWAYS enabled. Would people in the CiviCRM community would object to that change? Possibly, because it is a change to the existing behaviour. This is why we are suggesting making it a separate setting for frontend, so CiviCRM sites using the current CVV frontend disabled approach can still do so - for whatever reasons they have. |
@KarinG that's the current situation. As described in the PR overview and linked JIRA issue. |
Exactly - that’s the bug; let’s fix the bug & fix the security issue |
@KarinG We will revise this PR and re-submit to remove the setting for front-end. Making it always required. Since this is also the behaviour in CiviCRM 4.6 now, we will do a related PR for that too. |
@jitendrapurohit can you take a look at this PR thx |
Agree with KarinG. |
4464592
to
6393279
Compare
We've updated the PR to make CVV always required for front end pages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested these changes by disabling the setting on backend form and found a minor issue. To replicate -
- Disable the setting and click on
Submit credit card contribution
on contribution tab of any contact summary page. - The required field marker(*) was not shown on CVV code input(correct).
- Don't enter any value for cvv and click on Save.
- Formrule error displays which need a value for cvv.
Maybe, we also need to handle the setting assigned at https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Payment.php#L689
@jitendrapurohit Which payment processor? Payment processors can override validatePaymentInstrument() and I think this can make fields required even if the UI doesn't show them as required. |
I tested this on my local environment with a test processor. Seems to be because getAllFields() also calls |
@jitendrapurohit thanks for testing. Confirmed, we'll rework the PR. |
10014e0
to
ebf9def
Compare
@jitendrapurohit We've updated the |
Ping @jitendrapurohit @mattwire @KarinG Would someone mind verifying our PR? |
@jusfreeman @agilewarealok On first glance I'm a little bit worried about adding $isBackOffice to all those functions. A lot of those functions can and are overridden by payments processors (particularly validatePaymentInstrument) - changing the method signatures could cause errors. Would it be possible to pass isBackOffice via one of the existing parameters - $values? @eileenmcnaughton may have a view.. |
At least with the functions on CRM_Core_Payment class we should not pass it in - we should use these functions
|
ebf9def
to
8e88d12
Compare
@eileenmcnaughton Thanks for the hint. We can use @jitendrapurohit @mattwire @KarinG Can you guys please verify this ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use-case I mentioned works fine and the code changes looks good to me. @agilewarealok Any chances of adding a simple unit test which asserts this fix? For eg-
- Set 0/1 for
cvv_backoffice_required
. - Call
getPaymentFormFieldsMetadata()
function - Assert the value returned is as expected.
@agilewarealok Code looks clean. +1 for a unit test if possible as this is payment related. |
I've given this the merge-ready label. I think the fix is right per previous comments. I would be preferable to get a unit test, so I'm hanging off merging now in hope... |
@jitendrapurohit @mattwire @eileenmcnaughton |
c4f8b09
to
41480ca
Compare
@jitendrapurohit @mattwire @eileenmcnaughton |
@agilewarealok Unit test looks good. Just to be really picky, can you extend the unit test to check for the setting the other way too - add: |
41480ca
to
02d3eb1
Compare
@mattwire We've updated the UnitTest to test it the other way too. |
Ok I think this has met reviewer requirements and it has had solid & engaged review. I also think it's a good change, clean code, nice test. Gold star |
CRM-20166: Making CVV always required for front-end pages.
Overview
Setting "CVV required for backoffice" to NO results in it setting all front facing forms to 'not require' CVV site wide, ie on all public facing contribution pages.
Before
A single setting was there to disable/enable CVV on front office and back office pages.
After
Now we don't consider back-office setting for front-end contribution pages by making CVV always required for front-end pages.
Agileware Ref: CIVICRM-689