Jakob Ackermann
884b340c75
[misc] re-level log: 403 from web goes to WARN and emit 'not authorized'
...
Users will get redirected to the login page and will see a 'restricted'
page after logging in again.
See frontend: ConnectionManager.reportConnectionError
2020-08-27 11:51:56 +01:00
Jakob Ackermann
1ff9c1e71b
[misc] add the rpc-method into the log context in Router._handleError
2020-08-27 11:51:55 +01:00
Jakob Ackermann
dee4749e6d
[misc] re-level log: properly silence unauthorized updateClientPosition
2020-08-27 10:11:40 +01:00
Jakob Ackermann
425052ff91
Merge pull request #187 from overleaf/jpa-o-error-tagging
...
[misc] migrate to OError tagging/wrapping
2020-08-25 11:46:28 +02:00
Jakob Ackermann
64e659bf43
Merge pull request #186 from overleaf/jpa-fix-join-project-error-context
...
[misc] fix join project error context
2020-08-25 11:46:18 +02:00
Jakob Ackermann
849a1cf416
Merge pull request #185 from overleaf/jpa-doc-id-in-error-context
...
[misc] add/bring back doc_id in error context
2020-08-25 11:42:41 +02:00
Jakob Ackermann
ee3d3b09ed
[misc] wrap redis errors as tagging does not work with them
...
ioredis may reuse the error instance for multiple callbacks. E.g. when
the connection to redis fails, the queue is flushed with the same
MaxRetriesPerRequestError instance.
2020-08-24 10:12:20 +01:00
Jakob Ackermann
537e97be73
[misc] OError.tag all the errors in async contexts
...
See the docs of OError.tag:
https://github.com/overleaf/o-error#long-stack-traces-with-oerrortag
(currently at 221dd902e7bfa0ee92de1ea5a3cbf3152c3ceeb4)
I am tagging all errors at each async hop. Most of the controller code
will only ever see already tagged errors -- or new errors created in
our app code. They should have enough info that we do not need to tag
them again.
2020-08-24 10:12:06 +01:00
Jakob Ackermann
8e31cc5c23
[Router] _handleError: joinProject error-context may not have project_id
...
The ol_context patch changed the priority of client context and rpc
context.
This lead to the (possibly missing) project_id of the client context
overwriting the project_id of the rpc context.
REF: f1d55c0a5437a518e9f4617473caed9ba928e648
2020-08-21 13:29:28 +01:00
Jakob Ackermann
f935b1881a
[Router] leaveDoc: pass the doc_id into the error-context
2020-08-21 12:47:42 +01:00
Jakob Ackermann
fd88819eec
[Router] _handleError: ol_context.doc_id does not exist, drop overwrite
2020-08-21 12:47:42 +01:00
Jakob Ackermann
880056d397
[Router] use a new UnexpectedArgumentsError
2020-08-21 12:47:08 +01:00
Jakob Ackermann
50140f785a
[WebsocketController] use a new JoinLeaveEpochMismatchError
2020-08-21 12:47:08 +01:00
Jakob Ackermann
0462e3e437
[WebsocketController] use a new NotJoinedError
2020-08-21 12:47:07 +01:00
Jakob Ackermann
4cb8cc4a85
[DocumentUpdaterManager] use a new ClientRequestedMissingOpsError
2020-08-21 12:47:07 +01:00
Jakob Ackermann
8abfdb87ff
[DocumentUpdaterManager] use a new DocumentUpdaterRequestFailedError
2020-08-21 12:47:07 +01:00
Jakob Ackermann
02a2382264
[WebApiManager] use a new CorruptedJoinProjectResponseError
2020-08-21 12:47:07 +01:00
Jakob Ackermann
68bc9d0d23
[WebApiManager] use a new WebApiRequestFailedError
2020-08-21 12:47:06 +01:00
Jakob Ackermann
59c4c884a5
[WebsocketController] use the new NotAuthorizedError
2020-08-21 12:47:06 +01:00
Jakob Ackermann
a8c51de510
[AuthorizationManager] use a new NotAuthorizedError
2020-08-21 12:47:06 +01:00
Jakob Ackermann
de518ea4eb
[SessionSockets] use a new MissingSessionError
2020-08-21 12:47:05 +01:00
Jakob Ackermann
6828becb46
[DocumentUpdaterManager] use a new NullBytesInOpError
2020-08-21 12:47:05 +01:00
Jakob Ackermann
af50f9b02c
[DocumentUpdaterManager] use a new UpdateTooLargeError
2020-08-21 12:47:05 +01:00
Jakob Ackermann
5950b26a42
[SafeJsonParse] migrate to OError and use a new DataTooLargeToParseError
2020-08-21 12:47:05 +01:00
Jakob Ackermann
f82177a46a
[Errors] migrate to OError
2020-08-21 12:47:04 +01:00
Jakob Ackermann
ee59056c6e
[misc] forcefully disconnect stale clients from shutdown process
2020-08-13 13:39:22 +01:00
Brian Gough
831d794bf4
clean up join/leave handling
...
Co-Authored-By: Jakob Ackermann <jakob.ackermann@overleaf.com>
2020-08-12 10:54:22 +01:00
Jakob Ackermann
562375d351
[misc] fix express deprecations
2020-07-22 09:45:14 +01:00
Jakob Ackermann
9fff03bca5
[misc] optionally expose the hostname in the 'debug.getHostname' rpc
2020-07-07 11:07:28 +01:00
Jakob Ackermann
aa9d6c8dc9
[misc] reland decaff cleanup ( #166 )
...
* [misc] decaff cleanup: RoomManager
* [misc] decaff cleanup: RedisClientManager
* [misc] decaff cleanup: SafeJsonParse
* [misc] decaff cleanup: WebApiManager
* [misc] decaff cleanup: WebsocketController
* [misc] decaff cleanup: WebsocketLoadBalancer
* [misc] decaff cleanup: SessionSockets
* [misc] decaff cleanup: HttpController
* [misc] decaff cleanup: HttpApiController
* [misc] decaff cleanup: HealthCheckManager
* [misc] decaff cleanup: EventLogger
* [misc] decaff cleanup: Errors
o-error will eliminate most of it -- when we migrate over.
* [misc] decaff cleanup: DrainManager
* [misc] decaff cleanup: DocumentUpdaterManager
* [misc] decaff cleanup: DocumentUpdaterController: no-unused-vars
* [misc] decaff cleanup: DocumentUpdaterController: Array.from
* [misc] decaff cleanup: DocumentUpdaterController: implicit return
* [misc] decaff cleanup: DocumentUpdaterController: IIFE
* [misc] decaff cleanup: DocumentUpdaterController: null checks
* [misc] decaff cleanup: DocumentUpdaterController: simpler loops
* [misc] decaff cleanup: DocumentUpdaterController: move module name def
* [misc] decaff cleanup: ConnectedUsersManager: handle-callback-err
* [misc] decaff cleanup: ConnectedUsersManager: implicit returns
* [misc] decaff cleanup: ConnectedUsersManager: null checks
* [misc] decaff cleanup: ChannelManager: no-unused-vars
* [misc] decaff cleanup: ChannelManager: implicit returns
* [misc] decaff cleanup: ChannelManager: other cleanup
- var -> const
- drop variable assignment before return
* [misc] decaff cleanup: AuthorizationManager: handle-callback-err
Note: This requires a change in WebsocketController to provide a dummy
callback.
* [misc] decaff cleanup: AuthorizationManager: Array.from
* [misc] decaff cleanup: AuthorizationManager: implicit returns
* [misc] decaff cleanup: AuthorizationManager: null checks
* [misc] decaff cleanup: Router: handle-callback-err
* [misc] decaff cleanup: Router: standard/no-callback-literal
* [misc] decaff cleanup: Router: Array.from
* [misc] decaff cleanup: Router: implicit returns
* [misc] decaff cleanup: Router: refactor __guard__ wrapper
* [misc] decaff cleanup: Router: null checks
And a minor bug fix: user.id -> user._id
* [misc] decaff cleanup: Router: move variable declarations to assignments
* [misc] decaff cleanup: app: implicit returns
* [misc] decaff cleanup: app: __guard__
* [misc] decaff cleanup: app: null checks
* [misc] decaff cleanup: app: function definitions
* [misc] decaff cleanup: app: drop unused next argument
* [misc] decaff cleanup: app: var -> const
2020-07-07 11:06:02 +01:00
Jakob Ackermann
a77222470b
[misc] WebsocketControllerTests: always pass cb to updateClientPosition
...
...and fix the inconsistent async behaviour for logged-in vs anonymous
users in the app.
2020-06-29 18:11:33 +01:00
decaffeinate
817844515d
prettier: convert app/js decaffeinated files to Prettier format
2020-06-23 18:29:44 +01:00
decaffeinate
04a85a6716
decaffeinate: rename app/coffee dir to app/js
2020-06-23 18:29:41 +01:00
decaffeinate
a397154e18
decaffeinate: Run post-processing cleanups on AuthorizationManager.coffee and 18 other files
2020-06-23 18:29:38 +01:00
decaffeinate
7335084c26
decaffeinate: Convert AuthorizationManager.coffee and 18 other files to JS
2020-06-23 18:29:34 +01:00
decaffeinate
90eafa388a
decaffeinate: Rename AuthorizationManager.coffee and 18 other files from .coffee to .js
2020-06-23 18:29:29 +01:00
Jakob Ackermann
205efa8812
[WebsocketController] reset the client context before (re)populating it
...
Co-Authored-By: Brian Gough <brian.gough@overleaf.com>
2020-06-22 17:04:31 +01:00
Jakob Ackermann
1fcf534dcf
[Router] revert preserving of client.ol_context
...
We do not enter this line twice, it would result in multiple event
handlers too.
2020-06-22 17:04:31 +01:00
Jakob Ackermann
d17ef183d0
[Router] gracefully set and do not reset the ol_context
2020-06-22 17:04:30 +01:00
Jakob Ackermann
ce4f9148c3
[perf] WebsocketLoadBalancer: move back to a sync loop for msg fan out
2020-06-22 17:04:15 +01:00
Jakob Ackermann
a70c1e1fa2
[perf] WebsocketLoadBalancer: check is_restricted_message once
...
...and filter clients early on.
2020-06-22 17:04:15 +01:00
Jakob Ackermann
5282f8f531
[misc] synchronous client store using an Object at .ol_context
2020-06-22 17:04:08 +01:00
Jakob Ackermann
5f7841526f
[misc] RoomManager: emitOnCompletion: properly handle Promise rejections
...
```
result = Promise.all([<Promise that rejects eventually>]) # rejection 1
result.then () -> RoomEvents.emit(eventName) # rejection 2
result.catch (err) -> RoomEvents.emit(eventName, err) # handle r1
```
As shown above, the second rejection remains unhandled. The fix is to
chain the `.catch()` onto the `.then()` Promise.
2020-06-17 09:29:12 +01:00
Jakob Ackermann
10eb30e572
Merge pull request #154 from overleaf/jpa-backport-httpcontroller-tests
...
[backport] 111 HttpController: 404 for missing clients and add tests
2020-06-10 11:28:17 +02:00
Jakob Ackermann
45ac2bdd97
Merge pull request #153 from overleaf/jpa-backport-drainmanager-tests
...
[backport] 108 and 112: DrainManager acceptance tests
2020-06-10 11:28:08 +02:00
Jakob Ackermann
cfe37dcbb5
Merge pull request #152 from overleaf/jpa-vendor-cookie
...
[misc] vendor a patched session.socket.io middleware
2020-06-10 11:27:58 +02:00
Jakob Ackermann
bc44494466
[HttpController] return 404 in case of a missing client and add tests
...
Add acceptance tests for the client view.
2020-06-10 09:41:36 +01:00
Jakob Ackermann
de35fc5ecf
[HttpApiController] implement the disconnection of a single client
...
The http route returns as soon as the client has fully disconnected.
2020-06-09 18:01:08 +01:00
Jakob Ackermann
acb7d7df5a
[misc] add test cases for the validation of the callback argument
...
When the user provides a function as last argument for socket.emit,
socket.io will flag this as an RPC and add a cb as the last argument
to the client.on('event', ...) handler on the server side.
Without a function as last argument for socket.emit, the callback
argument on the server side is undefined, leading to invalid function
calls (`undefined()`) and an unhandled exception.
The user can also provide lots of other arguments, so the 2nd/3rd ...
argument is of arbitrary type, again leading to invalid function calls
-- e.g. `1()`.
2020-06-09 16:30:03 +01:00
Jakob Ackermann
dc553c4150
[misc] vendor a patched session.socket.io middleware
2020-06-09 15:21:33 +01:00