Skip to content

Commit fa31d31

Browse files
committed
🔧(backend) force a valid key for token storage in development mode
Set a valid Ferney for OIDC_STORE_REFRESH_TOKEN_KEY in env.d/development/common Add .gitguardian.yaml configuration to ignore this key. Signed-off-by: Fabre Florian <[email protected]>
1 parent 108b100 commit fa31d31

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

.gitguardian.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
secret:
2+
ignored_matches:
3+
- name:
4+
match: "na1hhus-OLhq9mb9SO3R-8E4dONuMnqpZSY_SX8xcFk="
5+
version: 2

env.d/development/common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ OIDC_STORE_REFRESH_TOKEN = True # Store the encrypted refresh token in the sessi
5555

5656
# Must be a valid Fernet key (32 url-safe base64-encoded bytes)
5757
# To create one, use the bin/fernetkey command.
58-
# OIDC_STORE_REFRESH_TOKEN_KEY="your-32-byte-encryption-key=="
58+
OIDC_STORE_REFRESH_TOKEN_KEY = "na1hhus-OLhq9mb9SO3R-8E4dONuMnqpZSY_SX8xcFk="
5959

6060
# AI
6161
AI_FEATURE_ENABLED=true

src/backend/impress/settings.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import sentry_sdk
2020
from configurations import Configuration, values
21-
from cryptography.fernet import Fernet
2221
from csp.constants import NONE
2322
from lasuite.configuration.values import SecretFileValue
2423
from sentry_sdk.integrations.django import DjangoIntegration
@@ -945,14 +944,6 @@ class Development(Base):
945944
},
946945
}
947946

948-
# There is no key for token storage in default configuration.
949-
# In development environment we can create one if needed.
950-
OIDC_STORE_REFRESH_TOKEN_KEY = values.Value(
951-
default=Fernet.generate_key().decode(),
952-
environ_name="OIDC_STORE_REFRESH_TOKEN_KEY",
953-
environ_prefix=None,
954-
)
955-
956947
def __init__(self):
957948
# pylint: disable=invalid-name
958949
self.INSTALLED_APPS += ["django_extensions", "drf_spectacular_sidecar"]

0 commit comments

Comments
 (0)