Commit graph

1142 commits

Author SHA1 Message Date
Richard Hansen
7f79d201e6 CSP: Move index.html inline code to separate .js file 2020-10-12 20:46:06 +01:00
Richard Hansen
a4927095ae CSP: Disable the indexCustomInlineScripts hook 2020-10-11 20:31:00 +01:00
Richard Hansen
052fbb944f
plugins: Delete noisy and useless debug message (#4409)
The debug statement mostly printed the following useless message over
and over, causing Travis CI logs to become truncated:

    [DEBUG] pluginfw - [ undefined ] returning
2020-10-11 09:51:53 +01:00
webzwo0i
a2328cd7f0
timeslider: bugfix: follow pad contents - only goToLineNumber if it exists (#4390) 2020-10-10 16:57:22 +01:00
John McLear
66df0a572f
Security: FEATURE REMOVAL: Remove all plain text password logic and ui (#4178)
This will be a breaking change for some people.  

We removed all internal password control logic.  If this affects you, you have two options:

1. Use a plugin for authentication and use session based pad access (recommended).
1. Use a plugin for password setting.

The reasoning for removing this feature is to reduce the overall security footprint of Etherpad.  It is unnecessary and cumbersome to keep this feature and with the thousands of available authentication methods available in the world our focus should be on supporting those and allowing more granual access based on their implementations (instead of half assed baking our own).
2020-10-07 13:43:54 +01:00
Richard Hansen
ba6bdf35be Make the aceAttribClasses hook harder to misuse 2020-10-07 10:37:56 +01:00
Richard Hansen
5aa318a09b Call the aceAttribClasses hook synchronously
We could instead await the results of the hook, but then all callers
and their callers recursively would have to be converted to async, and
that's a huge change.
2020-10-07 10:37:56 +01:00
Richard Hansen
a8cf434d1d import: Replace the allowAnyoneToImport check with userCanModify
This reduces the number of hoops a user or tool must jump through to
import.
2020-10-05 18:48:16 +01:00
Richard Hansen
2db4b04af3 cookies: Use SameSite=None if in an iframe from another site 2020-10-04 08:57:44 +01:00
Richard Hansen
bf53162cdd cookies: Use Lax instead of Strict for SameSite 2020-10-04 08:57:44 +01:00
Richard Hansen
3ab0f30ac8 cookies: Use js-cookie to read and write cookies
Rather than reinvent the wheel, use a well-tested library to parse and
write cookies. This should also help prevent XSS vulnerabilities
because the library handles special characters such as semicolon.
2020-10-04 08:57:44 +01:00
Richard Hansen
d55edebddd cookies: Refactor pad_cookie.js
* Use the cookie functions from `pad_utils.js`.
  * Delete unused methods, variables, and parameters.
  * Simplify the logic.
  * Use an ES6 class instead of a weird literal thingy.
  * Use `const` instead of `var`.
2020-10-04 08:57:44 +01:00
Richard Hansen
304318b618 webaccess: Move pre-authn authz check to a separate hook
Before this change, the authorize hook was invoked twice: once before
authentication and again after (if settings.requireAuthorization is
true). Now pre-authentication authorization is instead handled by a
new preAuthorize hook, and the authorize hook is only invoked after
the user has authenticated.

Rationale: Without this change it is too easy to write an
authorization plugin that is too permissive. Specifically:

  * If the plugin does not check the path for /admin then a non-admin
    user might be able to access /admin pages.
  * If the plugin assumes that the user has already been authenticated
    by the time the authorize function is called then unauthenticated
    users might be able to gain access to restricted resources.

This change also avoids calling the plugin's authorize function twice
per access, which makes it easier for plugin authors to write an
authorization plugin that is easy to understand.

This change may break existing authorization plugins: After this
change, the authorize hook will no longer be able to authorize
non-admin access to /admin pages. This is intentional. Access to admin
pages should instead be controlled via the `is_admin` user setting,
which can be set in the config file or by an authentication plugin.

Also:
  * Add tests for the authenticate and authorize hooks.
  * Disable the authentication failure delay when testing.
2020-09-27 21:19:58 +01:00
Richard Hansen
1e3aa9edff pad: Revert back to sending CLIENT_READY on reconnect
Commit 0bb8d73ba2 fixed the author ID
that is saved in the socket.io sessioninfo when the client sends a
`CLIENT_READY` with `reconnect` set to true, so it is now safe to undo
the workaround from PR #3868.

Fixes #4331.
2020-09-26 18:32:04 +01:00
Richard Hansen
45ec8326f0 Add a new 'rejected' disconnect reason
This reason will be used in a future commit that will reject erroneous
messages.
2020-09-22 14:09:07 +01:00
Sebastian Castro
12bd617f51
css: Improve toolbar responsiveness for small screen (#4322)
Until now, the "mobile layout" (with right toolbar on bottom of the screen) was displayed only when screen was smaller than 800px. It made the toolbar break for screen about 1000px when a lot of plugins are in the toolbar.
Now instead, we detect with javascript when the toolbar icons overflow the natural space available, and we switch in "mobile layout" in such case
2020-09-19 19:09:30 +01:00
Richard Hansen
5ac5b65aff Pad: Disable toolbar and import/export when reconnecting 2020-09-15 20:04:17 +01:00
Richard Hansen
ed3c82e8c3 Use null, not "null", if sessionID cookie doesn't exist
`decodeURIComponent(null)` returns the string `'null'`, which we don't
want.
2020-09-11 22:10:04 +01:00
Sebastian Castro
818194da90
editor/performance: Fix performance for large pads (#4267)
* Fix line numbers top padding

This old rule was conflicting with new css rules introduced in 1.8.4

* Fixes #4228 Performance degradation for long pads 

Due to layout trashing when calculating new heights
2020-09-08 14:52:26 +01:00
Richard Hansen
da459888dc plugins: Move plugin definitions to avoid monkey patching
Also document the plugin data structures.
2020-09-08 00:50:24 +01:00
Richard Hansen
dcbf876d03 hooks: New mechanism to deprecate hooks
I plan on splitting authFailure into authnFailure and authzFailure so
that separate authentication and authentication plugins can coexist
peacefully. This change will make it possible to mark the authFailure
hook as deprecated (which simply logs a warning).
2020-09-08 00:49:10 +01:00
Richard Hansen
8cf2bcaeb4 plugins: Fix type typo
`exports.parts` is a topologically sorted array, but the intermediate
collection of parts assembled in `plugins.update()` is associative.
2020-09-08 00:47:32 +01:00
Richard Hansen
442fe1e86f pluginfw: Always include the function name in hook_fn_name
Plugin authors are allowed to omit the function name in the `ep.json`
parts definition. For example:

```
{
  "parts": [
    {
      "name": "ep_example",
      "hooks": {
        "authenticate": "ep_example",
        "authFailure": "ep_example"
      }
    }
  ]
}
```

If omitted, the function name is assumed to be the same as the hook
name. Before this change, `hook_fn_name` for the example hooks would
both be `/opt/etherpad-lite/node_modules/ep_example`. Now they are
suffixed with `:authenticate` and `:authFailure`. This improves
logging, and it makes it possible to use `hook_fn_name` to uniquely
identify a particular hook function.
2020-09-05 22:43:17 +01:00
Richard Hansen
6f3e7d14f6 hooks: Always return a list from aCallFirst and callFirst
Every existing caller of `aCallFirst` expects a list and will throw an
exception if given `undefined`. (Nobody calls `callFirst`, except
maybe plugins.)
2020-09-05 20:35:19 +01:00
webzwo0i
d25cd891ae
remove json2, all supported browsers have JSON now (#4198)
cf. https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/JSON
2020-07-28 00:52:25 +01:00
Joas Souza
0835bfeabb
Bugfix: wait promise finish on hooks (#4194)
This commit fixes the error of not waiting the async code to finish.
As the forEach did not wait until the async code finish we may get a
hook set up incorrectly. To fix it, we use an "Array.map" to iterate and
wait the promises to be resolved and then returned
2020-07-23 20:47:59 +01:00
John McLear
1e5680a870
tests / bugfix: Timeslider Chrome 55 Further scroll fix (#4186) 2020-07-20 14:14:02 +01:00
John McLear
3d89eed31a
tests: Further scroll fix for bug in Chrome 55-59 with scrollTo not working (#4185) 2020-07-20 09:49:40 +01:00
John McLear
c394b65e75
tests: Further scroll frontend test fix- use var instead of let (#4184) 2020-07-20 09:08:40 +01:00
John McLear
bf24063234
Feature: Timeslider follow (#4133)
When new edits come in changes are followed in the time slider.
2020-07-19 23:46:58 +01:00
John McLear
40014d8230
Rate limit Socket IO communication - WIP (#4036)
Includes settings
    Includes i18n
    Includes a nice notification
    Disconnects on rate limit
    Includes feeding into metrics/stats
    Include console warn to server console.
2020-07-19 22:44:24 +01:00
John McLear
3ddce87ee4
bugfix / timeslider: only update timeslider on correct message type -- resolves #4100 2020-07-17 16:40:24 +01:00
John McLear
d1330a1e1c
Bugfix: Async bump part 2
Sorry, not sure what happened but having kids jump all over the keyboard while I do this probably didn't help... :|
2020-07-17 10:08:40 +01:00
John McLear
9bf1b9f2a2
bugfix / testing: Ie11 warning for not having Promises (#4167)
Makes IE11 work again but may cause an issue for plugin testing in IE11.  IE plugin tests in IE11 will probably fail as the plugin code will not execute.
2020-07-16 09:31:35 +01:00
Florian Rittmeier
c7581ba6f3
fixes jQuery.Deferred exception as reported in #4132 (#4158) 2020-07-10 15:28:32 +01:00
John McLear
b15154cc23
Same site cookie fix - Ready for testing / merge (#3990)
* initial fix for httpprefs

* token

* express_sid fix
2020-07-10 08:43:20 +01:00
John McLear
a3386e3e55
Dont use jquery in import handler (#4153)
I think jQ3 update broke imports a bit, so this removes jQuery and also ensures only .etherpad does reload of page.
2020-07-08 14:50:48 +01:00
webzwo0i
b7dff552f0
cruft: Remove unecessary consolelogs (#4141) 2020-06-27 20:12:06 +01:00
John McLear
045ac70db8
pluginfw: Make the NEW_CHANGES payload include the message in handleClientMessage 2020-06-12 12:26:33 +01:00
John McLear
564e8fee07 forcing back to last known stable before parent merge 2020-06-07 18:44:01 +00:00
John McLear
009e1d01f7
staleCode: Async update 2020-06-07 14:56:45 +01:00
John McLear
128f3e15eb
stalecode: jQuery 3 (#3903) 2020-06-07 12:01:14 +01:00
John McLear
c5584fb5b4
editor: outdent on ol removal (#4088) 2020-06-07 09:51:12 +01:00
John McLear
2cd3dccc4d Revert "Revert "Revert "editor: ul/ol/li - outdent on ol and ul button press"""
This reverts commit fd3980133d.
2020-06-06 20:51:17 +00:00
John McLear
fd3980133d Revert "Revert "editor: ul/ol/li - outdent on ol and ul button press""
This reverts commit 82fb6ddc99.
2020-06-06 20:38:08 +00:00
John McLear
82fb6ddc99 Revert "editor: ul/ol/li - outdent on ol and ul button press"
This reverts commit fc88f12bba.
2020-06-06 18:34:51 +00:00
John McLear
56f6973209
import/export: Timeslider export links numeric pad IDs (#4073)
Fixes #4071
2020-06-05 22:50:55 +01:00
John McLear
6dbfe5e43c
editor/ux: Clearauthorship on full doc selected 2020-06-05 22:47:12 +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
fc88f12bba
editor: ul/ol/li - outdent on ol and ul button press 2020-06-05 20:00:21 +01:00