Commit graph

3160 commits

Author SHA1 Message Date
David Mehren
e4b2b6ff73
Fix insertOnStartOfLines behaviour
A bug in insertOnStartOfLines lead to duplicated text,
if the cursor was not at the start of a line.

This fixes the behaviour of insertOnStartOfLines to always use
the complete first and last line of the selection,
even if they were only partially selected.

Fixes #1231

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-05 22:57:49 +02:00
David Mehren
926493a983
Only install production dependencies in bin/setup
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-05 15:38:00 +02:00
David Mehren
317aba65d8
Move frontend-only deps to devDependencies
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-05 13:35:14 +02:00
David Mehren
0b61f48129
Fix upgradeInsecureRequests CSP directive
The `upgradeInsecureRequests` option of Helmets CSP middleware
was a boolean in Helmet 3, but with Helmet 4,
everything changed to lists.
This commit adjusts the addUpgradeUnsafeRequestsOptionTo
function accordingly.

Closes #1221

See also https://github.com/helmetjs/helmet/tree/v4.6.0/middlewares/content-security-policy

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-04 11:10:53 +02:00
David Mehren
f48e36d205
Merge pull request #1219 from hedgedoc/release/1.8.0 2021-05-03 22:49:15 +02:00
David Mehren
e6d4ac5f9a
Remove mention of .sequelizerc from docs
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-03 22:26:08 +02:00
David Mehren
73e26e1d2d
Bump version to 1.8.0
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-03 22:26:08 +02:00
David Mehren
30a91b6fd7
Add release notes for 1.8.0
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-03 22:26:08 +02:00
Yannick Bungers
9d08eaec8f
Merge pull request #1213 from hedgedoc/renovate/master-lock-file-maintenance
Lock file maintenance (master)
2021-05-03 21:31:51 +02:00
Renovate Bot
de96462bc2
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-03 19:25:15 +00:00
Yannick Bungers
c6590a84ed
Merge pull request #1218 from hedgedoc/maintenance/master/update_meta-marked
Update meta-marked
2021-05-03 21:21:47 +02:00
David Mehren
287928e8a8
Merge pull request #1210 from hedgedoc/renovate/master-mini-css-extract-plugin-1.x
Update dependency mini-css-extract-plugin to v1.6.0 (master)
2021-05-03 21:08:28 +02:00
David Mehren
d029d0bf41
Update meta-marked in yarn.lock
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-03 18:19:06 +02:00
Renovate Bot
5d8a499d52
Update dependency mini-css-extract-plugin to v1.6.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-30 12:46:00 +00:00
Yannick Bungers
f5d8d26728
Merge pull request #1204 from hedgedoc/renovate/master-mini-css-extract-plugin-1.x
Update dependency mini-css-extract-plugin to v1.5.1 (master)
2021-04-29 16:46:08 +02:00
Renovate Bot
ae71297ae1
Update dependency mini-css-extract-plugin to v1.5.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-28 14:18:36 +00:00
David Mehren
90a8aebb71
Merge pull request #1191 from hedgedoc/release/1.8.0-rc1 2021-04-26 22:20:57 +02:00
Erik Michelson
0d943d1284
Extract list of supported languages in separate file
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2021-04-26 21:45:31 +02:00
David Mehren
cf87499e38
Fix wrong placeholder in translations
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-26 21:45:31 +02:00
David Mehren
0bf97f30c4
Add changelog for 1.8.0-rc1
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-26 21:45:31 +02:00
David Mehren
837cf59ef9
Add support for freshly imported languages
New languages: bg, fa, gl, he, hu, oc, pt-br

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-26 21:42:06 +02:00
David Mehren
e4c8f869f0
Add translators to the list of contributors for 1.8.0-rc1
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-26 21:42:06 +02:00
David Mehren
f170dc2669
Update translations from POEditor.com
New languages: bg, fa, gl, he, hu, oc, pt-br
Updated languages: ar, en, eo, es, hi, ja, ko, pl, pt, tr, zh-TW

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-26 21:42:06 +02:00
David Mehren
6cccc558e6
Bump version to 1.8.0-rc1
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-26 21:42:03 +02:00
David Mehren
75f1192dbe
Merge pull request #1196 from hedgedoc/renovate/master-lock-file-maintenance
Lock file maintenance (master)
2021-04-26 21:41:49 +02:00
Renovate Bot
3e27c4cfb3
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-26 19:31:47 +00:00
David Mehren
7ea3357ba8
Merge pull request #1201 from hedgedoc/remove-polyfill 2021-04-26 21:30:06 +02:00
David Mehren
0a1bf3ca1d
Uninstall scrypt-async
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-26 20:38:53 +02:00
Erik Michelson
e54236d057
Remove unneeded polyfill
This polyfill was added because node versions less than 10.5.0 didn't include scrypt support. As we now raised the minimum required version to 12.0.0, this polyfill isn't needed anymore.

Signed-off-by: Erik Michelson <opensource@erik.michelson.eu>
2021-04-26 17:05:20 +02:00
Yannick Bungers
09466189ad
Merge pull request #1193 from hedgedoc/fix/logo-in-readme
Fix logo link in README.md
2021-04-25 22:56:23 +02:00
Tilman Vatteroth
117d9a292d
Fix logo link in README.md
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-04-25 22:49:24 +02:00
David Mehren
59f669e593
Merge pull request from GHSA-p528-555r-pf87
Fix Relative Path Traversal Attack on note creation
2021-04-25 21:28:18 +02:00
David Mehren
6cda639eef
Merge pull request #1176 from hedgedoc/renovate/master-mkdocs-material-7.x
Update dependency mkdocs-material to v7.1.3 (master)
2021-04-25 21:18:11 +02:00
David Mehren
fdebc29010
Merge pull request #1174 from hedgedoc/renovate/master-linters
Update dependency eslint to v7.25.0 (master)
2021-04-25 21:18:02 +02:00
Sheogorath
44b7f607a5
Fix Relative Path Traversal Attack on note creation
Impact
---

An attacker can read arbitrary `.md` files from the server's filesystem due to an [improper input validation](https://cwe.mitre.org/data/definitions/20.html), which results in the ability to perform a [relative path traversal](https://cwe.mitre.org/data/definitions/23.html).

CVSSv3 string: AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

PoC / Quicktest
---

To verify if you are affected, you can try to open the following URL: `http://localhost:3000/..%2F..%2FREADME#` (replace `http://localhost:3000` with your instance's base-URL e.g. `https://demo.hedgedoc.org/..%2F..%2FREADME#`).
- If you see a README page being rendered, you run an affected version.

Analysis
---

The attack works due the fact that [the internal router, passes the url-encoded alias](https://github.com/hedgedoc/hedgedoc/blob/master/lib/web/note/router.js#L26) to the `noteController.showNote`-function. This function passes the input directly to [`findNote()`](78a732abe6/lib/web/note/util.js (L10)) utility function, that will pass it on the the [`parseNoteId()`](78a732abe6/lib/models/note.js (L188-L258))-function, that tries to make sense out of the noteId/alias and check if a note already exists and if so, if a corresponding file on disk was updated.

If no note exists the [note creation-function is called](78a732abe6/lib/models/note.js (L240-L245)), which pass this unvalidated alias, with a `.md` appended, into a [`path.join()`-function](78a732abe6/lib/models/note.js (L99)) which is read from the filesystem in the follow up routine and provides the pre-filled content of the new note.

This allows an attacker to not only read arbitrary `.md` files from the filesystem, but also  observes changes to them.

The usefulness of this attack can be considered limited, since mainly markdown files are use the file-ending `.md` and all markdown files contained in the hedgedoc project, like the README, are public anyway. If other protections such as a chroot or container or proper file permissions are in place, this attack's usefulness is rather limited.

Workarounds
---
On a reverse-proxy level one can force a URL-decode, which will prevent this attack because the router will not accept such a path.

For more information
---

If you have any questions or comments about this advisory:
* Open an topic on [our community forum](https://community.hedgedoc.org)
* Join our [matrix room](https://chat.hedgedoc.org)

Advisory link
---

https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-p528-555r-pf87

Signed-off-by: Christoph (Sheogorath) Kern <sheogorath@shivering-isles.com>
2021-04-25 20:40:17 +02:00
Renovate Bot
7d21e12d05
Update dependency mkdocs-material to v7.1.3
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-25 18:35:34 +00:00
Renovate Bot
1b1845d94e
Update dependency eslint to v7.25.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-25 18:34:59 +00:00
David Mehren
2faf5b6974
Merge pull request #1150 from hedgedoc/feature/prometheus_metrics 2021-04-25 20:34:03 +02:00
David Mehren
c8e2117452
Merge pull request #1167 from hedgedoc/maintenance/master/remove_node_10 2021-04-25 20:10:46 +02:00
David Mehren
cbe7b03b59
Document new Prometheus endpoint
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-25 20:06:56 +02:00
David Mehren
5c70cc021f
Add custom prometheus metrics
This reuses the `realtime.getStatus` method to get the state of the
application state on every prometheus scrape cycle.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-25 20:06:56 +02:00
David Mehren
8914df60a9
Add prometheus endpoint at /metrics
This is currently just using the default metrics of prometheus-api-metrics.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-22 23:19:34 +02:00
David Mehren
dcf72148ce
Merge pull request #1153 from hedgedoc/renovate/master-lock-file-maintenance
Lock file maintenance (master)
2021-04-22 23:12:43 +02:00
Renovate Bot
1b9d11a4ad
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-22 20:59:13 +00:00
Yannick Bungers
8ee2455b6b
Merge pull request #1117 from hedgedoc/improvement/use-upstream-imgur 2021-04-22 22:57:34 +02:00
David Mehren
d52a43e811
Fix version error wording in bin/setup
The previous error message stated that the version of Node or
Yarn is "outdated", which might be accurate coincidentally,
but is not what the script checks.

This commit changes the wording to use "not supported", which
is more accurate to the true check in the script.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-22 22:52:53 +02:00
David Mehren
29e08cdb9f
CI: Stop running tests with Node.js 10
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-22 22:52:51 +02:00
David Mehren
e1df30bd5c
Raise minimum required Node.js version to 12
As Node 10 will be EOL at April 30th, we should stop supporting
and/or promoting the usage of that version.

See also https://endoflife.date/nodejs

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-22 22:52:38 +02:00
Philip Molares
049ac32cc9 Changelog: Mention removal of node-imgur
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-22 22:51:41 +02:00
Philip Molares
f34d927e8c ImageRouterImgur: Replace imgur library with note-fetch request
This kinda is a backport of https://github.com/hedgedoc/hedgedoc/pull/961

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-22 21:23:27 +02:00