Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
codeforlife = "==0.36.1"
codeforlife = "==0.37.0"
# codeforlife = {file = "../../backend/package", editable = true}
# codeforlife = {ref = "BRANCH_NAME_OR_COMMIT_SHA", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
django-reverse-js = "==0.1.8"
Expand All @@ -13,15 +13,15 @@ pyhamcrest = "==2.0.2"

[dev-packages]
black = "*"
codeforlife-portal = "==8.14.3"
codeforlife-portal = "==8.15.0"
# codeforlife-portal = {file = "../portal", editable = true}
#codeforlife-portal = {ref = "BRANCH_NAME_OR_COMMIT_SHA", git = "https://github.com/ocadotechnology/codeforlife-portal.git"}
# codeforlife-portal = {ref = "BRANCH_NAME_OR_COMMIT_SHA", git = "https://github.com/ocadotechnology/rapid-router.git"}
django-extensions = "==4.1"
django-selenium-clean = "==1.0.1"
django-test-migrations = "==1.4.0"
importlib-metadata = "<5" # Using version 5 causes an issue when trying to run pytest. Not sure why, linked to: https://stackoverflow.com/questions/73929564/entrypoints-object-has-no-attribute-get-digital-ocean
isort = "*"
pyOpenSSL = "==26.0.0"
pyOpenSSL = "==26.2.0"
pytest = "==8.*"
pytest-cov = "*"
pytest-django = "==4.8.0"
Expand Down
536 changes: 268 additions & 268 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion game/end_to_end_tests/base_game_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def login_once(self):
login_page.login(email, password)
email = email
BaseGameTest.user_profile = UserProfile.objects.get(
user___email_plain=email
user___email_hash__sha256=email
)

BaseGameTest.already_logged_on = True
Expand Down
2,088 changes: 1,021 additions & 1,067 deletions game/fixtures/game.json

Large diffs are not rendered by default.

37 changes: 2 additions & 35 deletions game/migrations/0006_client_side_encryption_part_1.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
from codeforlife.models.fields import (
EncryptedTextField,
Sha256Field,
)
from django.db import migrations, models
from codeforlife.models.fields import EncryptedTextField, Sha256Field
from django.db import migrations

level_migrations = [
# TODO: add these checks once all data is encrypted.
# migrations.AddConstraint(
# model_name="level",
# constraint=models.CheckConstraint(
# condition=models.Q(
# ("_name_enc__isnull", False), ("default", True), _negated=True
# ),
# name="level__default_name_is_not_encrypted",
# ),
# ),
# migrations.AddConstraint(
# model_name="level",
# constraint=models.CheckConstraint(
# condition=models.Q(
# ("_name_hash__isnull", False), ("default", True), _negated=True
# ),
# name="level__default_name_is_not_hashed",
# ),
# ),
# migrations.AddConstraint(
# model_name="level",
# constraint=models.CheckConstraint(
# condition=models.Q(
# ("_name_plain__isnull", False),
# ("default", False),
# _negated=True,
# ),
# name="level__non_default_name_is_not_plain",
# ),
# ),
# Name
migrations.RenameField(
model_name="level",
Expand Down
175 changes: 175 additions & 0 deletions game/migrations/0007_client_side_encryption_part_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
from codeforlife.models.fields import EncryptedTextField, Sha256Field
from django.db import migrations
from django.db.models import CharField, CheckConstraint, Q, TextField

level_migrations = [
# Name
migrations.AlterField(
model_name="level",
name="_name_plain",
field=CharField(
max_length=100,
db_column="name_plain",
),
),
migrations.AlterField(
model_name="level",
name="_name_enc",
field=EncryptedTextField(
associated_data="name",
verbose_name="name",
db_column="name_enc",
default=b"",
),
preserve_default=False,
),
migrations.AlterField(
model_name="level",
name="_name_hash",
field=Sha256Field(
editable=False,
max_length=64,
verbose_name="name hash",
db_column="name_hash",
default="",
),
preserve_default=False,
),
migrations.AddConstraint(
model_name="level",
constraint=CheckConstraint(
condition=Q(
Q(("_name_plain", ""), ("default", False)),
Q(("_name_enc", b""), ("_name_hash", ""), ("default", True)),
_connector="OR",
),
name="level__name_is_plain_if_default_else_encrypted",
),
),
# Subtitle
migrations.AlterField(
model_name="level",
name="_subtitle_plain",
field=TextField(
max_length=100,
blank=True,
db_column="subtitle_plain",
),
),
migrations.AlterField(
model_name="level",
name="_subtitle_enc",
field=EncryptedTextField(
associated_data="subtitle",
verbose_name="subtitle",
db_column="subtitle_enc",
default=b"",
),
preserve_default=False,
),
migrations.AddConstraint(
model_name="level",
constraint=CheckConstraint(
condition=Q(
Q(("_subtitle_plain", ""), ("default", False)),
Q(("_subtitle_enc", b""), ("default", True)),
_connector="OR",
),
name="level__subtitle_is_plain_if_default_else_encrypted",
),
),
# Lesson
migrations.AlterField(
model_name="level",
name="_lesson_plain",
field=TextField(
max_length=10000,
db_column="lesson_plain",
),
),
migrations.AlterField(
model_name="level",
name="_lesson_enc",
field=EncryptedTextField(
associated_data="lesson",
verbose_name="lesson",
db_column="lesson_enc",
default=b"",
),
preserve_default=False,
),
migrations.AddConstraint(
model_name="level",
constraint=CheckConstraint(
condition=Q(
Q(("_lesson_plain", ""), ("default", False)),
Q(("_lesson_enc", b""), ("default", True)),
_connector="OR",
),
name="level__lesson_is_plain_if_default_else_encrypted",
),
),
# Hint
migrations.AlterField(
model_name="level",
name="_hint_plain",
field=TextField(
max_length=10000,
db_column="hint_plain",
),
),
migrations.AlterField(
model_name="level",
name="_hint_enc",
field=EncryptedTextField(
associated_data="hint",
verbose_name="hint",
db_column="hint_enc",
default=b"",
),
preserve_default=False,
),
migrations.AddConstraint(
model_name="level",
constraint=CheckConstraint(
condition=Q(
Q(("_hint_plain", ""), ("default", False)),
Q(("_hint_enc", b""), ("default", True)),
_connector="OR",
),
name="level__hint_is_plain_if_default_else_encrypted",
),
),
]

workspace_migrations = [
# Name
migrations.RemoveField(
model_name="workspace",
name="_name_plain",
),
migrations.AlterField(
model_name="workspace",
name="_name_enc",
field=EncryptedTextField(
associated_data="name",
verbose_name="name",
db_column="name_enc",
default=b"",
),
preserve_default=False,
),
]


class Migration(migrations.Migration):

dependencies = [
("game", "0006_client_side_encryption_part_1"),
("user", "0006_client_side_encryption_part_4"),
]

operations = [
*level_migrations,
*workspace_migrations,
]
Loading
Loading