xss.t 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (C) 2015 Alex Schroeder <alex@gnu.org>
  2. #
  3. # This program is free software: you can redistribute it and/or modify it under
  4. # the terms of the GNU General Public License as published by the Free Software
  5. # Foundation, either version 3 of the License, or (at your option) any later
  6. # version.
  7. #
  8. # This program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along with
  13. # this program. If not, see <http://www.gnu.org/licenses/>.
  14. require './t/test.pl';
  15. package OddMuse;
  16. use Test::More tests => 7;
  17. # Edit summary in diff
  18. test_page(update_page('Test', 'Content is saved with <xss1>', '<xss>'),
  19. 'Content is saved');
  20. test_page(get_page('action=browse id=Test diff=1'),
  21. '&lt;xss&gt;');
  22. # RSS
  23. test_page(get_page('action=rss'),
  24. '&amp;lt;xss&amp;gt;');
  25. # Search & Replace
  26. test_page(get_page('search=%3cxss1%3e'),
  27. 'Search for: &lt;xss1&gt;');
  28. test_page(get_page('search=%3cxss1%3e replace=%3cxss2%3e pwd=foo'),
  29. 'Replaced: &lt;xss1&gt; &#x2192; &lt;xss2&gt;',
  30. 'saved with &lt;xss2&gt;');
  31. # enable uploads
  32. AppendStringToFile($ConfigFile, "\$UploadAllowed = 1;\n");
  33. update_page('Logo', "#FILE image/png\niVBORw0KGgoAAAA");
  34. test_page(update_page('Test', '[[image:Logo|"/><xss><span]]'),
  35. '&lt;xss&gt;');