Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2004
    Location
    Belfast, Northern Ireland
    Posts
    2,480
    Plugin Contributions
    14

    Default [Not a bug] Preventative action: bug to be introdiced in 1.3.9/2.0.0

    Hi,

    I was recently made aware of the following page:

    https://www.zen-cart.com/tutorials/i...hp?article=320

    The following lines cannot be made part of the core or they will break many payment modules:

    PHP Code:
    if (isset($_GET[$key]) && strlen($_GET[$key]) > 43) {
        
    $contaminated true;
      } 
    This is because they are limiting the length of any single GET parameter to 43 characters.

    Many of the payment modules pass an error message as a GET parameter which is considerably longer than 43 characters - something which is fully compliant with all relevant standards/guidelines.

    Either the error_message parameter should be removed from the $paramsToCheck array or the allowed length of the parameters should conform to the web standards for GET parameters.

    Obviously it would be a critical mistake to implement this code as it is in 1.3.9/2.0.0, so I hope that the above comments will be taken onboard and that Zen Cart won't break standards for overzealous "peace of mind" issues! ;)

    All the best...

    Conor

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Preventative action: bug to be introdiced in 1.3.9/2.0.0

    Conor,

    You are correct that a problem would exist if the $_GET method were to continue to be used for error message handling from payment modules.
    However, the correct way to handle error messages that are passed from page to page is to do it via the messageStack and not via a $_GET parameter.

    Revising the payment module to use the messageStack will avoid the problem you mention.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Aug 2004
    Location
    Belfast, Northern Ireland
    Posts
    2,480
    Plugin Contributions
    14

    Default Re: Preventative action: bug to be introdiced in 1.3.9/2.0.0

    Hi,

    Quote Originally Posted by DrByte View Post
    However, the correct way to handle error messages that are passed from page to page is to do it via the messageStack and not via a $_GET parameter.

    Revising the payment module to use the messageStack will avoid the problem you mention.
    Either method was a "correct" way before, but I'll have to rewrite things to dump the "old" usage of the error_message parameter. That's a lot of extra work for me.

    I'll set aside a few hours for this then. :|

    Are there any documents yet about what changes will be needed for modules for 1.3.9/2.0.0?

    Conor
    Last edited by conor; 21 Jul 2009 at 11:51 AM.

  4. #4
    Join Date
    Aug 2004
    Location
    Belfast, Northern Ireland
    Posts
    2,480
    Plugin Contributions
    14

    Default Re: Preventative action: bug to be introdiced in 1.3.9/2.0.0

    Hi,

    Since payment modules are intended to use the messageStack functionality from Zen Cart 1.3.9 onwards I think the following lines in checkout_payment/header_php.php will be defunct from 1.3.9 onwards and should be removed:

    PHP Code:
    if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) {
      
    $messageStack->add('checkout_payment'$error['error'], 'error');

    The maximum length of any error message would be 43 characters in the PayPalWPP module, and for any third party modules it would seem pointless to manage the message passing using session variables when messageStack's add_session method could just be used instead, before redirecting back to the payment page.

    For these reasons I recommend that you remove support for get_error method in payment modules from 1.3.9 onwards.

    This will ensure that other authors of payment modules will also update their error handling code and won't fall foul of the soon-to-be-introduced "contamination" functionality.

    Hope that helps!

    All the best...

    Conor

  5. #5
    Join Date
    Aug 2004
    Location
    Belfast, Northern Ireland
    Posts
    2,480
    Plugin Contributions
    14

    Default Re: Preventative action: bug to be introdiced in 1.3.9/2.0.0

    bump!!!

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Preventative action: bug to be introdiced in 1.3.9/2.0.0

    "bump"?

    Your suggestion is understandable and will be considered.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Aug 2004
    Location
    Belfast, Northern Ireland
    Posts
    2,480
    Plugin Contributions
    14

    Default Re: Preventative action: bug to be introdiced in 1.3.9/2.0.0

    Hi,

    Quote Originally Posted by DrByte View Post
    "bump"?

    Your suggestion is understandable and will be considered.
    lol that was a bit cheeky, wasn't it? :)

    I just wasn't sure if anyone had read my suggestion. Thanks for getting back to me. It's not exactly a major issue but I thought it would be better to clarify things by having a single method for passing error messages.

    I've started converting the payment modules I've written over to using the messageStack system and it's taking less time than I originally thought, and works well, which is good! :)

    Thanks again.. I suppose you can consider this thread "finished"!

    All the best...

    Conor
    ceon

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Preventative action: bug to be introdiced in 1.3.9/2.0.0

    Yes, it was cheeky. Sorry.

    Deprecating that messageStack output in the template in the v1.3.x series is probably not a good idea for compatibility reasons. Granted, the sanitizer is going to kill the page if the longer message is sent. It's a bit of a challenge, for which there is no perfect answer for everyone.

    As for 2.0, payment modules will have to use the messageStack for error messages.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 4
    Last Post: 24 Jul 2010, 01:06 PM
  2. [NOT A BUG] Minor bug in account edit template
    By jdcncsolutions in forum Bug Reports
    Replies: 3
    Last Post: 2 May 2010, 01:37 AM
  3. [Not a bug] Language overwrite bug?
    By yellow1912 in forum Bug Reports
    Replies: 2
    Last Post: 23 Jan 2008, 01:00 PM
  4. [Not a Bug] Bug in zen_truncate_paragraph function
    By SilverZulu in forum Bug Reports
    Replies: 3
    Last Post: 21 Dec 2007, 01:11 AM
  5. [Not a Bug] EZ-Page Links IE bug when first clicking
    By NamSingh in forum Bug Reports
    Replies: 11
    Last Post: 25 Dec 2006, 03:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR