Commit Graph

244 Commits

Author SHA1 Message Date
Erik Michelson
b933504071 chore(release): bump version numbers, authors, etc
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-08-21 23:40:50 +02:00
Erik Michelson
766d00c4d9 fix(realtime): proper reconnect handling for socket.io
Socket.IO seems to include an own reconnect mechanism for some time.
HedgeDoc however built an own reconnect mechanism on top of that.
Since the 'reconnect' event was dropped for socket.io 4.x, the
reconnect-cleanup code didn't run anymore.

This commit fixes this by:
- removing the manual reconnect interval,
- putting the reconnect handler into the correct place,
- setting reconnection options on the server side

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-08-21 13:22:17 +02:00
Erik Michelson
da2c065e59 fix(realtime): check for online users before clearing note
The disconnect handler for the realtime connection checks whether the
disconnecting socket was the last user for that note. If that's the
case and the note had unsaved changes, it persists them to the database
which is an async progress. In the callback of this async progress, the
note and all its pending changes (should be empty) are deleted.
However, when the user reconnects quickly because of a flaky
connection, it could happen that they create new pending changes before
the database saving finished. As there was no additional "no-users"
check before clearing the note, this could lead to content loss.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-08-21 13:22:17 +02:00
Tony Chau
ffcf79ef07 fix: open links in new tab
The addition of external link warning has changed the behavior of
opening links from opening in a new tab to opening in the same tab.
This restores the old behavior and opens all links in a new tab.

Signed-off-by: Tony Chau <90050474+fo5for@users.noreply.github.com>
2026-08-21 12:20:11 +02:00
Lars Kiesow
d05cfe4e9f feat: add auto login to skip sign-in method chooser
If you combine OIDC with local accounts or if your OIDC provider is an
external company (Facebook, GitHub, …) it makes sense for HedgeDoc to
show a additional login modal so users know that they will leave the
page.

However, if OAuth2/OIDC is a deployment's primary sign-in method and a
local OIDC provider is being used, users expect the common SSO method
being used, and he "Choose method" modal is a redundant extra click.
Essentially, you may have to click login thrice:

- Click login -> modal opens
- Click Login with provider -> provider login opens
- Log in (unless you are logged in already)

This simple patch adds an auto-login configuration, which makes the Sign
In button link straight to the provider's OAuth2 flow, improving the UX
of tHedgeDoc's login.

Signed-off-by: Lars Kiesow <lkiesow@uos.de>
2026-08-21 10:33:25 +02:00
Erik Michelson
0dda149c7f fix(permissions): ignore unknown permission values
The permission checks did not check for unknown permission values
submitted to the server. This allowed bypassing permission checks
under certain circumstances. However, this is not as critical as
it might sound at first, since checks guard that only the owner
can modify note permissions and the owner already has always
full permission to their note.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-24 21:39:28 +02:00
Erik Michelson
0a7fc28d8b chore(release): bump version and adapt release notes for 1.11.1
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-24 21:39:28 +02:00
Erik Michelson
9c1b36df95 fix(slide-preview): list items in correct order
This change fixes the displaying of (nested) list items in the preview
pane of the editor. Previously, list items were all treated as inline
blocks and therefore nested list items were placed next to the previous
item instead of below it. Now they align properly as expected.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-23 21:35:24 +02:00
Erik Michelson
2391e406cb chore(config): remove unused allowOrigin config option
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-22 22:54:36 +02:00
Philip Molares
b03489859a chore(changelog): explain Temp removal
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-07-22 22:54:36 +02:00
Philip Molares
3f50054609 refactor(xssWhitelist): remove unnecessary whitelist entries
All the deleted entries are in the default white contained and don't need to be added another time.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-07-22 20:20:54 +02:00
Philip Molares
1a7c27470e fix(externalLinks): make external link warning work with subpaths 2026-07-22 20:14:44 +02:00
Erik Michelson
0ebf0dbc6b feat: add config option to disable external link warning
Since it is heavily requested by users, this adds a new config option
to disable the previously introduced external link warning.
Be aware however, that disabling this config option weakens the
security of your HedgeDoc instance and is therefore only recommended
for closed trustworthy user groups.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-19 14:40:36 +02:00
Shivam Shukla
a741859060 fix(editor): restore native browser zoom keyboard shortcuts
Signed-off-by: Shivam Shukla <lucifer84670@gmail.com>
2026-07-15 08:59:14 +02:00
Erik Michelson
c02dc05bec docs: add CVE numbers to release-notes
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-04 22:27:16 +02:00
Tobias Dillig
1e75f7462d feat: add 'image/webp' to allowed upload MIME types
Signed-off-by: Tobias Dillig <tobias.dillig@frachtwerk.de>
2026-07-04 22:25:43 +02:00
Tobi
e4d5124211 feat(external-links): add whitelist to bypass redirect page (#6548)
Signed-off-by: Tobias Dillig <tobias.dillig@frachtwerk.de>
Signed-off-by: Tobi <tldev-de@users.noreply.github.com>
2026-06-25 17:16:27 +02:00
Erik Michelson
fe15adaf31 chore(release): bump version, update release notes, update authors
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-06-18 23:56:45 +02:00
Erik Michelson
c489497e45 refactor(frontmatter): constrain frontmatter object after parsing
This change removes the meta-marked dependency which solely was
used for extracting the frontmatter, which is possible as well
with one function. Furthermore, this introduces constraints to
objects resulting from frontmatter parsing and enforces them in
order to prevent attacks like a yaml bomb (massive alias expansion).
This change should resolve a possible DoS attack.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-06-18 23:56:45 +02:00
Erik Michelson
dd40a6c04b fix(auth): sanitize email addresses
Previously, maliciously crafted email addresses
could be used to sneak HTML code into the HedgeDoc
editor, since HedgeDoc uses the local part of the
address as a display name for users.
We're now sanitizing this using DOMPurify.

Co-authored-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-06-18 23:56:45 +02:00
Philip Molares
8891d75baa feat(rate-limit): add more config options
Allow the admin to specify the rate-limits for user signup / login
Allow the admin to specify if Cloudflare specific rate-limit functionality should be used or not

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-06-17 21:08:07 +02:00
Philip Molares
523cb8ea1f chore(changelog): changes to config.json.example
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-06-17 19:35:24 +02:00
Erik Michelson
814271dc0b feat(editor): add external link warning page
A malicious user could modify a valid looking link (for example of the editor UI)
to point to a malicous site, by using overlays and CSS. Since CSS should stay
enabled, we need to make the user aware of possible risks when leaving the
HedgeDoc instance, in order to protect them from credential-theft.

This commit adds a new interstitial page for external links, that shows the
target URL and asks the user, whether they really want to continue.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-06-10 20:15:09 +02:00
Erik Michelson
8b00b6419c chore(release): update AUTHORS and release notes
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-04-15 21:35:05 +02:00
bxff
65bf11554a fix: buffer operations in Stale/StaleWithBuffer instead of throwing (#6342)
When 5+ users edit concurrently, revision gaps trigger the Stale state
which throws 'Ignored server-side change.' on incoming operations. This
causes document divergence, silent data corruption, and eventually
force-resets that discard local edits.

Changes:
- Stale/StaleWithBuffer.applyServer: buffer incoming operations instead
  of throwing, apply them sequentially after missing ops arrive
- Stale.applyClient: carry pendingOps to StaleWithBuffer on transition
- editor-socketio-server: retry-based force-reset (3 failures) instead
  of immediate nuclear reset on any OT error
- hex2rgb: defensive null checks for old non-hex color records

Signed-off-by: bxff <51504045+bxff@users.noreply.github.com>
2026-03-24 21:12:41 +01:00
Philip Molares
f0c0200eb9 docs(release-notes): add section about 1.10.7
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-02-24 20:24:44 +01:00
Philip Molares
5603af245c docs: add changelog entry
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-02-21 23:47:53 +01:00
Erik Michelson
fd4d5bfbd1 fix(editor): always use random hex colors
chance.color() can output all valid CSS
values for colors, including rgba() syntax and predefined color
names. Due to the usage of hex2rgb and other methods, this can
break the editor. This commit ensures that all randomly generated
colors are specified in hex format.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-02-18 19:43:33 +01:00
xenein
7408217b6a docs(features): clarification on locations for light/dark mode (#6355)
Signed-off-by: xenein <76600392+xenein@users.noreply.github.com>
2026-02-15 21:07:54 +01:00
Erik Michelson
145e3ee318 chore(release): bump versions and release notes
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-02-04 20:27:41 +01:00
Philip Molares
67b1917467 docs: fix number of permissions HD1 has
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-01-28 20:08:25 +01:00
Erik Michelson
7185a44448 docs: update for release 1.10.5
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-06 17:45:55 +01:00
Erik Michelson
0a5f4ccefd docs: update for release 1.10.4
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-05 23:36:12 +01:00
Erik Michelson
35f36fccba fix(auth): add state parameters and PKCE support
Only the OAuth2 auth strategy was using the state parameter,
which should be used as described in the RFC. The other
auth strategies such as GitHub, GitLab or Google were lacking
the state parameter.
This change adds the required state parameter as well as
enabling PKCE support on providers where it's possible.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-05 22:06:30 +01:00
Erik Michelson
ef724d0fc2 fix(renderer): use credentialless and sandbox attributes on iframes
Websites loaded via an iframe could interrupt the user's workflow by initiating certain actions like opening print dialogs, alert boxes, etc. on the user's browser or even initiate file downloads.
By using the sandbox attribute, the iframe is limited in it's actions and can't access browser APIs such as to download files.
With the additional credentialless attribute, the page in the iframe is loaded in a completely separate browsing context on Chromium-based browsers, thus isolating the content even more.
The functionality could previously be abused to initiate certain actions on 3rd-party websites where the user is logged-in, if these 3rd-party websites have no proper CSRF protection. However, this is not a security risk to HedgeDoc itself.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-05 21:57:19 +01:00
Erik Michelson
10ec965ed3 fix(renderer): correct regexes for list extra tags
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-03 19:52:52 +01:00
Erik Michelson
801ef14b7e fix(shutdown): kill server after timeout when hanging on shutdown
When socket.io is not able to close a connection somehow, the code
never reaches the final shutdown state but keeps waiting for all
connections to be closed. This can cause a high CPU load on failing
shutdown. It is very unlikely to happen, except when the server is
shut down exactly at the same time a socket is disconnecting and not
already marked as disconnected. This change adds a fallback timer
which forcefully kills the server after a certain amount of time.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-03 19:52:52 +01:00
Erik Michelson
1028d61bf9 fix(embeddings): replace removed sample PDF file with another one
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-03 19:52:52 +01:00
Erik Michelson
1c9a5e4283 fix(embeddings): YouTube embedding requires referrer
The embedded YouTube player seemed not to work anymore
and showed a warning "invalid player configuration".
This seems to be related to the iframe being loaded
without a referrer to the origin domain. YouTube
nowadays requires this (probably to track from which
domains a YouTube player is embedded).

See also: https://developers.google.com/youtube/terms/required-minimum-functionality#embedded-player-api-client-identity

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-03 19:52:52 +01:00
Philip Molares
bc2075ae9d refactor: use user-token for historyDelete too
Previously, the user token was only used for the endpoint
to delete the user itself. This commit adds that token to
the history deletion as well.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2025-11-26 19:28:53 +01:00
Erik Michelson
05a937ea22 chore(node): run tests and linting with Node 24 too
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-11-26 09:23:29 +01:00
Erik Michelson
637c451486 fix: use nanoid instead of shortid
shortid is deprecated and they recommend nanoid instead.
We're not sure if this has to do with possible name
collisions or enumerability, but to be sure and on the
safe side, we're changing this. nanoid seems quite safe
since it uses node's crypto module underneath.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-11-22 01:05:50 +01:00
Erik Michelson
4030cbbd3c fix(renderer): update regex for supported link schemes
This commit updates the whitelist we're using for outgoing links from HedgeDoc. Previously, any URI scheme except javascript: could be used as long as it contains two slashes after the scheme (like https://). On the one hand this allowed linking to arbitrary and possibly unsafe URI schemes, on the other hand this breaks some schemes like xmpp: or geo:.
We're now using the list of schemes that can be registered by a browser to be opened. This restricts arbitrary scheme usage but on the other side fixes several other schemes.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-11-21 21:37:46 +01:00
Erik Michelson
6d970dbafd feat(config): allow restriction and disabling of uploads
Previously, image uploads were always allowed, unless `CMD_ALLOW_ANONYMOUS=false` and `CMD_ALLOW_ANONYMOUS_EDITS=false`.
This PR adds a new config option `CMD_ENABLE_UPLOADS` to configure image uploads independently. There are three different modes: `all` (everyone can upload, guests too), `registered` (only registered and logged-in users can upload images), and `none` to completely disable image uploads.
The default value is non-breaking as it is `all`, unless the config `CMD_ALLOW_ANONYMOUS=false` and `CMD_ALLOW_ANONYMOUS_EDITS=false` is set, in which case the value is `registered`.
The UI will reflect the setting and either show or hide the upload button.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-11-15 22:54:57 +01:00
Erik Michelson
c61bc6a2e0 docs(release-notes): add entry about toobusy bugfix
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-08-14 15:31:09 +02:00
Erik Michelson
a27f58396b docs: update release notes
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-04-10 00:21:55 +02:00
Erik Michelson
3f520ea59a refactor(embeds): drop slideshare, use vimeo api, tighten CSP
The slideshare integration was broken for quite a while already,
as slideshare doesn't seem to have a good replacement, we're
dropping it in the same manner as speakerdeck was dropped some
time ago. This means the special syntax now just renders a plain
link. This commit gets rid of the vimdo oembed API too which
allowed JSONP injection. Instead we're using the normal vimeo
video metadata API.

Co-authored-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-04-10 00:21:55 +02:00
Erik Michelson
f31e591c17 chore(release): bump version to 1.10.3 and add release notes
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-04-10 00:21:55 +02:00
Philip Molares
38f25ec8cc chore: bump version to 1.10.2
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2025-02-14 22:14:11 +01:00
Philip Molares
7b61a815c1 fix(release-notes): typo in the release year
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2025-02-14 21:09:03 +01:00