154 Commits

Author SHA1 Message Date
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 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 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
Philip Molares 2a2bd92265 feat(alias): allow mixed case aliases
Aliases should be saved as is, but in the search we should use like

Co-authored-by: Erik Michelson <github@erik.michelson.eu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-03-24 12:49:12 +01:00
Erik Michelson aeba980ff5 fix(backend): expose backend port for non-localhost
E2E Tests / backend-sqlite (push) Has been cancelled
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
REUSE Compliance Check / reuse (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
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 current implementation restricts the backend port binding
to 127.0.0.1, since this is the default of fastify. This is a
reasonable default from a security standpoint. However, in
certain contexts like docker network, this won't work.
The new configuration option HD_BACKEND_BIND_IP allows to set
a custom IP address to which fastify binds, or setting
0.0.0.0 to bind to all interfaces.
At the same time this fix extends the Dockerfile to announce
port 3000 to be available to the docker daemon.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-02-20 19:28:38 +01:00
Erik Michelson a99f99d6ac feat(security): add rate limiting
This adds rate-limiting using the @fastify/rate-limit module with sane
default values, configuration options, the possibility to disable limits
and differentiation between logged-in users and unauthenticated requests.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-02-04 22:13:07 +01:00
Erik Michelson f0095cd8ec feat(config): make max upload size configurable
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-02-04 21:36:52 +01:00
Erik Michelson a326939f70 fix(config): ensure session secret is always min 32 bytes long
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2026-02-04 21:36:52 +01:00
Philip Molares e087a9b336 chore: update node to 24.12.0
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-01-12 18:34:31 +01:00
Philip Molares 17ba34567d docs(config): explain permissions
Add additional explanation for permission interactions

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2026-01-08 00:16:12 +01:00
Erik Michelson 03f9e663c7 docs(config): update environment variable names
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-21 10:56:57 +01:00
Erik Michelson 3324bf1b2f fix(config): adjust media config type to Zod schema
Our config error messages are generated from the nested
Zod schema for the config. This means, if the path for
the type of media backend to use is
  mediaBackend.type
then the env variable should be
  HD_MEDIA_BACKEND_TYPE

Previously, we used some custom env variable names
like
  HD_MEDIA_BACKEND

This however resulted in the message that the env
variable HD_MEDIA_BACKEND is not set even if it was,
or the other way around, because the generated error
messages were not fitting the actual variable name.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-12-21 10:56:57 +01:00
Philip Molares e28f2b7dec docs: fix formating
As markdownlint now includes linting rules for tables,
this commit fixes our docs in that regard

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2025-12-07 00:46:53 +01:00
Erik Michelson 22435d4d67 docs(config): update environment variable name
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2025-11-06 00:55:21 +01:00
Erik Michelson 748702daf5 refactor(backend): config validation joi to zod
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-04-20 18:09:57 +02:00
Philip Molares 098322cef8 docs(database): remove mention of mysql
Run tests & build / Test and build with NodeJS 20 (push) Has been cancelled
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
E2E Tests / Build test build of frontend (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
E2E Tests / frontend-cypress (1) (push) Has been cancelled
E2E Tests / frontend-cypress (2) (push) Has been cancelled
E2E Tests / frontend-cypress (3) (push) Has been cancelled
We don't test it, and so we should not tell people HD2 could work with mysql

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2025-03-05 19:29:50 +01:00
Erik Michelson 24e2063d6a docs(config): add docs about new config option
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2024-12-18 20:02:19 +01:00
yamashu 4fce422bdb feat(backend revision): add clean-up note revisions job (#5349) 2024-09-26 17:24:24 +02:00
Philip Molares 81a9058347 chore: increase version of all relevant files
We release Alpha v3 of HedgeDoc 2.0 and need to make sure that all
version are changed accordingly.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2024-09-18 21:30:14 +02:00
Erik Michelson 603ad8088c enhancement(auth/oidc): allow manual defining end_session_endpoint URL
For non-OIDC compliant OAuth2 providers it was only possible to define
the authorize, token and userinfo URLs but not the end_session_endpoint.
This commit adds that functionality.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2024-09-18 18:03:22 +02:00
Erik Michelson e8793271a0 enhancement(caddy): expose :8080 by default, trust private proxies
This commit changes the caddyfile to not directly rely on the
HD_BASE_URL environment variable, but instead default to port 8080 as
used in our package.json scripts and docs.
The caddy domain can optionally be overridden using the CADDY_HOST env
variable.
Furthermore, this change adds a section to trust reverse-proxies in
front of Caddy if they are in a private range IP address network.
Both these changes are required to be able to expose a local development
setup with another domain than localhost to a co-developer. With
this change it works without having Caddy trying to generate TLS
certificates for that domain nor HedgeDoc erroring about a origin
mismatch, that occurs as Caddy doesn't forward specific headers
otherwise.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2024-09-18 17:56:25 +02:00
Erik Michelson 157a0fe278 refactor(media): store filenames, use pre-signed s3/azure URLs, UUIDs
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2024-09-12 14:49:17 +02:00
Erik Michelson 4132833b5d refactor(api-docs): move api docs to /api/doc/
The API documentation belongs strictly to the API itself.
Due to the usage of version-prefixed API endpoints, there is no conflict
with existing or future endpoints.
The reason behind this is that we already have enough exceptions in the
routing (default everything to react-frontend, exceptions for backend)
and it is hard to keep it synchronized throughout all relevant places.
This came to attention as the dev setup didn't proxy the API docs to the
backend.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2024-09-12 14:49:17 +02:00
Erik Michelson 7f665fae4b feat(auth): refactor auth, add oidc
Thanks to all HedgeDoc team members for the time discussing,
helping with weird Nest issues, providing feedback
and suggestions!

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>
2024-09-11 21:29:49 +02:00
Erik Michelson 1f1231a730 ci: remove netlify deployment workflow
This workflow was used in an early stage of development of HedgeDoc 2.
It allowed the core developers to quickly check fixes, improvements or
new features to the HedgeDoc UI without the requirement to check-out
the branch locally. As not every pull request required a deployment,
this workflow was only triggered when the "ci: force deployment"
label was added. Since some time already, the frontend and backend
are so tightly coupled that the netfliy deployment doesn't make any
sense anymore and therefore hasn't been used anymore. This commit
therefore removes this leftover workflow.

@RedYetiDev contacted us privately and reported that this deployment
workflow could have been abused to invoke arbitrary commands, including
extraction of environment variables which include our tokens for the
turborepo build cache or the netlify deployment token. For this it
would have been required that somebody created a "safe" pull request,
which would have been labelled with the deployment label and then
changed afterwards since the workflow checks out the pull request
source repository, not the target. We assured that the label was only
added to pull requests from trusted members of the HedgeDoc core team.
There was never any malicious use of the workflow. Furthermore, no
released versions of HedgeDoc (1.x) could have been affected by this,
even in the worst-case scenario.

We're thankful for putting this risk at our attention!
If you too encounter something unusual regarding security in HedgeDoc
itself or our toolchain around it, don't hesitate to contact us.
Details on this are wriiten in our SECURITY.md in the root of the
repository.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2024-07-30 08:48:38 +02:00
Jochen Martin Eppler cdb9a5cbb0 Fix typo
defition --> definition

Signed-off-by: Jochen Martin Eppler <jougs@gmx.net>
2024-06-27 12:45:50 +02:00
Tilman Vatteroth 631b641041 fix(docs): linting of ldap config
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2024-02-10 16:02:31 +01:00
yamashush 275988716c doc: update e2e test script name
Signed-off-by: yamashush <38120991+yamashush@users.noreply.github.com>
2024-01-21 15:31:10 +01:00
Tilman Vatteroth 01d7eb9529 fix(deps): bump minimum node version to v20
With node 18 the tests always crash.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2024-01-18 19:12:46 +01:00
Erik Michelson 482cb7729f docs: fix reverse-proxy how-to using wrong host header
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2023-12-25 12:58:48 +01:00
Philip Molares e797d600d4 chore: release alpha 2
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-25 21:55:27 +02:00
Erik Michelson 520953d0bd enhancement(docs): add info about ports in the setup tutorial
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2023-10-13 09:58:33 +02:00
David Mehren 0df8533450 docs: set HD_INTERNAL_API_URL in docker-compose.yml example
Signed-off-by: David Mehren <git@herrmehren.de>
2023-10-08 21:12:51 +02:00
Tilman Vatteroth f43c9fd2b1 feat: add internal api url
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-10-08 21:12:51 +02:00
Philip Molares 74ba21711c docs: add faq entry about fork awesome deprecation
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-08 21:12:15 +02:00
Yannick Bungers 8f66447ab9 Update docs for HD_SHOW_LOG_TIMESTAMP
Signed-off-by: Yannick Bungers <git@innay.de>

Signed-off-by: Yannick Bungers <git@innay.de>
2023-10-08 20:42:37 +02:00
David Mehren 3aee932736 docs: add alpha version warning to setup instructions
Signed-off-by: David Mehren <git@herrmehren.de>
2023-10-08 19:25:19 +02:00
David Mehren de14b75369 docs: fix alpha image tag
Signed-off-by: David Mehren <git@herrmehren.de>
2023-10-08 19:25:19 +02:00
Philip Molares d10c922cba docs: add netlify badge
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-08 19:21:10 +02:00
Philip Molares 09698579a7 fix: docs deployment
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-08 17:54:39 +02:00
Philip Molares c1aa396a3e fix: docs deployment
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-08 17:44:00 +02:00
Philip Molares 576815013c fix: docs deployment
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-08 17:31:59 +02:00
Philip Molares 5335c48df7 feat(config): warn user about not yet supported config
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-07 14:33:21 +02:00
Philip Molares d43da06ec1 refactor: remove dropbox, facebook & twitter login
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-10-07 13:28:37 +02:00
David Mehren 0693812e8b refactor: remove HstsConfig
This config object was originally ported from the HD1 config,
but is not required anymore.

HD2 does not support handling TLS anymore, so it does not make
sense for it to set TLS-related headers.
The reverse proxy terminating TLS can easily set HSTS headers.

Signed-off-by: David Mehren <git@herrmehren.de>
2023-10-07 11:10:37 +02:00
Philip Molares 5ed1fa18d6 fix: fix links to other files
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-09-17 21:50:21 +02:00
Philip Molares e07cd62596 docs: restructure documentation
This rewrite follows the principles of https://diataxis.fr/

Co-authored-by: Erik Michelson <github@erik.michelson.eu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2023-09-17 21:50:21 +02:00
Philip Molares e0dd24ed29 refactor: move dco into root
They never really belonged into the docs anyway, but somehow were stuck there

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-09-17 21:50:21 +02:00
Philip Molares d185e2e694 refactor: rename HD_AUTH_LDAPS to HD_AUTH_LDAP_SERVERS
This was done as LDAPS us both the plural of LDAP and the common abbreviation for secure LDAP connections.

Fixes #4460

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-07-22 11:37:17 +02:00
Philip Molares e8e72c5328 docs: run lint:fix
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-07-09 20:07:07 +02:00