Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(backend:config): stop shipping default deployment secrets

johavena654376cbc8a
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ce1745c3..23c026fc 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -27,4 +27,8 @@ jobs:
sed -i "s|dataPath: /home/|dataPath: /tmp/|" environment/environment.yaml
- name: Run unit tests
+ env:
+ SYNCIN_AUTH_ENCRYPTIONKEY: ci-encryption-key
+ SYNCIN_AUTH_TOKEN_ACCESS_SECRET: ci-access-secret
+ SYNCIN_AUTH_TOKEN_REFRESH_SECRET: ci-refresh-secret
run: npm run test
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 78e6f71e..d387eeea 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -88,6 +88,7 @@ cp environment/environment.dist.yaml environment/environment.yaml
```
> [!CAUTION]
+> Set `auth.token.access.secret` and `auth.token.refresh.secret` to distinct, long, randomly generated values.
> The `mysql.url` in the `environment.yaml` should match the mariadb credentials and
> the `applications.files.dataPath` path should be writable.
diff --git a/docker/config/eurooffice/docker-compose.eurooffice.yaml b/docker/config/eurooffice/docker-compose.eurooffice.yaml
index aedba46d..93266fce 100644
--- a/docker/config/eurooffice/docker-compose.eurooffice.yaml
+++ b/docker/config/eurooffice/docker-compose.eurooffice.yaml
@@ -4,7 +4,8 @@ services:
container_name: eurooffice
restart: always
environment:
- - JWT_SECRET=euroOfficeSecret
+ # Must match applications.files.editors.eurooffice.secret in environment.yaml.
+ - JWT_SECRET=
- JWT_IN_BODY=true
- USE_UNAUTHORIZED_STORAGE=true
logging:
@@ -13,4 +14,4 @@ services:
max-size: "25m"
max-file: "5"
networks:
- - sync_in_network
\ No newline at end of file
+ - sync_in_network
diff --git a/docker/config/onlyoffice/docker-compose.onlyoffice.yaml b/docker/config/onlyoffice/docker-compose.onlyoffice.yaml
index 03f63880..bfd16642 100644
--- a/docker/config/onlyoffice/docker-compose.onlyoffice.yaml
+++ b/docker/config/onlyoffice/docker-compose.onlyoffice.yaml
@@ -4,7 +4,8 @@ services:
container_name: onlyoffice
restart: always
environment:
- - JWT_SECRET=onlyOfficeSecret
+ # Must match applications.files.editors.onlyoffice.secret in environment.yaml.
+ - JWT_SECRET=
- JWT_IN_BODY=true
- USE_UNAUTHORIZED_STORAGE=true
logging:
@@ -13,4 +14,4 @@ services:
max-size: "25m"
max-file: "5"
networks:
- - sync_in_network
\ No newline at end of file
+ - sync_in_network
diff --git a/docker/environment.yaml b/docker/environment.yaml
old mode 100755
new mode 100644
index c317a1ad..3bd573ec
--- a/docker/environment.yaml
+++ b/docker/environment.yaml
@@ -1,12 +1,17 @@
mysql:
url: 'mysql://root:MySQLRootPassword@mariadb:3306/sync_in'
auth:
- encryptionKey: 'changeEncryptionKeyWithStrongKey'
+ # Key used to encrypt MFA secrets at rest.
+ # Optional but strongly recommended.
+ # Use a long, randomly generated value and do not change it after enabling MFA.
+ encryptionKey:
token:
access:
- secret: 'changeAccessWithStrongSecret'
+ # Required. Use a long, randomly generated secret.
+ secret:
refresh:
- secret: 'changeRefreshWithStrongSecret'
+ # Required. Use a different long, randomly generated secret.
+ secret:
applications:
files:
dataPath: /app/data
@@ -15,7 +20,9 @@ applications:
enabled: false
onlyoffice:
enabled: false
- secret: 'onlyOfficeSecret'
+ # Required when enabled. Must match JWT_SECRET in the OnlyOffice container.
+ secret:
eurooffice:
enabled: false
- secret: 'euroOfficeSecret'
+ # Required when enabled. Must match JWT_SECRET in the Euro-Office container.
+ secret:
diff --git a/environment/environment.dist.min.yaml b/environment/environment.dist.min.yaml
index 0680e459..0bc2dea8 100644
--- a/environment/environment.dist.min.yaml
+++ b/environment/environment.dist.min.yaml
@@ -1,12 +1,17 @@
mysql:
url: 'mysql://user:MySQLPassword@localhost:3306/database'
auth:
- encryptionKey: 'changeEncryptionKeyWithStrongKey'
+ # Key used to encrypt MFA secrets at rest.
+ # Optional but strongly recommended.
+ # Use a long, randomly generated value and do not change it after enabling MFA.
+ encryptionKey:
token:
access:
- secret: 'changeAccessWithStrongSecret'
+ # Required. Use a long, randomly generated secret.
+ secret:
refresh:
- secret: 'changeRefreshWithStrongSecret'
+ # Required. Use a different long, randomly generated secret.
+ secret:
applications:
files:
dataPath: /home/sync-in/data
diff --git a/environment/environment.dist.yaml b/environment/environment.dist.yaml
old mode 100755
new mode 100644
index c2ec8f55..af42ed6c
--- a/environment/environment.dist.yaml
+++ b/environment/environment.dist.yaml
@@ -87,7 +87,7 @@ auth:
# Key used to encrypt user secret keys in the database
# Optional but strongly recommended
# Warning: do not change or remove the encryption key after MFA activation, or the codes will become invalid
- encryptionKey: 'changeEncryptionKeyWithStrongKey'
+ encryptionKey:
# cookie sameSite setting: `lax` | `strict`
# default: `strict`
cookieSameSite: strict
@@ -95,14 +95,14 @@ auth:
access:
# Used for token and cookie signatures
# required
- secret: 'changeAccessWithStrongSecret'
+ secret:
# token expiration = cookie maxAge
# default: `30m`
expiration: 30m
refresh:
# Used for token and cookie signatures
# required
- secret: 'changeRefreshWithStrongSecret'
+ secret:
# token expiration = cookie maxAge
# default: `4h`
expiration: 4h
@@ -382,7 +382,7 @@ applications:
enabled: false
# Secret used for jwt tokens, it must be the same on the onlyoffice server
# required
- secret: 'onlyOfficeSecret'
+ secret:
# If no external server is configured, the local Nginx service from the Docker Compose setup is used.
# If an external server is configured, it will be used instead.
# Note: when using an external server (e.g.: https://onlyoffice.domain.com), make sure it is accessible from the client/browser.
@@ -397,7 +397,7 @@ applications:
enabled: false
# Secret used for jwt tokens, it must be the same on the Euro-Office server
# required
- secret: 'euroOfficeSecret'
+ secret:
# If an external server is configured, it will be used.
# Note: make sure it is accessible from the client/browser.
# default: null