Commit graph

197 commits

Author SHA1 Message Date
Richard Hansen
cc688f7367 ace: Delete dead code 2021-11-07 23:24:39 -05:00
Richard Hansen
87a490d456 docs: import hook fileEnding has leading period 2021-11-06 01:05:55 -04:00
Richard Hansen
fe87e2df87 ImportHandler: Pass the pad ID to the import hook
This enables plugins to log the pad ID if desired.
2021-11-05 17:19:54 -04:00
Richard Hansen
caf4e9f28c ImportHandler: Use truthiness to signal conversion handled 2021-11-05 17:19:54 -04:00
Richard Hansen
edf99dc811 docs: Document the import server-side hook 2021-11-05 17:19:54 -04:00
Richard Hansen
26675c5019 chat: New chatNewMessage server-side hook 2021-11-01 01:54:29 -04:00
Richard Hansen
9fbd2e5c3d chat: New chatSendMessage client-side hook 2021-11-01 01:54:28 -04:00
Richard Hansen
4c2f7f9a11 chat: Rename userId to authorId, userName to displayName 2021-11-01 01:54:28 -04:00
Richard Hansen
f1f4ed7c58 chat: Allow chatNewMessage hook to control rendering 2021-11-01 01:54:28 -04:00
Richard Hansen
2597b940f4 chat: Give chatNewMessage hook access to the raw message object 2021-11-01 01:54:28 -04:00
Richard Hansen
c8dbf35fe4 docs: Improve chatNewMessage client-side hook documentation 2021-11-01 01:54:28 -04:00
Richard Hansen
9aaf781548 PadMessageHandler: Modernize userLeave hook context properties 2021-10-30 03:07:44 -04:00
Richard Hansen
a6d060d67b PadMessageHandler: Replace clientReady hook with new userJoin hook 2021-10-30 03:07:44 -04:00
Richard Hansen
fa54dc1053 PadMessageHandler: Run the clientReady hook asynchronously 2021-10-30 03:06:57 -04:00
Richard Hansen
5d30e0b1b2 PadMessageHandler: Run the userLeave hook asynchronously 2021-10-30 03:06:57 -04:00
Richard Hansen
f4f3aa6aae docs: Improve userLeave and clientReady hook documentation 2021-10-30 03:03:19 -04:00
Richard Hansen
5cbbcbcee6 pad: Simplify reload after .etherpad import
The old "switch to pad" logic looked buggy, and it complicates pad
initialization. Forcing a refresh after importing an `.etherpad` file
isn't much of a UX downgrade.
2021-10-29 19:27:33 -04:00
Richard Hansen
4a8c72a38c Changeset: Minimize changeset docs, add links to code
This reduces the amount of duplicate documentation, and helps keep the
documentation and code in sync.
2021-10-24 21:29:42 -04:00
Richard Hansen
0d65dc8a44 pad: Add clientVars to postAceInit hook context
This allows plugins to avoid the `clientVars` global variable.
2021-08-25 14:59:17 -04:00
Richard Hansen
ee41de4809 pad_editbar: Deprecate the toggleDropDown callback 2021-08-14 07:08:57 -04:00
Richard Hansen
5d39a57507 Pad: Delete dead ace_getFormattedCode() 2021-07-30 03:49:35 -04:00
Richard Hansen
f8a9cd4bad docs: Revise clientVars documentation 2021-06-18 22:22:56 -04:00
pcworld
3c71e8983b Fix read only pad access with authentication
Before this commit, webaccess.checkAccess saved the authorization in
user.padAuthorizations[padId] with padId being the read-only pad ID,
however later stages, e.g. in PadMessageHandler, use the real pad ID for
access checks. This led to authorization being denied.

This commit fixes it by only storing and comparing the real pad IDs and
not read-only pad IDs.

This fixes test case "authn user readonly pad -> 200, ok" in
src/tests/backend/specs/socketio.js.
2021-04-12 22:51:06 -04:00
Richard Hansen
74554d36a5 chat: Allow chatNewMessage hook to modify more values 2021-04-11 06:20:29 +02:00
Mikk Andresen
78ea888cb7 DOCS: Add basic styles for tables and resources section to Changeset docs - https://github.com/citizenos/citizenos-fe/issues/535 2021-04-06 21:42:01 +02:00
John McLear
0f16e518ff
api: drop JSONP (#4835)
* api: drop JSONP

* docs: drop JSONP

* tests: drop JSONP

* api: remove isValidJSONPName require
2021-02-22 09:10:02 +00:00
freddii
ea202e41f6 docs: fixed typos 2021-02-03 00:30:07 +01:00
Richard Hansen
e3a47e48f9 contentcollector: Fix collectContentLineText hook
Before, the hook always ignored the return values provided by the hook
functions. Now the hook functions can change the text by either
returning a string or setting `context.text` to the desired value.

Also drop the `styl` and `cls` context properties. They were never
documented and they were always null.
2021-01-27 04:59:36 +00:00
Richard Hansen
bfe813fca2 docs: Wrap long lines and fix whitespace 2021-01-22 02:25:48 -05:00
John McLear
38c9827161
Feature: Scroll to Line number based on Hash IE http://foo.com/p/bar#L10 will scroll to line 10. (#4554)
Includes test coverage
Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
2020-12-26 22:05:08 +01:00
Richard Hansen
8c1afc3399 express: New expressCloseServer hook
This will be used by a future commit to close all socket.io
connections during server restart.
2020-12-23 16:18:28 -05:00
John McLear
83e28ec031
docs: correct name for callback function 2020-11-26 10:10:43 +00:00
Richard Hansen
cc8dbb07fd docs: Wrap long lines
Also add blank lines around section headings and code blocks.
2020-11-13 20:30:27 +00:00
Richard Hansen
6a8563eeab import/export: Simplify exportEtherpadAdditionalContent processing
Also:
  * Improve parallelization
  * Refine the documentation
2020-11-10 23:02:43 +00:00
Richard Hansen
68a91f5e24 HTML export: Move padId to context object property 2020-11-10 07:13:26 +00:00
John McLear
881d8b8d95
pluginfw: Hook to include additional body in HTML exports (#4469)
* hook, needs docs

* docs
2020-11-06 13:48:59 +00:00
John McLear
3fa58efede
pluginfw: Export .etherpad hooks (#4466)
* export support

* proper prefix

* just a basic example, needs working on still

* docs

* comments shouldnt be hard coded
2020-11-06 13:48:25 +00:00
Richard Hansen
91268e14b7 PadMessageHandler: Rename client to socket
The `client` variable is actually a socket.io Socket object. Rename it
to reduce confusion.
2020-11-02 20:39:08 +00:00
chandi
30b1273853 docs: fix key in padUpdate context 2020-10-26 23:43:09 +00:00
Richard Hansen
36aceb3aba hooks: Rewrite callAll and aCallAll for consistency
Rewrite the `callAll` and `aCallAll` functions to support all
reasonable hook behaviors and to report errors for unreasonable
behaviors (e.g., calling the callback twice).

Now a hook function like the following works as expected when invoked
by `aCallAll`:

```
exports.myHookFn = (hookName, context, cb) => {
  cb('some value');
  return;
};
```
2020-10-24 16:08:50 +01:00
chandi
94cb000e8f
plugins: include more data within padUpdate hook (#4425)
* Including more data at pad update event

* docs: new context fields in padUpdate

Co-authored-by: Pedro Beschorner Marin <pedrobmarin@gmail.com>
2020-10-21 18:04:03 +01:00
Richard Hansen
a4927095ae CSP: Disable the indexCustomInlineScripts hook 2020-10-11 20:31:00 +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
bf9d613e95
feature: New user-specific readOnly and canCreate settings (#4370)
Also:
  * Group the tests for readability.
  * Factor out some common test setup.
2020-09-28 11:22:06 +01:00
Richard Hansen
180983736d security: Enable authorize plugins to grant read-only access 2020-09-27 22:55:49 +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
ab5934cbda webaccess: Split authFailure hook into authnFailure and authzFailure
This makes it possible for plugins to return different pages to the
user depending on whether the auth failure was authn or authz.
2020-09-26 19:37:11 +01:00
Richard Hansen
02757079c0 security: Enable authorize plugins to grant modify-only access 2020-09-26 18:36:36 +01:00
Richard Hansen
53fd0b4f98 webaccess: Return 401 for authn failure, 403 for authz failure
This makes it possible for reverse proxies to transform 403 errors
into something like "upgrade to a premium account to access this
pad".

Also add some webaccess tests.
2020-09-24 10:41:58 +01:00