Commit Graph

62 Commits

Author SHA1 Message Date
Richard Hansen b80a37173e security: Fix authorization bypass vulnerability
Before, a malicious user could bypass authorization restrictions
imposed by the authorize hook:

 * Step 1: Fetch any resource that the malicious user is authorized to
   access (e.g., static content).
 * Step 2: Use the signed express_sid cookie generated in step 1 to
   create a socket.io connection.
 * Step 3: Perform the CLIENT_READY handshake for the desired pad.
 * Step 4: Profit!

Now the authorization decision made by the authorize hook is
propagated to SecurityManager so that it can approve or reject
socket.io messages as appropriate.

This also sets up future support for per-user read-only and
modify-only (no create) authorization levels.
2020-09-15 21:40:25 +01:00
Richard Hansen 9e6d3f3f63 tests: Add authentication, authorization bypass tests 2020-09-15 20:03:30 +01:00
John McLear 12c05c20b2
bugfix/import: doc import bugfix (#4235) 2020-08-30 14:11:12 +01:00
John McLear 4f5cf2dc63
tests and bugfix: test coverage and fix for 4165 - bad HTML export of list items (#4180)
Also fix for test max value for ratelimiter
2020-07-19 16:31:13 +01:00
John McLear 7b0fd4fb29
Bugfix / tests: Travis use LibreOffice PPA and fix import /export tests for good. (#4166)
Just final bits of test coverage for import/export of LibreOffice.  It turns out Travis by default installs an old LO that doesn't support PDF import.  To remedy that I use the LO PPA and also strict install the PDF import support.

Still to do in a future date is check LO exported contents includes expected strings, for now it just checks output length looks sane.
2020-07-16 10:46:45 +01:00
John McLear ab8320d15b
WIP - Test Coverage: Import & Export include LibreOffice Test Coverage (#4163)
Runs on Travis
Will only run locally is ``allowAnyoneToImport`` and ``soffice`` or ``abiword`` is set.
2020-07-14 18:44:53 +01:00
John McLear aff93d24dd
export: txt import include correct OL prefix (#4086)
Includes test coverage
Final part of solving https://github.com/ether/etherpad-lite/issues/3447
2020-06-06 14:30:13 +01:00
John McLear fb68ac672b
tests: OL/UL further testing. 2020-06-05 22:18:58 +01:00
John McLear a4bdcc3392
tests/editor/ul/li/ol/import/export: Introduce contentcollector.js tests & various OL/UL/LI related bugfixes
1. Introduce contentcollector.js backend tests
1. Fix issue with OL LI items not being properly numbered after import
1. Fix issue with nested OL LI items being improperly numbered on export
1. Fix issue with new lines not being introduced after lists in on import #3961
1. Sanitize HTML on the way in (import)
1. Fix ExportHTML CSS because it needs to support OL > LI > OL not OL > OL [The latter being the correct format]
1. Fix backend tests.
2020-06-05 20:54:16 +01:00
John McLear 4497d37af9 tests: path to request require fix 2020-06-01 18:45:01 +00:00
John McLear 0dd9db4e99
tests: fix for fix of fuzz tests
Commenting out fuzz tests for now

Fixed up paths with request..  Pesky globals..
2020-06-01 19:26:49 +01:00
John McLear 71bffed190
tests: fix for fuzz tests (#4068) 2020-06-01 18:52:46 +01:00
John McLear dc11b85e62
tests: fuzzing, binary imports 2020-06-01 17:26:55 +01:00
Christian Schröder 5537ef3950 test: fix settings loading in api/instance backend test
With commit 44186ed (tests: remove loadSettings.js for backend tests.)
the loading of the settings in backendtests changed. One test spec
was not updated.
2020-04-16 03:03:20 +02:00
muxator 44186edbc5 tests: remove loadSettings.js for backend tests.
The old loadSettings.js was a way of customizing settings upon load, because
the Settings module did not offer this functionality. But it did not work well,
since all the default settings were not loaded.

Let's get rid of loadSettings.js for the bulk of the tests (the "backend"
specs). For the "container" specs, we'll keep it in place until/if we rewrite
Settings.js making it less brittle.
2020-04-14 03:36:13 +02:00
Chocobozzz 8c4625ec50 tests: add tests for listAllPads() API call
--HG--
branch : padlist-use-set
2020-04-09 03:39:32 +02:00
muxator e6251687bf api: test coverage for getStats() 2020-04-04 22:03:46 +02:00
Viljami Kuosmanen ccf406708e openapi: support standard http error codes
API errors are now handled at the end of the request heap by
throwing exceptions from the handler
2020-04-03 01:03:11 +02:00
Viljami Kuosmanen 6aa30f213a openapi: add jsonp support + test 2020-04-03 01:03:11 +02:00
John McLear 6c12a7fb1f tests: backend tests for utf8 & emojis support 2020-03-31 02:11:25 +02:00
John McLear 352b432ed1 tests: in backend tests, use POST instead of GET for setText() and setHTML()
This is allowed starting from fc661ee13a ("core: allow URL parameters and POST
bodies to co-exist"), which landed in Etherpad 1.8.0. For the discussion, see
issue #3568.
2020-03-31 02:11:25 +02:00
muxator b2dc446740 tests: typo in a comment in the backend tests 2020-03-31 02:11:25 +02:00
Pierre Prinetti 92f07a544b ci: test basic application response of the docker build
Note by muxator:
This commit introduced a copied & modified version of the testing files
loadSettings.js and pad.js.

It's Christmas night, and we want to shipt this feature, so I merged it anyway,
adding a note in both the original and copied files so that hopefully someone
in the distant future is going to merge them back again.
2019-12-25 00:28:38 +01:00
muxator fe0cf4bdb0 tests: reorganize some files, because we are going to copy & paste them.
In the following commits Pierre is going to copy & modify some files.
This commit prepares the source files in order to minimize those differences,
so we can re-unify them as soon as possible.

No functional changes.
2019-12-25 00:28:38 +01:00
Ray Bellis fc661ee13a core: allow URL parameters and POST bodies to co-exist.
Node 8.14.0 prohibits HTTP headers that exceed 8 KB (source:
https://nodejs.org/en/blog/vulnerability/november-2018-security-releases/#denial-of-service-with-large-http-headers-cve-2018-12121).

This patch allows for the parameters within the body of an HTTP POST request to
be used in addition to those within the URL (and will override them).

Closes #3568.

---
Muxator 2019-10-19:
- this commit was cherry-picked from 882b93487f
- it was modified to include the necessary changes in the documentation
2019-06-27 00:52:53 +02:00
Ray Bellis 4622309dc2 TidyHtml.js: convert to promises
test case uses "nodeify" to convert the calls to TidyHtml back
into nodeback because it integrates better with the test framework
2019-01-31 13:42:41 +00:00
muxator 6d36bb2c53 node8: we can safely use os.tmpdir()
Since we are requiring node >= 8, we can safely use native functionalities.
2019-02-19 22:01:12 +01:00
ilmar 718b175524 tests: show that Etherpad is not able to import & export back a mixed lists
This commit replaces an old test with a new, different one.
Reasons for removing the old test:

- the old list test was introduced in cadb83a with an explicit attempt to import
  an invalid HTML and see if it could recover from it
- in 5967e08 the code base finally managed to export a meaningful HTML (but we
  do not know if other bugs were introduced in pursuing this)
- the old test seemed to aim at attaining resiliency, but correctness should be
  addressed before that

Modified by muxator. See discussion in:
https://github.com/ether/etherpad-lite/pull/3268#issuecomment-411185713
2018-08-06 23:15:48 +03:00
Max Schaefer b94fb2b54d Fix useless comparison in sussonsAndGroups test. 2016-05-05 11:50:39 +01:00
Stefan d7c4cc8e65 Fix check in backend tests 2016-03-23 16:47:52 +01:00
Ted Mielczarek a675659dc2 Add an appendText API 2015-10-19 15:27:09 -04:00
Xavid ad137fa4c8 Restore newline-adding to setText() if passed string does not end in '\n'.
Add a test for the ending-in-'\n' case and update tests for the other case.
2015-06-30 04:47:55 -04:00
John McLear d803ac128e use settings for backend tests 2015-06-29 11:00:00 +01:00
John McLear 4252ef26f6 remove console logs 2015-06-29 10:23:30 +01:00
Simon Gaeremynck fd9d0bc291 Added backend tests for TidyHtml 2015-05-18 17:44:11 +01:00
Xavid 9e86fb279b Fix backend tests with new setText() implementation; tests depended
on the old setText() behavior leaving the last character.
2015-05-06 08:45:22 -04:00
Stefan 83094e0dfd Add test for creating pads with bad characters 2015-04-11 15:50:51 +02:00
John McLear 27ae48686d reintroduce removed api points that were removed by mistake 2015-04-01 13:56:52 +01:00
John McLear 32a09ff461 tests and fix up sloppy code by original author 2015-04-01 13:52:56 +01:00
Luc Didry 92022e493e Add backend tests for new API functions
These new functions are:
* getSavedRevisionsCount
* listSavedRevisions
* saveRevision

+ typo fixing in backend tests
2015-02-25 01:05:58 +01:00
John McLear 860c584b42 remove pointless comments 2015-01-19 15:44:16 +00:00
John McLear 5967e085b7 fix ul tests 2015-01-19 15:37:29 +00:00
John McLear 3463b16d1a nearly there... 2015-01-19 03:04:23 +00:00
John McLear 7958f3b723 nearly fully working 2015-01-19 03:02:34 +00:00
John McLear cadb83ac5a bumpage 2015-01-19 02:51:32 +00:00
John McLear 83f62bb6a9 remove console log 2014-12-31 13:21:36 +00:00
John McLear 7980381369 better test coverage for longer pad data 2014-12-29 21:13:07 +01:00
John McLear c9b0c6896e move pad tests - still need to do copy pad and some other functionality IE force 2014-12-29 15:08:30 +01:00
John McLear 444bbf4cbc remove trailing enter from apikey 2014-12-27 14:19:31 +01:00
John McLear c409495b5e test for pad users 2014-12-24 04:01:18 +00:00