Skip to content

Very serious error in the items #2452

Closed

Description

@andriux1990

Creating an item with the name: OXIMETASOLINA 0.05% ADULTO
Category: GOTAS NASALES
Wholesale Price: 44
Retail Price: 55
Screenshot_2019-05-24 Save Mart Powered by OSPOS 3 3 0
And it does not allow me to save, so
To the item name delete the symbol%, then that way if I keep it.
But when looking for the item it does not appear and when you put the last sheet, No Items to display.
Screenshot_2019-05-24 Save Mart Powered by OSPOS 3 3 0(1)
As I noticed it was very strange I did the same thing in the ospos demo and it happened exactly the same.
No Items to display.

Check the database with phpmyadmin and the item was duplicated many times
Screenshot_2019-05-24 localhost localhost final ospos_items phpMyAdmin 4 8 5
How can I recover the items that are not shown and fix the database
Please help

Activity

  1. daN4cat commented on May 25, 2019

    @daN4cat
    Collaborator

    Version?

  2. andriux1990 commented on May 25, 2019

    @andriux1990
    MemberAuthor

    I did tests in several versions of ospos 3.3.0 up to the ones that are in https://demo.opensourcepos.org
    That currently is 3.3.0 - 39639c

  3. andriux1990 commented on May 25, 2019

    @andriux1990
    MemberAuthor

    On the site https://demo.opensourcepos.org/items says No Items to display. and it's not because there is no element, because I also did the same thing there, They are hidden so to speak, you can create a new item and always say no Items to display.

  4. added this to the 3.3.0 milestone on May 25, 2019
  5. odiea commented on May 25, 2019

    @odiea
    Collaborator

    It does appear to be a bug but if you wrap the item name or % in a single or double quote it does work.

  6. andriux1990 commented on May 25, 2019

    @andriux1990
    MemberAuthor

    The duplicates that were created were due to the number of times you try to save the item

  7. SteveIreland commented on May 25, 2019

    @SteveIreland
    Collaborator

    It's probably the problem created in the CodeIgniter CSR prevention function xss_clean. I recall needing to work around it on an earlier issue. It does not like the % sign followed by a specific sequence of characters.

  8. mckaygerhard commented on May 28, 2019

    @mckaygerhard
  9. mckaygerhard commented on Jun 6, 2019

    @mckaygerhard
  10. jekkos commented on Jul 6, 2019

    @jekkos
    Member

    At first sight it looks like the database does contain the item name that he entered in the form, so I'm no sure if this has something to do with xss_clean() here. It also does end up in the database according to @andriux1990 comment.

    @andriux1990 do you get a proper popup after you create the item with XSS enabled? And does it also create the ospos_inventory table record in that case? If not then that might explain why it's not showing.

  11. daN4cat commented on Jul 7, 2019

    @daN4cat
    Collaborator

    @andriux1990 you can disable xss clean in application/config/config.php, see:

    /* 
    |-------------------------------------------------------------------------- 
    | Internal to OSPOS XSS Clean 
    |-------------------------------------------------------------------------- 
    | 
    | This is to indicated whether we want XSS clean to be performed or not 
    | By default it's enabled as it's assumed the installation has Internet access and needs to be protected, 
    | however intranet only installations may not need this so they can set FALSE to improve performance 
    | 
    */ 
    $config['ospos_xss_clean'] = TRUE;
    
  12. andriux1990 commented on Jul 12, 2019

    @andriux1990
    MemberAuthor

    It is true. I did a test and after showing nothing, now if you show me last page
    Screenshot_2019-07-12 Farmacia Matthew Express 2 Potenciado por NMP 3 3 0
    Thank you

  13. 47 remaining items

  14. jekkos commented on Jan 2, 2021

    @jekkos
    Member

    The solution would be to get rid of xss_clean completely as it introduces a number of problems that are impossible to fix. Usage of this function has been deprecated in CI and won't be available in CI4.

    Instead we should validate input and escape the outputs. Beside this I think we should also introduce addtional hardening by adding a content security policy that disables inline javascript evaluation. Adding this will give a good protection against injected snippets even if an attacker manages to escape the output escape function. We do need to make sure that we have no javascript execution in our DOM elements. I think this is mostly the case for the codebase, but some testing will be needed to check for regressions

  15. jekkos commented on Jan 2, 2021

    @jekkos
    Member

    Be warned: you might be tempted to take the raw user input, and do the encoding before storing it. This pattern will generally bite you later on. If you were to encode the text as HTML prior to storage, you can run into problems if you need to render the data in another format: it can force you to unencode the HTML, and re-encode into the new output format. This adds a great deal of complexity and encourages developers to write code in their application code to unescape the content, making all the tricky upstream output encoding effectively useless. You are much better off storing the data in its most raw form, then handling encoding at rendering time.

  16. jekkos commented on Jan 2, 2021

    @jekkos
    Member

    I just tried that and I am not able to add an image to an Item now.

    Ok what error do you get? something javascript related then?

  17. odiea commented on Jan 2, 2021

    @odiea
    Collaborator

    ERROR - 2021-01-02 11:42:59 --> 404 Page Not Found: Uploads/item_pics

  18. jekkos commented on Jan 2, 2021

    @jekkos
    Member

    Ok weird.. I tried locally and image upload works both with

    • $config['ospos_xss_clean'] = FALSE;
    • $config['ospos_xss_clean'] = TRUE;
  19. daN4cat commented on Jan 2, 2021

    @daN4cat
    Collaborator

    The solution would be to get rid of xss_clean completely as it introduces a number of problems that are impossible to fix. Usage of this function has been deprecated in CI and won't be available in CI4.

    Instead we should validate input and escape the outputs. Beside this I think we should also introduce addtional hardening by adding a content security policy that disables inline javascript evaluation. Adding this will give a good protection against injected snippets even if an attacker manages to escape the output escape function. We do need to make sure that we have no javascript execution in our DOM elements. I think this is mostly the case for the codebase, but some testing will be needed to check for regressions

    We sanitise the input independetly from output. The output is xss sanitise in the controller before invoking the view.
    If we had a thick front end and REST APIs on top of our controllers we should sanitise on the thick front end.
    At the moment all xss_clean are internal and at the root of controller it invokes CI function. If we want to get rid of CI xss_clean we just need to replace that function in the root Controller and the rest of the code is not affected.
    Of course it requires testing...

  20. andriux1990 commented on Jan 5, 2021

    @andriux1990
    MemberAuthor

    Ok weird.. I tried locally and image upload works both with

    really.. with me this does not happen

  21. jekkos commented on Jan 5, 2021

    @jekkos
    Member

    @andriux1990 we should fix this properly so you have both xss and a proper rendering of special character combinations.

  22. jekkos commented on Jan 5, 2021

    @jekkos
    Member

    @andriux1990 maybe you can try to tackle this one? Just remove the xss_clean on the inputs. Then you can probably also get rid of the xss_clean on the table outputs as well and enable the escape in bootstrap tables itself. Should be straightforward to do (as @daN4cat also stated)

  23. mckaygerhard commented on Jan 10, 2021

    @mckaygerhard
  24. linked a pull request that will close this issueUpgrade CI to 4.1.3 (Old) #3271on Oct 28, 2021
  25. modified the milestones: 3.4.0, 3.5.0 on Dec 10, 2022
  26. jekkos commented on Jan 30, 2025

    @jekkos
    Member

    This should be resolved now in 3.4. Will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions