Commit Graph

1214 Commits

Author SHA1 Message Date
soyouzpanda
31e8ed3a00 (backend) support _FILE environment variables for secrets
Allow configuration variables that handles secrets, like
`DJANGO_SECRET_KEY` to be able to read from a file which is given
through an environment file.

For example, if `DJANGO_SECRET_KEY_FILE` is set to
`/var/lib/docs/django-secret-key`, the value of `DJANGO_SECRET_KEY` will
be the content of `/var/lib/docs/django-secret-key`.
2025-07-01 10:32:55 +02:00
Manuel Raynaud
7e63e9e460 ♻️(back) exclude /admin from CSP rules
We have to exclude the /admin prefix to allow loading static files when
the django admin is used.
2025-06-30 14:46:01 +02:00
Anthony LC
388f71d9d0 (frontend) button access request on share modal
When a document is in public or connected mode,
users can now request access to the document.
2025-06-30 12:13:28 +02:00
Anthony LC
2360a832af (frontend) add access request on doc share modal
Add the access request to the document
share modal, allowing admin to see and manage
access requests directly from the modal interface.
2025-06-30 12:13:28 +02:00
Anthony LC
411d52c73b ♻️(frontend) improve separation of concerns in DocShareModal
Improve separation of concerns in the DocShareModal
component.
The member and invitation list are now
in a separate component.
It will help us to integrate cleanly the
request access list.
2025-06-30 12:13:28 +02:00
Anthony LC
394f91387d (backend) send email to admins when user ask for access
When a user requests access to a document, an
email is sent to the admins and owners of the
document.
2025-06-30 12:13:27 +02:00
Anthony LC
878de08b1e (frontend) integrate doc access request
When a user is redirected on the 403 page,
they can now request access to the document.
2025-06-30 12:13:27 +02:00
Manuel Raynaud
d33286019c (back) accept for a owner the request to access a document
Add the action accepting a request to access a document. It is possible
to override the role from the request and also update an existing
DocumentAccess
2025-06-30 12:13:26 +02:00
Manuel Raynaud
c2e46fa9e2 (back) document as for access CRUD
We introduce a new model for user wanted to access a document or upgrade
their role if they already have access.
The viewsets does not implement PUT and PATCH, we don't need it for now.
2025-06-30 12:13:26 +02:00
Manuel Raynaud
2e1b112133 🚨(back) remove unused ruff ignore rule
A ruff ignore rule was present in the factories module. But this rule is
not used in the file so we can safely remove it.
2025-06-30 10:43:58 +02:00
renovate[bot]
8f7ac12ea1 ⬆️(dependencies) update python dependencies 2025-06-30 10:43:58 +02:00
Manuel Raynaud
dfdfe83db5 (back) install and configure django csp (#1085)
We want to protect all requests from django with content security
policy header. We use the djang-csp library and configure it with
default values.

Fixes #1000
2025-06-30 08:42:48 +00:00
Anthony LC
4ae757ce93 🔥(frontend) remove Beta from logo
Docs got homologated, so we can remove the beta
logo from the DSFR theme.
2025-06-27 18:22:59 +02:00
Manuel Raynaud
6964686f7c 🔧(back) remove usage of deprecated db engine
The db engine postgresql_psycopg2 does not exists anymore in django but
for BC compat it is possible to use it in the configuration and it is
replace by postgresql at runtime. We changed this settings to use the
good one.
2025-06-27 16:03:09 +00:00
Manuel Raynaud
45bbffdf9f (back) allow to disable checking unsafe mimetype on attachment upload
We added the possibility to scan all uploaded files with an anti malware
solution. Depending the backend used, we want to give the possibility to
check the file mimtype to determine if this one is tagged as unsafe or
not. To this you can set the environment variable
DOCUMENT_ATTACHMENT_CHECK_UNSAFE_MIME_TYPES_ENABLED to False. The
default value is True.
2025-06-27 15:31:15 +00:00
Anthony LC
95a55e7805 (e2e) reduce flakiness in e2e tests
Flakiness in e2e tests has been reduced by:
- Adding waits for media-check processing in image tests.
- Ensuring that slash menu resets are handled
correctly to avoid flakiness.
- Wait for the Download button to be stable before clicking
2025-06-27 16:50:10 +02:00
Sylvain Zimmer
e9ac36e811 📝(readme) fix some small issues in the README
Fix some typo and small issues in the README file.
2025-06-27 15:10:14 +02:00
Stephan Meijer
d8294ee11d fix: Makefile failing on run-frontend-development (#1104)
See #1103

Signed-off-by: Stephan Meijer <me@stephanmeijer.com>
2025-06-27 12:35:55 +00:00
Anthony LC
00009ecc16 🔧(conf) add server to server api tokens to common
We have the e2e test "it creates a doc server way"
that is quite complicated to run locally, because
it requires the `DJANGO_SERVER_TO_SERVER_API_TOKENS`
environment variable to be set in "env.d/development/common".
We moved `DJANGO_SERVER_TO_SERVER_API_TOKENS` from
"env.d/development/common.e2e.dist" to
"env.d/development/common.dist", by doing so,
this variable will be set by default in the
"env.d/development/common" file, the test will now run
without any additional configuration.
2025-06-26 17:09:08 +02:00
Anthony LC
9b0676ec15 (jest) fix window.location mock
We upgraded to jest 30.0.3.
This upgrade updated jsdom and jsdom now do not
allows to mock window.location.
See: https://github.com/jsdom/jsdom/issues/3492
This commit fixes this issue.
2025-06-26 16:49:13 +02:00
Anthony LC
9f222bbaa3 ⬇️(dependencies) downgrade to docx 9.5.0
Prob compatibility issue with docx 9.5.1 and
BlockNote. We downgrade to 9.5.0 for now until
BlockNote is updated to support docx 9.5.1.
2025-06-26 16:47:51 +02:00
renovate[bot]
f0b253f0ff ⬆️(dependencies) update js dependencies 2025-06-26 12:14:34 +00:00
Timothee Gosselin
1e76e6e04c Documentation for self-hosting with docker compose (#855)
## Purpose

Make self hosting of Docs easier with an example of a deployment
procedure with docker compose and document how to configure Docs.

While https://github.com/suitenumerique/docs/pull/583 propose an easy
way to deploy Docs with docker and Make, here we describe more in
details the various steps and requirements to deploy Docs.

## Proposal

- [x] example to deploy and configure keycloak
- [x] example to deploy and configure minio
- [x] example to configure proxy and certs
- [x] example to deploy and configure Docs

## Improvements
- [x] Rephrase description of environment variables and categorize
- [x] Use template for nginx conf  

Fixes https://github.com/suitenumerique/docs/issues/561
Supersedes https://github.com/suitenumerique/docs/pull/583

 A one liner quick start could be a nice addition:
- [ ] merge all services in a single compose
- [ ] scripts to generate secrets

Signed-off-by: unteem <timothee@indie.host>
2025-06-25 13:02:08 +00:00
Anthony LC
a71453206b 🐛(env) update yprovider env for local development
In local development the notification to
the yprovider server was not working anymore
because of a recent change in the container name.
We adapt the env variables to match the new
container name.
2025-06-24 16:08:23 +02:00
lebaudantoine
71cd016d4d ️(frontend) optimize document fetch error handling
Reduce unnecessary fetch requests when retrieving documents with permission
or authentication issues. Previous implementation was triggering multiple
document requests despite having sufficient error information from initial
attempt to determine appropriate user redirection.

Additionally, fix issue where resetting the auth cache was triggering redundant
authentication verification requests. The responsibility for checking auth
status should belong to the 401 page component on mount, rather than being
triggered by cache resets during error handling.

Known limitations:
- Not waiting for async  function completion makes code harder to
 maintain
- Added loading spinner as temporary solution to prevent UI flicker
- Future improvement should implement consistent error-based redirects rather
 than rendering error messages directly on document page
2025-06-24 15:50:02 +02:00
lebaudantoine
2a7ffff96d ️(frontend) prevent authentication retry on 401 responses
Stop retry attempts when receiving 401 Unauthorized from /me endpoint since
this clearly indicates authentication status. The original purpose of the /me
call is simply to determine if user is authenticated, and a 401 provides
sufficient information.

Prevents unnecessary network requests caused by React Query's automatic retry
behavior when re-raising exceptions, which was hiding the 401 status. Improves
performance and reduces server load during authentication failures.
2025-06-24 15:46:48 +02:00
Erik Duxstad
ff8275fb4e 📝(self-hosted) update collaboration vars (#1075)
Remove the `auth-url` annotation and add the
`COLLABORATION_BACKEND_BASE_URL` variable, introduced in 3.0.0.

Mount the development CA to the yProvider container to allow
TLS connections with the backend.

Fix the mount path for development CA in the backend container.

Signed-off-by: eduxstad <eduxstad@gmail.com>
2025-06-24 06:21:29 +00:00
Bastien
c3f81c2b62 📝(docs) minor fixes to docs/env.md (#1086)
Replaces https://github.com/suitenumerique/docs/pull/941

Signed-off-by: Bastien Guerry <bastien.guerry@code.gouv.fr>
2025-06-20 15:53:39 +02:00
Manuel Raynaud
c7261cf507 🔧(front) configure x-frame-options to DENY in nginx conf (#1084)
The API has the response header x-frame-options configure to DENY and
nothing is configure in the nginx configuring managing the frontend
application. We want to have the same value. The header is added on all
locations.
2025-06-19 15:36:57 +02:00
Anthony LC
e504f43611 👥(github) update pull request template
We added a new section to the pull request
template to ensure that contributors
follow the correct process for submitting
pull requests.
2025-06-17 14:06:55 +02:00
Anthony LC
3ad6d0ea12 📝(project) add system-requirement doc
Add a new document detailing the system
requirements for the project.
2025-06-17 14:06:55 +02:00
Anthony LC
9e8a7b3502 📝(project) add troubleshoot doc
Add a troubleshooting document to help users
resolve common issues.
2025-06-17 14:06:54 +02:00
Manuel Raynaud
05db9c8e51 🤡(demo) change dev users email to remove invalid domain extension
The domain extension (.e2e) used in the demo for users are not validated
anymore by the django EmailValidator. We have to change it to a valid
one.
2025-06-17 13:35:41 +02:00
Manuel Raynaud
7ed33019c2 ⬆️(back) upgrade django to version 5.2
Django 5.2 is now mature enough and we can use it in production.
In some tests the number of sql queries is increasing. This is because
the `full_clean` method called in the `save` method on all our models is
creating a transaction, so a savepoint and release is added.
We also fix deprecated warning in this commit.
2025-06-17 12:20:19 +02:00
Samuel Paccoud
a99c813421 📌(yjs) stop pinning node to minor version on yjs docker image (#1005)
We want to build the yjs Docker image with the latest minor version in
order to avoid outdated images.
2025-06-17 09:43:05 +00:00
Jacques ROUSSEL
a83902a0d4 🚸(helm) improve helm chart
Our Helm chart wasn't suitable for use with Helm alone because jobs
remained after deployment. We chose to configure ttlSecondsAfterFinished
to clean up jobs after a period of time.
2025-06-16 16:05:48 +02:00
renovate[bot]
080f855083 ⬆️(dependencies) update python dependencies 2025-06-16 03:24:19 +00:00
Anthony LC
90d94f6b7a ⬆️(frontend) Bump brace-expansion
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion)
from 2.0.1 to 2.0.2.
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion)
from 1.1.11 to 1.1.12.

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-13 15:30:04 +02:00
Simon Ser
f97ab51c8e 🧑‍💻(docker) add y-provider config to development environment
Without this, YdocConverter throws an error when developping.
2025-06-13 10:53:22 +02:00
Manuel Raynaud
ba4f90a607 🧑‍💻(compose) remove --no-cache to build images by default
In order to speed the rebuild of images, the --no-cache option is
removed by default. If we want to build the images without cache, the
cache paramter must be used.
2025-06-13 10:53:09 +02:00
Manuel Raynaud
6c16e081de 🧑‍💻(docker) create a e2e compose configuration
We want to run the e2e tests using the frontend and y-provider
production images. We created a dedicated compose file adding just
missing services. These services are built in the CI.
2025-06-13 10:38:53 +02:00
Manuel Raynaud
56a945983e ♻️(docker) rename docker-compose.yaml in compose.yml
The usage of docker-compose.yaml file is deprecated, we can rename it in
compose.yml
2025-06-13 10:38:53 +02:00
Manuel Raynaud
4fbbead405 🧑‍💻(compose) build and run y-provider in dev mode
To have a better developer experience, the y-provider service run in dev
mode, allowing hot reload when a file is modified. To avoid issue with
shared node_modules, they are mounted in a separated volume to not have
then in the local directory.
2025-06-13 10:38:53 +02:00
Manuel Raynaud
9a212400a0 🔥(compose) remove app and celery services
`app` and `celery` services are not used when we run the compose
configuration. The compose file is only used for development purpose.
2025-06-13 10:38:52 +02:00
Manuel Raynaud
f07fcd4c0d 🔧(docker) add a service in compose to frontend development
We want a serice in compose starting the frontend application in
development mode. We want to take the advantage of the hot reload
module, so the sources are mounted inside the container.
2025-06-13 10:38:52 +02:00
Appryll
4fc49d5cb2 ️(frontend) Set page titles for 403 and 404 errors
Set the page titles for the 403 and 404 error
pages to improve user experience and accessibility.
2025-06-11 16:36:53 +02:00
Anthony LC
0fd16b4371 💄(frontend) add spacing bottom on editor
We add spacing bottom on editor to
avoid the last editing line being to close to
the bottom.
2025-06-11 13:08:33 +02:00
Anthony LC
fbb2799050 🔧(git) set LF line endings for all text files
Windows users are by default using CRLF line endings,
which can cause issues with some tools and
environments. This commit sets the `.gitattributes`
file to enforce LF line endings for all text
files in the repository.
2025-06-11 13:08:33 +02:00
Manuel Raynaud
afbb4b29dc 🩹(backend) default CORS_ALLOW_ALL_ORIGINS to False
The settings CORS_ALLOW_ALL_ORIGINS was set to True by default.

This error is inherited from a old mistake made back in the days while
working on the initial impress demo.

This is not something we want, this should be only allowed in
development. We change the value in all the manifests in order to have
the desired behavior in non development environments.
2025-06-11 09:55:28 +00:00
Anthony LC
db63ebd0c8 🐛(frontend) fix meta title
The meta title was flickering, it was adding the
doc title, then it was coming back to the default
title.
This was due to the way the next Head component
render data.
We now use a more stable way to set the title.
2025-06-11 10:21:53 +02:00