Skip to content

Commit 7833945

Browse files
committed
Add encryption functionality
1 parent d64aeb4 commit 7833945

29 files changed

+829
-10
lines changed

.github/workflows/tests.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ jobs:
7171
- name: Build assets
7272
run: npm run build
7373

74+
- name: Generate encryption keys
75+
run: bin/console encryption:generate-keys
76+
7477
- name: Create database schema
7578
run: bin/console --env=test doctrine:schema:create
7679

@@ -124,6 +127,9 @@ jobs:
124127
id: install
125128
run: composer install --ansi --no-interaction --no-progress
126129

130+
- name: Generate encryption keys
131+
run: bin/console encryption:generate-keys
132+
127133
- name: Validate mapping
128134
run: bin/console doctrine:schema:validate --skip-sync --no-interaction -vvv
129135

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.env
22
/compose.override.yaml
33
/config/dirigent.yaml
4+
/config/encryption/
45
/config/packages/dirigent.yaml
56
/storage/
67

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ RUN set -e; \
6161
php83-phar \
6262
php83-session \
6363
php83-simplexml \
64+
php83-sodium \
6465
php83-tokenizer \
6566
php83-xml \
6667
postgresql \

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"ext-ctype": "*",
1212
"ext-curl": "*",
1313
"ext-iconv": "*",
14+
"ext-sodium": "*",
1415
"cebe/markdown": "^1.2",
1516
"composer/composer": "^2.7",
1617
"doctrine/doctrine-bundle": "^2.11",

composer.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/packages/doctrine.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ doctrine:
88

99
profiling_collect_backtrace: '%kernel.debug%'
1010
use_savepoints: true
11+
12+
types:
13+
encrypted_text: CodedMonkey\Dirigent\Doctrine\Type\EncryptedTextType
1114
orm:
1215
auto_generate_proxy_classes: true
1316
enable_lazy_ghost_objects: true

config/packages/doctrine_migrations.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ doctrine_migrations:
44
# as migrations classes should NOT be autoloaded
55
'DoctrineMigrations': '%kernel.project_dir%/migrations'
66
enable_profiler: false
7+
services:
8+
'Doctrine\Migrations\Version\MigrationFactory': CodedMonkey\Dirigent\Doctrine\MigrationFactory

config/services.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ services:
3131
public: true
3232
arguments:
3333
-
34+
'encryption:generate-keys': '@CodedMonkey\Dirigent\Command\EncryptionGenerateKeysCommand'
3435
'packages:update': '@CodedMonkey\Dirigent\Command\PackagesUpdateCommand'

docker/config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
framework:
22
secret: '%env(file:KERNEL_SECRET_FILE)%'
3+
4+
dirigent:
5+
encryption:
6+
private_key: '%env(DECRYPTION_KEY)%'
7+
private_key_path: '%env(DECRYPTION_KEY_FILE)%'
8+
public_key: '%env(ENCRYPTION_KEY)%'
9+
public_key_path: '%env(ENCRYPTION_KEY_FILE)%'

docker/env.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
return [
44
'APP_ENV' => 'prod',
55
'DATABASE_URL' => 'postgresql://dirigent@127.0.0.1:5432/dirigent?serverVersion=16&charset=utf8',
6+
'DECRYPTION_KEY' => '',
7+
'DECRYPTION_KEY_FILE' => '/srv/config/secrets/decryption_key',
68
'DIRIGENT_IMAGE' => '1',
9+
'ENCRYPTION_KEY' => '',
10+
'ENCRYPTION_KEY_FILE' => '/srv/config/secrets/encryption_key',
711
'GITHUB_TOKEN' => '',
812
'KERNEL_SECRET_FILE' => '/srv/config/secrets/kernel_secret',
913
'MAILER_DSN' => 'null://null',

0 commit comments

Comments
 (0)