Commit graph

111 commits

Author SHA1 Message Date
Jan Holesovsky
2383a205c7 Revert "wsd: preprocess javascript file for L10n"
This reverts commit 306b12b9bc.
2019-03-15 17:26:22 +01:00
Jan Holesovsky
b2bd10445d Revert "wsd: allow compression gzip for html and js resources"
This reverts commit b879f9dd06.
2019-03-15 17:26:12 +01:00
Henry Castro
b879f9dd06 wsd: allow compression gzip for html and js resources
Change-Id: I0c6030c91e379cf1d78950516d2b6b8aa6bd018b
2019-03-05 21:14:04 -04:00
Henry Castro
306b12b9bc wsd: preprocess javascript file for L10n
Change-Id: Ib802beca673e1e90ad5dd9c33cd5191300ae7bf8
2019-03-05 20:56:46 -04:00
Henry Castro
c2aef68601 wsd: add boost::locale generation and caching
Change-Id: I75009a87038632ceaddb29094d340b6d9066d5ef
2019-03-05 19:40:58 -04:00
Henry Castro
fcfc257162 wsd: create a static function "parse"
Change-Id: Ifffae9a0d38bf64c41863a98395a2f41a6470441
2019-03-05 18:53:20 -04:00
Henry Castro
6144d55f44 wsd: tokenize symbol "_('') _("")"
Change-Id: I9c0e7f30a96a355f6d69b2c5a5244dbfbd863e08
2019-03-05 18:27:58 -04:00
Henry Castro
ed89931ae8 wsd: use a tiny parser, variable substitution
Change-Id: I821d27ef504a01d0b040f2b7ae7f66e75b16eb96
2019-03-05 16:31:51 -04:00
Ashod Nakashian
9811b0fc98 wsd: reduce warnings
Don't stop the polling thread and attempt cleanup
when the thread is no longer alive; just avoid
logging warnings and other noise.

Demote a couple warning logs to info since
they are neither critical nor actionable.

Change-Id: Ibe8e8491723f1beeaea03a6e935d606b01e275f0
2019-01-22 14:52:40 +01:00
Samuel Mehrbrodt
9d1c6f03ca tdf#122451 CSP: Allow all ports of known hosts
Change-Id: I9cf628ffc3920c87187bac3d17e5036e3c7278fc
Reviewed-on: https://gerrit.libreoffice.org/65998
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-01-09 10:45:28 +01:00
Miklos Vajna
58b3228292 Revert "Always allow frame embedding in debug mode"
This reverts commit 1d9a9e834a. This
commit meant that if you hit CSP violations, then 'make run' hides those
problems and you need a full 'docker' (or similar) setup to see the
problem, where it's much more painful to debug it.

See commit 6e0d1ad707 (document signing:
whitelist CSP frame-src for doc sign endpoint URL, 2018-12-05) for a
real-world example where this happened.

Change-Id: Idc14496463f6decd0ad64c3b31758b4f532d66e6
Reviewed-on: https://gerrit.libreoffice.org/65549
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Miklos Vajna <vmiklos@collabora.com>
2018-12-22 12:29:12 +01:00
Miklos Vajna
6e0d1ad707 document signing: whitelist CSP frame-src for doc sign endpoint URL
If document signing is enabled in loolwsd.xml, then explicitly whitelist
iframe creation towards the doc sign endpoint server, to avoid

> Refused to frame '...' because it violates the following Content Security Policy directive: "frame-src 'self' blob:".

Note that this happened only in non-debug builds, as we currently don't
send eny Content Security Policy headers in debug builds.

Change-Id: Iee2a0644d67d5803ab3f5c636b8e960fa619792f
2018-12-05 16:14:44 +01:00
Tomaž Vajngerl
2861299c77 make vereign server configurable, dynamically show sign. infobar
document_signing_url in loolwsd now accepts a vereign server URL
endpoint. If not provided, the signing functionallity won't be
available.

The document signing infobar is now shown dynamically so by
default it is not shown, but when the users clicks in menu the
"sign document", the infobar is shown (the document-content is
css "top" value is adjusted via JQuery).

Change-Id: I9d5f6b68ba3612eeeb9de28c9c0333b4d1bf41d8
Reviewed-on: https://gerrit.libreoffice.org/64298
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2018-11-29 22:46:07 +01:00
Samuel Mehrbrodt
1d9a9e834a Always allow frame embedding in debug mode
Change-Id: I81c434cfd75c0732e8b6aaaba1392059b0637182
2018-11-29 09:34:37 +01:00
Samuel Mehrbrodt
8f1abe4839 Only add the host to frame-ancestors
not the whole URL with all parameters

Change-Id: I42e3a6a4c05410284afea51bb13ac3f692b243ef
Reviewed-on: https://gerrit.libreoffice.org/64147
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2018-11-28 09:53:35 +01:00
Samuel Mehrbrodt
296aba1bea Improve allowed frame-ancestors
Beforehand, any host could embed the iframe as the Referer was always allowed.

Now, only the loolwsd and the WOPI host are allowed to do that.
Additionally, a config option has been added to add more allowed hosts.

X-Frame-Options supports has been removed as it supports only one host
and CSP is meanwhile supported in ~all major browsers.

Change-Id: I222720e1220116102708c50edaf08e2a4a0aebda
Reviewed-on: https://gerrit.libreoffice.org/63864
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2018-11-23 16:33:55 +01:00
Miklos Vajna
a514abff88 document signing: fix disabled case for Calc/Impress
If the document-container has an explicit style attribute, then this
breaks Calc (only Writer was tested before). This restores the correct
Writer/Calc/Impress behavior when the setting is false and keeps correct
behavior with Writer when the setting is true.

Change-Id: I310660e88af4407e521529ec41b5dcb604108bd9
2018-11-12 11:53:42 +01:00
Miklos Vajna
c74c9e39c8 Disable document signing via config setting
It's not too easy to customize CSS, so move the top position of the
document container to loleaflet.html, where it's convenient to handle
this.

JS can dynamically query if the menu item should be there, similar to
the about dialog.

Change-Id: I4b2799a41f8ad31e3a9b4983fd1947d2e0363a2b
2018-11-09 13:56:02 +01:00
Andras Timar
2d62529359 don't use ssl key file for admin console auth, use a generated key instead
Change-Id: I424afe0184a64b7f069d896bde6941e42b7b5531
rational: setup is easier in case, when user does not use ssl in loolwsd config
Reviewed-on: https://gerrit.libreoffice.org/61076
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2018-10-05 16:38:46 +02:00
Jan Holesovsky
5ae112d563 ServiceRoot: Fix the admin console (the jwt token generation).
Change-Id: Ic1772692471d29c99d7d68834cddb6b304e721d2
2018-09-08 00:12:20 +02:00
Jan Holesovsky
7152a8a55c ServiceRoot: Fix the branding and update the admin console debug URL.
Change-Id: Id10d7a4d99ea993a398467e528e2018cc12d503b
2018-09-08 00:12:20 +02:00
Jan Holesovsky
c5259eb7b6 ServiceRoot: Add the serviceRoot to various html and js files.
Change-Id: Ibd9093afa3d1f014c70328446ee42189dd0c2117
2018-09-08 00:12:20 +02:00
Jan Holesovsky
9d07230f8a ServiceRoot: Allow prefixing all the URI paths with a given prefix.
For instances that has to run in a deeper path like
https://server/something/blah/loleaflet/HASH/loleaflet.html.

Change-Id: Idacdaf9087d682fd527c3af2ea45d6b51a33908e
2018-09-08 00:12:15 +02:00
Miklos Vajna
468f8fedb5 wsd: 'path' is copy-constructed from a const reference but is only used as const reference
Make it a const reference.
2018-08-03 09:10:09 +02:00
Miklos Vajna
6f3fd44c03 wsd: make these a const reference instead of copying for each invocation 2018-07-31 09:19:03 +02:00
George Wood
73b8da4ab0 Cleanup error reporting. 2018-07-24 12:27:35 +01:00
George Wood
e8235e50c8 A more attractive 404 page. 2018-07-24 12:27:35 +01:00
Ashod Nakashian
18750d2d39 wsd: warn for invalid file requests by clients instead of error
Also, logs append new-line automatically.

Change-Id: Ie5b09e454236cab2cdaa14d6f8be7b67e8fb1000
Reviewed-on: https://gerrit.libreoffice.org/52416
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-06-11 22:17:04 +02:00
Jan Holesovsky
ce5fefcb5d Need a way to test the branding even in the debug mode.
Change-Id: Ia1d082a05393b298cd009a256b1a708e924097b9
Reviewed-on: https://gerrit.libreoffice.org/55290
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-06-04 20:15:23 +02:00
Andras Timar
14bda5897e more tweaks to supported/unsupported branding
Change-Id: I6df2047ace23a2613bb1a314284c8aa2cc2a5c8d
Reviewed-on: https://gerrit.libreoffice.org/54759
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-24 15:35:23 -04:00
Jan Holesovsky
49b3957086 Throw if admin console is not enabled.
And few other smaller tweaks around different branding with support key
enabled.

Change-Id: I9a751374c9384d9535a208c9bd912e2041fd5879
Reviewed-on: https://gerrit.libreoffice.org/54753
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-24 15:22:07 -04:00
Henry Castro
6ff069db62 respond different logo brands when it has support
Change-Id: Icddc8b67a20fd829c90c3c5d8eb6942da9c5e74d
Reviewed-on: https://gerrit.libreoffice.org/53583
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-24 15:10:45 -04:00
Andras Timar
d66e8d13b7 serve files with old gith hash in their path, that comes from cached discovery.xml
moreover:
* noCache is always true in debug mode
* when noCache is true we return an explicit "Cache-Control: no-cache" line

Change-Id: I157a410df0a90f9ab151b899e44566b95cbd9929
Reviewed-on: https://gerrit.libreoffice.org/54517
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-18 14:17:23 +02:00
Jan Holesovsky
88eefe75c5 Improve readability of the admin console password check.
Also disable PAM by default.

Change-Id: Id1197f0d049ce56f698952b87d2c4760412eb8ec
Reviewed-on: https://gerrit.libreoffice.org/53727
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-02 16:34:57 +02:00
Andras Timar
0f59930e7f do not allow empty admin console user or password
Change-Id: I3dfb74f62c53d8c7ab80094d4831203d065f0b4c
Reviewed-on: https://gerrit.libreoffice.org/53673
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-01 21:46:07 +02:00
Michael Meeks
ce06a9ae37 Allow the Admin console to be disabled in the configuration.
Change-Id: Iacde8e891f42e9ef9399ebbebbd2b2978188d4c4
2018-04-17 20:47:17 +01:00
Miklos Vajna
cb761748ed Avoid unnecessary copy-initialization
These are copy-constructed from a const reference but are only used as
const reference; make them a const reference.

Change-Id: Id193905b65224c2db4aab88999a92e60d3af3fdf
2018-04-17 09:13:54 +02:00
Jan Holesovsky
c8ef63253a Sanity-check the scheme and host for frame ancestor, POCO does not do that.
Change-Id: Ieea9532ccd2a11e74f370a340e68f46122469848
2018-04-04 12:50:53 +02:00
Miklos Vajna
1dde430bcf wsd: spell out non-trivial autos to improve readability
Change-Id: I0e1f169fc39e5c722704e1cae487147d929f7350
2018-02-07 10:18:12 +01:00
Miklos Vajna
692d24213b wsd: can avoid copying here FileServer
Change-Id: If194705eae76e81141df9c4e86f7e7bc94b250b6
2018-01-31 09:38:05 +01:00
Andras Timar
a2e25cc7d3 Add PAM support
Possibilities are endless. With a simple /etc/pam.d/loolwsd config below,
the user which runs loolwsd ('lool' in production environment) can login
to admin console with normal linux password.

    auth       required     pam_unix.so
    account    required     pam_unix.so

Change-Id: I354a7e9b4705e8fe346d17d6b6041d1406198b37
Reviewed-on: https://gerrit.libreoffice.org/48307
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2018-01-23 11:03:45 +01:00
Pranav Kant
9cbef14160 loplugin:nullptr
Change-Id: I5f0dc970e8522b63570faa0ba05ab19dd0f45d5a
2017-12-20 22:36:41 +05:30
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Pranav Kant
0d4bc145ba Explicit is better than implicit; avoid invalid mem access
The form.get function is something like this:

const std::string& get(const std::string& abc) { return abc; }

passing a string literal implicitly gets converted to temporary
std::string whose reference is then returned and used. This causes
crash, atleast for me, on building online with GCC 7

Change-Id: I09d0aeea57a3dbeeefd1bb28ff645723714aa6b4
Reviewed-on: https://gerrit.libreoffice.org/46727
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 75c2147b7f774afccf55bb93f7fae79efb615361)
Reviewed-on: https://gerrit.libreoffice.org/46730
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-12-18 16:25:57 +01:00
Pranav Kant
768b0c0404 Bin some duplicate 404 handling
Change-Id: Ibf3ed6c5558492b122662f25f31d321a6bbc151c
2017-11-10 12:35:45 +05:30
Tor Lillqvist
4ab070ec38 Sort #include and using lines for consistency
... but did not have the time or energy to do it in all files.

Change-Id: I92ea101cae1ad7be0fd2f31ce5a8d4b4149332c9
2017-11-08 10:34:37 +02:00
Miklos Vajna
bb7ac21d44 Make sure that loop index type is never narrower than the length type
Change-Id: I19aac80850c0371085ca6364412d5ac9207220d0
2017-11-06 09:14:38 +01:00
Miklos Vajna
a3d6dee503 Remove unused strings
Change-Id: I621c462bca38222dcf26dfa1e414cf27e1a3e088
2017-11-03 15:25:09 +01:00
Jan Holesovsky
f8ca17278f access_header: Pass the access_header around + unit test.
Change-Id: I5d6d93e289d8faceda59deae128e8124a0193d95
Reviewed-on: https://gerrit.libreoffice.org/41243
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-08-17 13:41:07 +02:00
Andras Timar
945d74c237 wsd: fix compilation with old OpenSSL that does not have PKCS5_PBKDF2_HMAC()
Change-Id: If48641f6cbcc4d4ded78ea5cc9c9f66063a2ac0a
Reviewed-on: https://gerrit.libreoffice.org/39779
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-31 19:40:37 +02:00