etherpad-lite/src
Richard Hansen 1bb44098df PadMessageHandler: Move handleMessage hooks after access check
Move the handleMessageSecurity and handleMessage hooks after the call
to securityManager.checkAccess.

Benefits:

  * A handleMessage plugin can safely assume the message will be
    handled unless the plugin itself drops the message, so it doesn't
    need to repeat the access checks done by the `handleMessage`
    function.
  * This paves the way for a future enhancement: pass the author ID to
    the hooks.

Note: The handleMessageSecurity hook is broken in several ways:

  * The hook result is ignored for `CLIENT_READY` and `SWITCH_TO_PAD`
    messages because the `handleClientReady` function overwrites the
    hook result. This causes the client to receive client vars with
    `readonly` set to true, which causes the client to display an
    immutable pad even though the pad is technically writable.
  * The formatting toolbar buttons are removed for read-only pads
    before the handleMessageSecurity hook even runs.
  * It is awkwardly named: Without reading the documentation, how is
    one supposed to know that "handle message security" actually means
    "grant one-time write access to a read-only pad"?
  * It is called for every message even though calls after a
    `CLIENT_READY` or `SWITCH_TO_PAD` are mostly pointless.
  * Why would anyone want to grant write access when the user visits a
    read-only pad URL? The user should just visit the writable pad URL
    instead.
  * Why would anyone want to grant write access that only lasts for a
    single socket.io connection?
  * There are better ways to temporarily grant write access (e.g., the
    authorize hook).
  * This hook is inviting bugs because it breaks a core assumption
    about `/p/r.*` URLs.

I think the hook should be deprecated and eventually removed.
2020-09-23 08:26:47 +01:00
..
locales Add a new 'rejected' disconnect reason 2020-09-22 14:09:07 +01:00
node PadMessageHandler: Move handleMessage hooks after access check 2020-09-23 08:26:47 +01:00
static Add a new 'rejected' disconnect reason 2020-09-22 14:09:07 +01:00
templates Add a new 'rejected' disconnect reason 2020-09-22 14:09:07 +01:00
ep.json Refactor startup/shutdown for tests 2020-09-22 11:07:21 +01:00
etherpad_icon.svg Change favicon to be closer to new style 2020-04-19 18:20:21 +02:00
package-lock.json Revert "tests: Use wtfnode to determine why mocha isn't exiting" (#4315) 2020-09-22 22:47:26 +01:00
package.json Revert "tests: Use wtfnode to determine why mocha isn't exiting" (#4315) 2020-09-22 22:47:26 +01:00
README.md remove one less warning during install by having a readme placeholder 2013-02-10 03:04:08 +00:00
web.config Add IIS config file 2012-10-25 10:22:28 -07:00

Ignore this file and see the file in the base installation folder