7070 Commits

Author SHA1 Message Date
Erik Michelson d38b99887d fix(revisions): always check noteId when fetching a revision
This fixes a reported security vulnerability where one use could
retrieve revisions of another note where they don't have access
to. This was possible, because the URL included both the note alias
and the revision UUID, the backend then checked the user's permissions
for the note alias but fetched and returned the revision by its UUID
without checking whether the revision belongs to that note.

Credits for finding and reporting this vulnerability to:
- The Raw (https://github.com/therawdev)
- Vishal (https://github.com/shukla304)

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-19 20:32:18 +02:00
Erik Michelson f8eb7bdb7c docs(security): add notice about HD2-preview exemption
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-18 21:08:19 +02:00
Philip Molares 2f34e0d778 refactor(frontend): remove revision revert button
We did not implement this functionality yet and won't for some time so in order for HedgeDoc 2 to become release ready, this button will be removed.

Fixes #6478

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-14 01:10:56 +02:00
renovate[bot] 9dc1178f08 chore(deps): update dependency oxfmt to v0.49.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-05-14 00:06:20 +02:00
Philip Molares ff062d7500 test(backend/e2e): fix /private/explore/pin/:noteAlias forbidden alias test
The test checked the wrong error code, that was thrown because we don't provide the correct request body. The test never failed because of the forbidden alias

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-13 23:59:37 +02:00
Philip Molares e852bef113 fix(frontend): wrong notification key
The notification key 'editor.modal.permissions.error' was meant to be used with the ErrorToI18nKeyMapper as a base
which gets different suffixes added depending on the error code and not as a normal error code by itself.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-13 23:59:37 +02:00
Philip Molares 3a4f2c8551 refactor(controller): improve api responses of controller methods
This should drastically improve how accurate our api document is.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-13 23:59:37 +02:00
Erik Michelson c072fd657d fix(rate-limit): increase auth limit defaults
This is a moderate increase from about 2 req/minute to 2.6 req/minute
with an increase of the window to 15 minutes. Switching between
accounts a few times should be covered by the higher rate limit.
At the same time, the window increase reduces the attack/abuse chance
again.

Fixes #6471

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-13 23:06:02 +02:00
Erik Michelson e2fbb34eed fix(rate-limit): ignore monitoring endpoints
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-13 23:06:02 +02:00
Erik Michelson 82467ed76a feat(frontend-api): show error message to user on rate-limit exceeded
Fixes #6472

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-13 23:06:02 +02:00
Erik Michelson cdf66b00c5 test(rate-limit): add unit tests for rate-limiting
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-13 23:06:02 +02:00
Erik Michelson 5c0f39376c fix(rate-limit): ignore logout endpoint for rate limiting
This caused logouts under certain circumstances not to work.

Fixes #6470

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-13 23:06:02 +02:00
Erik Michelson 2d10b7cfff feat(editor): show notification on permission revoke + redirect
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-13 22:09:10 +02:00
Philip Molares fb87cee9c2 fix(frontend): redirect user to DEFAULT_FALLBACK_URL when permissions update fails after PERMISSIONS_UPDATED message
Fixes #6475

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-13 22:09:10 +02:00
Philip Molares f9077d7ff5 refactor(frontend): export DEFAULT_FALLBACK_URL
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-13 22:09:10 +02:00
Erik Michelson 89e441597d refactor(commons): frontmatter validator uses zod and allows custom options
The frontmatter validator was still the one left place that used Joi instead
of the now widely used zod in HedgeDoc. Since zod can do validation, coercion
and providing types based on the schema, the code could be drastically reduced
compared to the old frontmatter validator.

At the same time, the validator is now less strict. Custom fields are still
allowed for people that want to add their own frontmatter tags which are
unrelated to HedgeDoc. Furthermore, we now allow the complete set of
RevealOptions for the slideOptions key instead of only a few handpicked
ones.

Fixes #5946

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-13 21:05:08 +02:00
Philip Molares 016ec6fd90 fix(frontend): only show register infos when links are configured
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 24 (push) Has been cancelled
Fixes #6469

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-09 13:36:09 +02:00
Erik Michelson 033e627bab fix(frontend): updates to test files after linting changes
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 527e06dfa7 fix(lint): avoid incompatible TypeScript rule
strictNullChecks: true does not work with jest.
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 84c6ed769d fix(tests): make jest tests run again
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson ea9e0bdbd1 fix(backend): type and linting fixes found by oxlint type-aware check
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 420925f490 fix(lint): fixes for html-to-react and commons packages
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 78062bb75c chore(lint): enable type-aware linting
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 6b1f7cee49 fix(deps): update lockfile for oxlint v1.63.0
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 8988e3868f fix(frontend): accessibility issues and other linting problems
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 50d0585ccb fix(frontend): buggy imports and type definitions due to TS-linting
These problems were detected by type-aware linting

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson faaea84a73 chore(lint): enable TypeScript linting in frontend
oxlint now includes support for TypeScript-aware linting by using
the oxlint-tsgolint package. While this increases the chance of
finding bugs early, it requires a few changes to the TypeScript
configuration, especially the explicit declaration of CSS imports
and changing the moduleResolution to bundler mode.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-09 13:05:59 +02:00
Erik Michelson 9558c5d50d chore(deps): upgrade netlify-cli to 26.0.0
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 24 (push) Has been cancelled
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-03 20:30:22 +02:00
Philip Molares 45f526bf8b fix(editor): don't show error if alias is empty
Fixes #6480

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-03 20:24:04 +02:00
Philip Molares 1d3cac4d84 fix(editor): add explanation to publicly visible switch
Fixes #6479

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-05-03 20:17:16 +02:00
Erik Michelson 475231b39a feat(oidc): add backchannel logout
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
Deploy HD2 docs to Netlify / Deploys to netlify (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 24 (push) Has been cancelled
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-02 11:35:33 +02:00
Erik Michelson 2d80f3b045 feat(csrf): add decorator to exclude routes from CSRF protection
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-05-02 11:35:33 +02:00
Philip Molares 1eb9ee2385 fix(readOnly): untangle edit button from toc button
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 24 (push) Has been cancelled
Fixes #6485

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-30 01:19:37 +02:00
Philip Molares 473fac6885 fix(readOnly): make image lightbox usable
Fixes #6486

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-30 01:00:12 +02:00
Philip Molares 1d00334019 fix(translation): change noteDeleted error message
Mention the explore page instead of the history page

Fixes #6483

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-30 00:11:14 +02:00
Philip Molares 22288891f7 chore: change history to explore page
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-30 00:11:14 +02:00
Philip Molares 4db2f354de fix(editor): remove changing color from pin sidebar entry
Instead of a changing color, we now use a chaning icon.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-29 22:50:11 +02:00
Philip Molares 1a56e3ad15 fix(editor): use setNotePinStatus instead of setPinnedState
This method updates the backend and changes the redux state in one call, instead of just calling the backend.
With this the state get's updated, and the user see that they pinned a note immediately.

Fixes #6484

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-29 22:50:11 +02:00
Philip Molares 6b226a0f7a fix(explore): make navigation and search sticky
The navigation and the search box will now always be at the top of the page when scrolling

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-29 22:21:00 +02:00
Philip Molares 98db62f196 fix(explore): rework metadata box allignment
The box with username, and last edit is now always 12 rem wide and looks more even that way

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-29 22:21:00 +02:00
Philip Molares 8729fb207b fix(explore): add extra margin to endMessage of infinity scroll
This way the message doesn't seem so squeezed in

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-29 22:21:00 +02:00
Philip Molares d60a67ee33 fix(explore): always keep the notes list as high as two entries
This prevents problems with the dropdown menu creating a scroll bar

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-29 22:21:00 +02:00
Philip Molares c81dd893e7 fix(login): redirect correctly after login / registration
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 24 (push) Has been cancelled
We had two different approcaches to the redirect after the login / registration.
Because of this there were race conditions, and we sometimes got stuck on the redirect page.

Fixes #6467

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-04-23 23:54:56 +02:00
Erik Michelson 95f28442c3 chore(tests): performance improvements for backend tests
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 24 (push) Has been cancelled
The backend end-to-end tests run with many parallel workers that
each start a full NestJS application including database connection
pools, HTTP server and so on. This can easily result in performance
bottlenecks - which is even the reason why we added the --runInBand
option for the CI. The performance can be improved by constraining
the number of workers and memory allocated per worker in our jest
config. Furthermore, we can forcefully close open HTTP connections
in the test cleanup. This terminates connections with a keepalive
flag, that would persist for a while longer otherwise. The following
`this.app.close()` waits for keepalive requests, so this reduces the
wait time.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-04-15 19:34:53 +02:00
Erik Michelson 8d0e89f49f chore(deps): upgrade netlify cli version and add renovate
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-04-15 19:33:49 +02:00
Erik Michelson 2b4f00d28f feat(config): TLS config options for database connection
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
Deploy HD2 docs to Netlify / Deploys to netlify (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 24 (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
This was originally contributed by @Avi98 back when the config still used
Joi and TypeORM instead of zod and knex. This commit adapts the same changes
previously done but ports them over to zod and knex. Furthermore, the tests
are updated to ensure all aspects of the config are tested.

Co-authored-by: Avinash <avinash.kumar.cs92@gmail.com>
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-04-09 23:04:53 +02:00
Erik Michelson 5b026c052a fix(csrf): refresh token after user has deleted their account
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-04-09 21:47:30 +02:00
Nicolai Søborg 3c18898e47 Image: use relative url
Embedding the full URL into the notes is a bit anoying if you want to
change hostname (or e.g. hosting from a local IP). Using the relative
URL should work in all(?) cases afaik.

I would also like to remove that `additionalUrlText` argument, which is
a bit confusing (not sure it works as intended?). It is only used in
file `use-on-image-upload-from-renderer.ts` - and not sure it even is
set to anything

Signed-off-by: Nicolai Søborg <git@xn--sb-lka.org>
2026-04-09 21:29:57 +02:00
Erik Michelson 7ade60aab7 chore(deps): replace cookie and cookie-signature with fastify-cookie
We already used fastify-cookie in other places. Technically, fastify-cookie
uses the same cookie library under the hood as well. However,
we should stick to the framework defaults in order to avoid
future breaking.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-04-09 21:19:28 +02:00
Erik Michelson 8f4c1ae17f refactor(sessions): move session store into database
This allows session persistence across restarts of the backend.
At the same time it makes future scaling of HedgeDoc easier
since we reduce the amount of in-memory stored data by this
change.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-04-09 21:19:28 +02:00