Commit Graph

7074 Commits

Author SHA1 Message Date
Erik Michelson 77a59c3a26 fix(renderer): allow opening browser popups from sandbox for pdfs
Apparently, opening a link from a sandboxed iframe enabled the
sandbox mode for the opened new tab as well. For most pages,
this is not a problem since these pages don't depend on anything
special. However when clicking a link to a PDF file, Chromium-
based browsers don't open the tab, since the built-in PDF viewer
is not compatible with the sandboxing.
The attribute `allow-popups-to-escape-sandbox` allows pages opened
from the sandbox into a new tab to be not sandboxed. Since we don't
have opener access there, this is no risk to HedgeDoc and can safely
be enabled and therefore fix PDF links.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-19 13:31:28 +02:00
Erik Michelson be67b09a9e fix(renderer): apply dark mode properly to mermaid diagrams
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-15 10:19:41 +02:00
Erik Michelson cad31957c3 fix(revisions): use correct cleanup algorithm
Previously, the cleanup algorithm let to data-loss as it could
delete the only remaining revision of a note when it was older
than the retention period. The new cleanup algorithm strictly
differentiates between cases where only one revision exists at
all, where multiple revisions exists older than the retention
period but no newer one (compacting them properly) as well as
where both revisions older than the retention period and ones
newer than that period exist (cleaning up the old ones).
This should prevent data loss by clean ups.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-15 10:15:40 +02:00
Erik Michelson 42a21586aa fix(revisions): cleanup schedule failed due to ambigous columns in SQL
The generated SQL from Knex contained ambigous column names, resulting
in failure in the real-world since these queries were rejected by the
SQLite library. This patch fixes the problem by properly making all
column names explicit.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-07-15 10:15:40 +02:00
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