Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Hybrid View

  1. #1
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: AdminRequestSanitizer Problem

    Hi all

    This is in fact a problem with core code, and not really related to any plugins.

    The reviews code passes a 'products_name' hidden field which in this context is a string.
    However in general 'products_name' is expected to be an array (e.g. to account for language translations)
    Hence the sanitizer complaining it's not an array.

    Will push a fix up shortly

  2. #2
    Join Date
    May 2016
    Location
    St. John's NL Canada
    Posts
    28
    Plugin Contributions
    0

    Default Re: AdminRequestSanitizer Problem

    Hello Wilt,

    I discovered the Admin Sanitizer documentation http://docs.zen-cart.com/Developer_D...n_sanitization. That allowed me to turn on sanitizer debugging messages. I matched the date-time stamp of one of the error logs to one for a debug message.

    You undoubtedly have found the real problem. I did notice, however, that in the debug message, the admin sanitizer has changed the value of the "type_name" variable (stripping out spaces and a slash — but leaving a dash). This can be seen in the posted sanitizer debug message.

    This is only a problem because I display the type_name. I created additional product types as the subject site deals exclusively in downloadable products: e-books and software (which can be thought of as “interactive e-books”). I am going to resolve this problem by making sure the type_name is a single word (I'll manually change the database to accomplish this).

    I am looking forward to a fix.

    Oh, turning off "strict sanitizing" doesn’t stop the sanitize error messages, which I am sure you know.

    A question, if I may: It seems to me, on reflection, that the Admin Sanitizer documentation implies I should set up data files in /admin/includes/extra_datafiles/ (for me, /backend/…) to define how the Admin Sanitizer should handle any additional GET or POST fields I have added to the Admin core. It doesn’t indicate how the file names should be formed. Could you tell me please? And whether they are necessary (i.e. advised for good security)?

  3. #3
    Join Date
    May 2016
    Location
    St. John's NL Canada
    Posts
    28
    Plugin Contributions
    0

    Default Re: AdminRequestSanitizer Problem

    It wasn’t necessary to manual change the database. Instead, in Admin, Catalog—>Product Types

    Wilt: Sorry, I didn’t realize I hadn't posted the sanitizer log. If you want it, I can reproduce it.
    Last edited by JRGoold; 31 May 2016 at 05:44 PM. Reason: Forgot Sanitizer log.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,387
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: AdminRequestSanitizer Problem

    Quote Originally Posted by wilt View Post
    Hi all

    This is in fact a problem with core code, and not really related to any plugins.

    The reviews code passes a 'products_name' hidden field which in this context is a string.
    However in general 'products_name' is expected to be an array (e.g. to account for language translations)
    Hence the sanitizer complaining it's not an array.

    Will push a fix up shortly
    Wilt's fix is the 3 files mentioned here: https://www.zen-cart.com/showthread....33#post1312333
    .

    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.

  5. #5
    Join Date
    May 2016
    Location
    St. John's NL Canada
    Posts
    28
    Plugin Contributions
    0

    Default Re: AdminRequestSanitizer Problem

    Thank you for the link. I shall apply the fixes to both the live and test sites.

  6. #6
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: AdminRequestSanitizer Problem

    I need to enclose some text in html tags, in the Option Names Comments field, but when I put the tags in, it is not sanitizing and converts the < to &lt; , and the > to &gt; . I have to then go into the database and change them back to < and > so that they do not render as &lt; and &gt; in-screen.

    eg: <hr /> becomes &lt;hr /&gt;

    How do I fix this?
    Last edited by schoolboy; 11 Dec 2016 at 12:57 AM.
    20 years a Zencart User

  7. #7
    Join Date
    Jan 2004
    Posts
    66,387
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: AdminRequestSanitizer Problem

    Quote Originally Posted by schoolboy View Post
    but when I put the tags in, it is not sanitizing and converts the < to &lt; , and the > to &gt; .
    Actually, it *is* sanitizing; actually appears to be sanitizing something you wish it didn't.

    The process to change this is to identify the name of the input field, and change which sanitization rule is being applied to it for the specified page.
    .

    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.

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,608
    Plugin Contributions
    88

    Default Re: AdminRequestSanitizer Problem

    @schoolboy, towards the bottom of the (Zen Cart 1.5.5b) file /YOUR_ADMIN/includes/init_includes/init_sanitize.php, find:
    Code:
    $group = array('customers_email_address' => array('sanitizerType' => 'SANITIZE_EMAIL_AUDIENCE', 'method' => 'post', 'pages' => array('mail')));
    $sanitizer->addComplexSanitization($group);
    
    $group = array('customers_email_address');
    $sanitizer->addSimpleSanitization('SANITIZE_EMAIL', $group);
    
    $group = array('products_description', 'coupon_desc', 'file_contents', 'categories_description', 'message_html', 'banners_html_text', 'pages_html_text', 'comments');
    $sanitizer->addSimpleSanitization('PRODUCT_DESC_REGEX', $group);
    
    $group = array('products_url');
    $sanitizer->addSimpleSanitization('PRODUCT_URL_REGEX', $group);
    
    $group = array('coupon_min_order');
    $sanitizer->addSimpleSanitization('CURRENCY_VALUE_REGEX', $group);
    and add the highlighted variable name to enable HTML tags in the products' options' comments:
    Code:
    $group = array('customers_email_address' => array('sanitizerType' => 'SANITIZE_EMAIL_AUDIENCE', 'method' => 'post', 'pages' => array('mail')));
    $sanitizer->addComplexSanitization($group);
    
    $group = array('customers_email_address');
    $sanitizer->addSimpleSanitization('SANITIZE_EMAIL', $group);
    
    $group = array('products_description', 'coupon_desc', 'file_contents', 'categories_description', 'message_html', 'banners_html_text', 'pages_html_text', 'comments', 'products_options_comment');
    $sanitizer->addSimpleSanitization('PRODUCT_DESC_REGEX', $group);
    
    $group = array('products_url');
    $sanitizer->addSimpleSanitization('PRODUCT_URL_REGEX', $group);
    
    $group = array('coupon_min_order');
    $sanitizer->addSimpleSanitization('CURRENCY_VALUE_REGEX', $group);

  9. #9
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: AdminRequestSanitizer Problem

    Hi

    There is some documentation about customizing the sanitizers here

    However, to make your life easier, here is what to do.

    Create a new file in [admin]/includes/extra_datafiles/

    I named it sanitize_products_options_comment.php

    contents of the file should be

    PHP Code:
    <?php
    $sanitizer 
    AdminRequestSanitizer::getInstance();
    $group = array(
        
    'products_options_comment' => array('sanitizerType' => 'PRODUCT_DESC_REGEX''method' => 'post'),
    );
    $sanitizer->addComplexSanitization($group);

    Quote Originally Posted by schoolboy View Post
    I need to enclose some text in html tags, in the Option Names Comments field, but when I put the tags in, it is not sanitizing and converts the < to < , and the > to > . I have to then go into the database and change them back to < and > so that they do not render as < and > in-screen.

    eg: <hr /> becomes <hr />

    How do I fix this?

  10. #10
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: AdminRequestSanitizer Problem

    Note.

    Have also opened a github issue.
    https://github.com/zencart/zencart/issues/1348

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. [Done v155b] MasterCard 2-series BIN
    By jackie.taferner in forum Bug Reports
    Replies: 10
    Last Post: 9 Apr 2017, 09:34 PM
  2. v155 [Done v155b] Fax number on tpl_account_edit_default.php
    By istilah in forum Bug Reports
    Replies: 1
    Last Post: 12 Oct 2016, 01:36 AM
  3. Replies: 1
    Last Post: 12 Oct 2016, 01:22 AM
  4. v155 [Done v155b] admin css selector language-dependent
    By torvista in forum Bug Reports
    Replies: 1
    Last Post: 12 Oct 2016, 01:19 AM
  5. v155 [Done v155b] AJAX: Session-variable changes not saved
    By lat9 in forum Bug Reports
    Replies: 5
    Last Post: 18 Aug 2016, 12:20 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