You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating an item with the name: OXIMETASOLINA 0.05% ADULTO
Category: GOTAS NASALES
Wholesale Price: 44
Retail Price: 55
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.
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
How can I recover the items that are not shown and fix the database
Please help
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.
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.
@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;
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
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.
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...
@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)
Activity
daN4cat commentedon May 25, 2019
Version?
andriux1990 commentedon May 25, 2019
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
andriux1990 commentedon May 25, 2019
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.
odiea commentedon May 25, 2019
It does appear to be a bug but if you wrap the item name or % in a single or double quote it does work.
andriux1990 commentedon May 25, 2019
The duplicates that were created were due to the number of times you try to save the item
SteveIreland commentedon May 25, 2019
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.
mckaygerhard commentedon May 28, 2019
mckaygerhard commentedon Jun 6, 2019
jekkos commentedon Jul 6, 2019
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.
daN4cat commentedon Jul 7, 2019
@andriux1990 you can disable xss clean in application/config/config.php, see:
andriux1990 commentedon Jul 12, 2019
It is true. I did a test and after showing nothing, now if you show me last page

Thank you
47 remaining items
jekkos commentedon Jan 2, 2021
The solution would be to get rid of
xss_cleancompletely 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
jekkos commentedon Jan 2, 2021
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.
jekkos commentedon Jan 2, 2021
Ok what error do you get? something javascript related then?
odiea commentedon Jan 2, 2021
ERROR - 2021-01-02 11:42:59 --> 404 Page Not Found: Uploads/item_pics
jekkos commentedon Jan 2, 2021
Ok weird.. I tried locally and image upload works both with
$config['ospos_xss_clean'] = FALSE;$config['ospos_xss_clean'] = TRUE;daN4cat commentedon Jan 2, 2021
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...
andriux1990 commentedon Jan 5, 2021
really.. with me this does not happen
jekkos commentedon Jan 5, 2021
@andriux1990 we should fix this properly so you have both xss and a proper rendering of special character combinations.
jekkos commentedon Jan 5, 2021
@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)
mckaygerhard commentedon Jan 10, 2021
jekkos commentedon Jan 30, 2025
This should be resolved now in 3.4. Will close.