From a12dbb0972ffa57a93459c423a9a239c46f79c93 Mon Sep 17 00:00:00 2001 From: valyo <582646+valyo@users.noreply.github.com> Date: Wed, 25 Sep 2024 12:13:01 +0200 Subject: [PATCH 001/125] bump actions/checkout to v4 --- .github/workflows/trivy-scan-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trivy-scan-branch.yml b/.github/workflows/trivy-scan-branch.yml index e17032ce5..2597ea7f5 100644 --- a/.github/workflows/trivy-scan-branch.yml +++ b/.github/workflows/trivy-scan-branch.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master From 2e2e00d8d0b11c0975b9cec957f0dcc06451c611 Mon Sep 17 00:00:00 2001 From: valyo <582646+valyo@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:39:22 +0200 Subject: [PATCH 002/125] add sprintlog --- SPRINTLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index c8c7c7d62..afbaaf5ca 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -430,3 +430,7 @@ _Nothing merged during this sprint_ - Flask command to update unit quotas ([#1551](https://github.com/ScilifelabDataCentre/dds_web/pull/1551)) - Bump python base image to 3.12 and related libraries in both web and client([#1548](https://github.com/ScilifelabDataCentre/dds_web/pull/1548)) + +# 2024-09-23 - 2024-10-04 + +- Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) From 0b9992e7345af2e8a7061b6974a0873f142409be Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 11 Oct 2024 12:32:50 +0200 Subject: [PATCH 003/125] change recipient in warning level --- dds_web/commands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dds_web/commands.py b/dds_web/commands.py index a290cd7cc..9c023d77a 100644 --- a/dds_web/commands.py +++ b/dds_web/commands.py @@ -1247,7 +1247,7 @@ def monitor_usage(): import dds_web.utils # Email settings - recipient: str = flask.current_app.config.get("MAIL_DDS") + # recipient: str = flask.current_app.config.get("MAIL_DDS") default_subject: str = "DDS: Usage quota warning!" # Run task @@ -1282,6 +1282,7 @@ def monitor_usage(): # Email if the unit is using more if perc_used_decimal > warn_after: + recipient: str = unit.email # Email settings message: str = ( "A SciLifeLab Unit is approaching the allocated data quota.\n" From fb39bd9a3ee906b30f89f4e2fad74787173014f2 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 11 Oct 2024 12:53:48 +0200 Subject: [PATCH 004/125] updated technical overview --- doc/technical-overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/technical-overview.md b/doc/technical-overview.md index d37040fb7..d2693e2f4 100644 --- a/doc/technical-overview.md +++ b/doc/technical-overview.md @@ -177,7 +177,7 @@ production instance, and should be collected from the agreements or additional c | Days in Available | The number of days during which the data will be available for download by the Researchers. The countdown starts when the project is released. There is no time limit when the project is In Progress and the project has not been released. For more information on the project statuses and what actions can be performed during them, see the appendix ([Project Statuses](#b-project-statuses)). After Days in Available (DiA) number of days has passed, the project is automatically set as Expired. | | Days in Expired | The number of days (after being available) during which the data is still stored but not available for download. During this time, the project can be renewed, leading to the project being available again and therefore allowing for downloads again. When the Days in Expired (DiE) number of days has passed, the project is automatically archived by the system. | | Quota | The amount of storage space made available for a particular unit. This information should be included in the service agreement. Another value cannot be chosen by the Data Centre or by the unit. | -| Warning level | When a unit has used this percentage of it’s available storage space, an alert is triggered and sent to [delivery@scilifelab.se](mailto:delivery@scilifelab.se). In the event of an alert, the Data Centre contacts the unit to discuss whether or not the quota is sufficient. If not, the service agreement will need to be updated and the quota increased in both the database and at Safespring's S3 storage, for that specific Safespring project. | +| Warning level | When a unit has used this percentage of it’s available storage space, an alert is triggered and sent to the contact email within the unit. In the event of an alert, the unit affected should contact the Data Centre to discuss whether or not the quota is sufficient. If not, the service agreement will need to be updated and the quota increased in both the database and at Safespring's S3 storage, for that specific Safespring project. | : Parameters used to configure a Unit within DDS The unit also must provide the email addresses of at least two (but preferably three or more) From 6ad37e91c9cd5296970a00eb5ec3abb83fd24fb7 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 11 Oct 2024 12:55:17 +0200 Subject: [PATCH 005/125] correct email --- dds_web/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/commands.py b/dds_web/commands.py index 9c023d77a..8499f52fe 100644 --- a/dds_web/commands.py +++ b/dds_web/commands.py @@ -1282,7 +1282,7 @@ def monitor_usage(): # Email if the unit is using more if perc_used_decimal > warn_after: - recipient: str = unit.email + recipient: str = unit.contact_email # Email settings message: str = ( "A SciLifeLab Unit is approaching the allocated data quota.\n" From 34a964edca76c7db0cd2dec4fd4a2881322c8326 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 16 Oct 2024 15:46:15 +0200 Subject: [PATCH 006/125] modify test for warning to check correct recipient --- tests/test_commands.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index 1450c7c8a..d3bfbd07d 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1432,19 +1432,22 @@ def test_monitor_usage_warning_sent(client, cli_runner, capfd: LogCaptureFixture # Mock the size property of the Unit table with patch("dds_web.database.models.Unit.size", new_callable=PropertyMock) as mock_size: mock_size.return_value = 0.9 * quota_in_test - # Mock emails - only check if function call - with patch.object(flask_mail.Mail, "send") as mock_mail_send: + + with mail.record_messages() as outbox: # Run command _: click.testing.Result = cli_runner.invoke(monitor_usage) - # Verify no email has been sent and stoud contains logging info - assert mock_mail_send.call_count == 2 # 2 because client and cli_runner both run + # capture output + _, err = capfd.readouterr() - _, err = capfd.readouterr() - for unit in models.Unit.query.all(): - assert ( - f"A SciLifeLab Unit is approaching the allocated data quota.\nAffected unit: {unit.name}\n" - in err - ) + i = 0 + for unit in models.Unit.query.all(): + # Verify email has been sent to the correct recipient + assert outbox[i].recipients[0] == unit.contact_email + assert ( + f"A SciLifeLab Unit is approaching the allocated data quota.\nAffected unit: {unit.name}\n" + in err + ) + i += 1 # set_available_to_expired From cbac005c966f78fea557b7181e951541f91dd6c8 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 16 Oct 2024 15:46:30 +0200 Subject: [PATCH 007/125] send email to correct recipient --- dds_web/commands.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dds_web/commands.py b/dds_web/commands.py index 8499f52fe..aa028e6d2 100644 --- a/dds_web/commands.py +++ b/dds_web/commands.py @@ -1247,7 +1247,6 @@ def monitor_usage(): import dds_web.utils # Email settings - # recipient: str = flask.current_app.config.get("MAIL_DDS") default_subject: str = "DDS: Usage quota warning!" # Run task @@ -1282,8 +1281,8 @@ def monitor_usage(): # Email if the unit is using more if perc_used_decimal > warn_after: - recipient: str = unit.contact_email # Email settings + recipient: str = unit.contact_email message: str = ( "A SciLifeLab Unit is approaching the allocated data quota.\n" f"Affected unit: {unit.name}\n" From 2af8de16aacfe532f407023a8e3be9ee17112dc3 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 16 Oct 2024 15:47:54 +0200 Subject: [PATCH 008/125] sprintlog --- SPRINTLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index c955ccfc6..d21593819 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -440,3 +440,4 @@ _Nothing merged during this sprint_ - Update readme: backend image is published to GHCR, not DockerHub ([#1558](https://github.com/ScilifelabDataCentre/dds_web/pull/1558)) - Workflow bug fixed: PDFs (Technical Overview and Troubleshooting) were downloaded to incorrect directory([#1559](https://github.com/ScilifelabDataCentre/dds_web/pull/1559)) +- Modify the monitor usage command to send warning to the affected unit instead of Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From 18b1a1a597199b77fe87e5d90d2b893c7d36ea7e Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 17 Oct 2024 11:36:09 +0200 Subject: [PATCH 009/125] updated sprintlog --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index c9e87bb3b..010b3e954 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -440,6 +440,6 @@ _Nothing merged during this sprint_ - Update readme: backend image is published to GHCR, not DockerHub ([#1558](https://github.com/ScilifelabDataCentre/dds_web/pull/1558)) - Workflow bug fixed: PDFs (Technical Overview and Troubleshooting) were downloaded to incorrect directory([#1559](https://github.com/ScilifelabDataCentre/dds_web/pull/1559)) -- Modify the monitor usage command to send warning to the affected unit instead of Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) - Update trivy action and add a second mirror repository to reduce TOO MANY REQUEST issue([#1560](https://github.com/ScilifelabDataCentre/dds_web/pull/1560)) - Modify the invoicing commands to send the instance name in the emails([#1561](https://github.com/ScilifelabDataCentre/dds_web/pull/1561)) +- Modify the monitor usage command to send warning to the affected unit instead of Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From 0422e341e030d4e8124fc645294fbdf6151e3136 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 18 Oct 2024 11:25:57 +0200 Subject: [PATCH 010/125] modified monitor usage --- dds_web/commands.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dds_web/commands.py b/dds_web/commands.py index c40b0fdb5..95a33fe73 100644 --- a/dds_web/commands.py +++ b/dds_web/commands.py @@ -1269,6 +1269,7 @@ def monitor_usage(): import dds_web.utils # Email settings + dds_contact: str = flask.current_app.config.get("MAIL_DDS") default_subject: str = "DDS: Usage quota warning!" # Run task @@ -1304,16 +1305,16 @@ def monitor_usage(): # Email if the unit is using more if perc_used_decimal > warn_after: # Email settings - recipient: str = unit.contact_email + unit_contact: str = unit.contact_email message: str = ( - "A SciLifeLab Unit is approaching the allocated data quota.\n" - f"Affected unit: {unit.name}\n" + "Your unit is approaching the allocated data quota.\n" + f"Unit name: {unit.name}\n" f"{info_string}" ) flask.current_app.logger.info(message) msg: flask_mail.Message = flask_mail.Message( subject=default_subject, - recipients=[recipient], + recipients=[unit_contact,dds_contact], body=message, ) dds_web.utils.send_email_with_retry(msg=msg) From 3d51dea2b048fbc7e9a82f789db4439d007bf756 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 18 Oct 2024 11:29:09 +0200 Subject: [PATCH 011/125] =?UTF-8?q?adapt=20tests=C3=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index 366cd9669..1298f01b1 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1444,7 +1444,7 @@ def test_monitor_usage_warning_sent(client, cli_runner, capfd: LogCaptureFixture # Verify email has been sent to the correct recipient assert outbox[i].recipients[0] == unit.contact_email assert ( - f"A SciLifeLab Unit is approaching the allocated data quota.\nAffected unit: {unit.name}\n" + f"Your unit is approaching the allocated data quota.\nUnit name: {unit.name}\n" in err ) i += 1 From 488fbcab1673a9b242e74a3dff0461c3ec1d81a0 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 18 Oct 2024 11:50:08 +0200 Subject: [PATCH 012/125] black linter --- dds_web/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/commands.py b/dds_web/commands.py index 95a33fe73..c247e832f 100644 --- a/dds_web/commands.py +++ b/dds_web/commands.py @@ -1314,7 +1314,7 @@ def monitor_usage(): flask.current_app.logger.info(message) msg: flask_mail.Message = flask_mail.Message( subject=default_subject, - recipients=[unit_contact,dds_contact], + recipients=[unit_contact, dds_contact], body=message, ) dds_web.utils.send_email_with_retry(msg=msg) From 0c14f3c7eb5595aa08ca21ef5b6b6a71f5e16283 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 22 Oct 2024 15:34:10 +0200 Subject: [PATCH 013/125] check for the second recipient in test --- tests/test_commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_commands.py b/tests/test_commands.py index 1298f01b1..040fe45d2 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1443,6 +1443,7 @@ def test_monitor_usage_warning_sent(client, cli_runner, capfd: LogCaptureFixture for unit in models.Unit.query.all(): # Verify email has been sent to the correct recipient assert outbox[i].recipients[0] == unit.contact_email + assert outbox[i].recipients[1] == "support@example.com" assert ( f"Your unit is approaching the allocated data quota.\nUnit name: {unit.name}\n" in err From ae0a96dc5a9c4c4ce406504ff5d11e3f71861386 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 22 Oct 2024 15:39:49 +0200 Subject: [PATCH 014/125] fix emails --- tests/test_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index 040fe45d2..2e9b8053b 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1443,7 +1443,7 @@ def test_monitor_usage_warning_sent(client, cli_runner, capfd: LogCaptureFixture for unit in models.Unit.query.all(): # Verify email has been sent to the correct recipient assert outbox[i].recipients[0] == unit.contact_email - assert outbox[i].recipients[1] == "support@example.com" + assert outbox[i].recipients[1] == "delivery@scilifelab.se" assert ( f"Your unit is approaching the allocated data quota.\nUnit name: {unit.name}\n" in err From 805273e1abb4d7fa7e6bfebfca5f04103d222e81 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 22 Oct 2024 15:41:13 +0200 Subject: [PATCH 015/125] spritnlog --- SPRINTLOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 1b6ffee38..c6e7e35f3 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -445,4 +445,3 @@ _Nothing merged during this sprint_ - Modify the monitor usage command to send warning to the affected unit instead of Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) - Fix the MOTD endpoint according to post merge review([#1564](https://github.com/ScilifelabDataCentre/dds_web/pull/1564)) - New version & changelog([#1565](https://github.com/ScilifelabDataCentre/dds_web/pull/1565)) - From 5ec77b2858ce9bdcc1eb2b79af2fdbbf0a2ee005 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 23 Oct 2024 11:44:33 +0200 Subject: [PATCH 016/125] move entry to current sprint --- SPRINTLOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index c6e7e35f3..571c5959e 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -442,6 +442,9 @@ _Nothing merged during this sprint_ - Workflow bug fixed: PDFs (Technical Overview and Troubleshooting) were downloaded to incorrect directory([#1559](https://github.com/ScilifelabDataCentre/dds_web/pull/1559)) - Update trivy action and add a second mirror repository to reduce TOO MANY REQUEST issue([#1560](https://github.com/ScilifelabDataCentre/dds_web/pull/1560)) - Modify the invoicing commands to send the instance name in the emails([#1561](https://github.com/ScilifelabDataCentre/dds_web/pull/1561)) -- Modify the monitor usage command to send warning to the affected unit instead of Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) - Fix the MOTD endpoint according to post merge review([#1564](https://github.com/ScilifelabDataCentre/dds_web/pull/1564)) - New version & changelog([#1565](https://github.com/ScilifelabDataCentre/dds_web/pull/1565)) + +# 2024-10-23 - 2024-11-01 + +- Modify the monitor usage command to send warning to the affected unit instead of Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From d1081edb82ba3c9b8464f0d4f80f9bf0d0022413 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 23 Oct 2024 11:47:41 +0200 Subject: [PATCH 017/125] update technical overview --- doc/technical-overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/technical-overview.md b/doc/technical-overview.md index d2693e2f4..cf2e5004a 100644 --- a/doc/technical-overview.md +++ b/doc/technical-overview.md @@ -177,7 +177,7 @@ production instance, and should be collected from the agreements or additional c | Days in Available | The number of days during which the data will be available for download by the Researchers. The countdown starts when the project is released. There is no time limit when the project is In Progress and the project has not been released. For more information on the project statuses and what actions can be performed during them, see the appendix ([Project Statuses](#b-project-statuses)). After Days in Available (DiA) number of days has passed, the project is automatically set as Expired. | | Days in Expired | The number of days (after being available) during which the data is still stored but not available for download. During this time, the project can be renewed, leading to the project being available again and therefore allowing for downloads again. When the Days in Expired (DiE) number of days has passed, the project is automatically archived by the system. | | Quota | The amount of storage space made available for a particular unit. This information should be included in the service agreement. Another value cannot be chosen by the Data Centre or by the unit. | -| Warning level | When a unit has used this percentage of it’s available storage space, an alert is triggered and sent to the contact email within the unit. In the event of an alert, the unit affected should contact the Data Centre to discuss whether or not the quota is sufficient. If not, the service agreement will need to be updated and the quota increased in both the database and at Safespring's S3 storage, for that specific Safespring project. | +| Warning level | When a unit has used this percentage of it’s available storage space, an alert is triggered and sent to the contact email within the unit, as well as a to [delivery@scilifelab.se](mailto:delivery@scilifelab.se). In the event of an alert, the unit affected should contact the Data Centre to discuss whether or not the quota is sufficient. If not, the service agreement will need to be updated and the quota increased in both the database and at Safespring's S3 storage, for that specific Safespring project. | : Parameters used to configure a Unit within DDS The unit also must provide the email addresses of at least two (but preferably three or more) From b030727c635fb4baf32c09aab1d93ec4e0bb0a6f Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 24 Oct 2024 09:17:09 +0200 Subject: [PATCH 018/125] typo --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 571c5959e..b2fd1c951 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -447,4 +447,4 @@ _Nothing merged during this sprint_ # 2024-10-23 - 2024-11-01 -- Modify the monitor usage command to send warning to the affected unit instead of Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) +- Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From 2d6abc7ca31fcaae36d7d019ed29eafc0804bfce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 08:59:00 +0200 Subject: [PATCH 019/125] bump python-black checkout version --- .github/workflows/python-black.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-black.yml b/.github/workflows/python-black.yml index 9536d5c96..3e674e485 100644 --- a/.github/workflows/python-black.yml +++ b/.github/workflows/python-black.yml @@ -15,7 +15,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: psf/black@stable with: version: ${{ env.INPUT_VERSION }} From 0eb129b03dcf74cfdf7b2516024900fa84203ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 09:03:05 +0200 Subject: [PATCH 020/125] prettier --- .github/workflows/prettier.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 11177e326..99ad0661c 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -9,9 +9,9 @@ jobs: Prettier: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier From 10a0df24a660346310709073c29a18858fbafa08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 09:04:28 +0200 Subject: [PATCH 021/125] yaml --- .github/workflows/lint-yaml.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-yaml.yml b/.github/workflows/lint-yaml.yml index e7ce78f9b..b64a8820c 100644 --- a/.github/workflows/lint-yaml.yml +++ b/.github/workflows/lint-yaml.yml @@ -13,7 +13,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: yaml-lint uses: ibiqlik/action-yamllint@v3 with: From 84875070e78d812e8cd5bba98a069f1f4605377a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 09:05:40 +0200 Subject: [PATCH 022/125] trivy scan branch bump --- .github/workflows/trivy-scan-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trivy-scan-branch.yml b/.github/workflows/trivy-scan-branch.yml index e17032ce5..2597ea7f5 100644 --- a/.github/workflows/trivy-scan-branch.yml +++ b/.github/workflows/trivy-scan-branch.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master From a77d36477ecfe04ac6490557bbd606971c2972f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 09:13:12 +0200 Subject: [PATCH 023/125] upload sarif snyk --- .github/workflows/snyk-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/snyk-scan.yml b/.github/workflows/snyk-scan.yml index c6c9a48e7..0d1c905fe 100644 --- a/.github/workflows/snyk-scan.yml +++ b/.github/workflows/snyk-scan.yml @@ -30,7 +30,7 @@ jobs: command: code test args: --sarif-file-output=snyk.sarif - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: snyk.sarif category: snyk From 30684d3948a519d982fd8e3992cb8834509a03a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 10:50:35 +0200 Subject: [PATCH 024/125] bump all checkout actions to v4 --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docker-compose-tests.yml | 2 +- .github/workflows/trivy-scheduled-dev.yml | 2 +- .github/workflows/trivy-scheduled-master.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7b2b043b5..6bd457ef8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/docker-compose-tests.yml b/.github/workflows/docker-compose-tests.yml index 8dd1e6c79..76ece1bb5 100644 --- a/.github/workflows/docker-compose-tests.yml +++ b/.github/workflows/docker-compose-tests.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run tests against database container run: docker compose -f docker-compose.yml -f tests/docker-compose-test.yml up --build --exit-code-from backend diff --git a/.github/workflows/trivy-scheduled-dev.yml b/.github/workflows/trivy-scheduled-dev.yml index 7bd34cf9d..00aaafd12 100644 --- a/.github/workflows/trivy-scheduled-dev.yml +++ b/.github/workflows/trivy-scheduled-dev.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Ensure lowercase name run: echo REPOSITORY_OWNER=$(echo ${{ github.repository_owner }} | tr "[:upper:]" "[:lower:]") >> $GITHUB_ENV diff --git a/.github/workflows/trivy-scheduled-master.yml b/.github/workflows/trivy-scheduled-master.yml index e2ef46b86..682a83200 100644 --- a/.github/workflows/trivy-scheduled-master.yml +++ b/.github/workflows/trivy-scheduled-master.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: master From 2dc25e8e55d0d276952a91b4ed8de49960ea8d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 10:56:37 +0200 Subject: [PATCH 025/125] only change checkout versions --- .github/workflows/prettier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 99ad0661c..2cbb09232 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v3 - name: Install Prettier run: npm install -g prettier From 7bbf20ce405c411c4d8e40bc7dc857c65f9a9ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 10:57:39 +0200 Subject: [PATCH 026/125] only change checkout versions --- .github/workflows/publish_and_trivyscan.yml | 2 +- .github/workflows/snyk-scan.yml | 2 +- .github/workflows/trivy-scan-branch.yml | 2 +- .github/workflows/trivy-scheduled-dev.yml | 2 +- .github/workflows/trivy-scheduled-master.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish_and_trivyscan.yml b/.github/workflows/publish_and_trivyscan.yml index f250b7fba..b81a31092 100644 --- a/.github/workflows/publish_and_trivyscan.yml +++ b/.github/workflows/publish_and_trivyscan.yml @@ -127,7 +127,7 @@ jobs: output: "trivy-results.sarif" severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to Github Security tab - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: "trivy-results.sarif" category: trivy-build diff --git a/.github/workflows/snyk-scan.yml b/.github/workflows/snyk-scan.yml index 0d1c905fe..c6c9a48e7 100644 --- a/.github/workflows/snyk-scan.yml +++ b/.github/workflows/snyk-scan.yml @@ -30,7 +30,7 @@ jobs: command: code test args: --sarif-file-output=snyk.sarif - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: snyk.sarif category: snyk diff --git a/.github/workflows/trivy-scan-branch.yml b/.github/workflows/trivy-scan-branch.yml index 2597ea7f5..25dbee8f9 100644 --- a/.github/workflows/trivy-scan-branch.yml +++ b/.github/workflows/trivy-scan-branch.yml @@ -31,7 +31,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: "trivy-results.sarif" category: trivy diff --git a/.github/workflows/trivy-scheduled-dev.yml b/.github/workflows/trivy-scheduled-dev.yml index 00aaafd12..338e924fe 100644 --- a/.github/workflows/trivy-scheduled-dev.yml +++ b/.github/workflows/trivy-scheduled-dev.yml @@ -33,7 +33,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to dev branch GitHub Security tab - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: "trivy-results-dev.sarif" category: trivy-dev diff --git a/.github/workflows/trivy-scheduled-master.yml b/.github/workflows/trivy-scheduled-master.yml index 682a83200..374bfe394 100644 --- a/.github/workflows/trivy-scheduled-master.yml +++ b/.github/workflows/trivy-scheduled-master.yml @@ -35,7 +35,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to master branch GitHub Security tab - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: "trivy-results-master.sarif" category: trivy-master From 68829a61b94d8ff173be24b89b055a1d39c651dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 10:58:09 +0200 Subject: [PATCH 027/125] only change checkout versions --- .github/workflows/publish_and_trivyscan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_and_trivyscan.yml b/.github/workflows/publish_and_trivyscan.yml index b81a31092..f250b7fba 100644 --- a/.github/workflows/publish_and_trivyscan.yml +++ b/.github/workflows/publish_and_trivyscan.yml @@ -127,7 +127,7 @@ jobs: output: "trivy-results.sarif" severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to Github Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: "trivy-results.sarif" category: trivy-build From f443da96b1f88020945b85a88eab79489953a35e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 10:59:27 +0200 Subject: [PATCH 028/125] only change checkout versions --- .github/workflows/trivy-scan-branch.yml | 2 +- .github/workflows/trivy-scheduled-dev.yml | 2 +- .github/workflows/trivy-scheduled-master.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/trivy-scan-branch.yml b/.github/workflows/trivy-scan-branch.yml index 25dbee8f9..2597ea7f5 100644 --- a/.github/workflows/trivy-scan-branch.yml +++ b/.github/workflows/trivy-scan-branch.yml @@ -31,7 +31,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: "trivy-results.sarif" category: trivy diff --git a/.github/workflows/trivy-scheduled-dev.yml b/.github/workflows/trivy-scheduled-dev.yml index 338e924fe..00aaafd12 100644 --- a/.github/workflows/trivy-scheduled-dev.yml +++ b/.github/workflows/trivy-scheduled-dev.yml @@ -33,7 +33,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to dev branch GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: "trivy-results-dev.sarif" category: trivy-dev diff --git a/.github/workflows/trivy-scheduled-master.yml b/.github/workflows/trivy-scheduled-master.yml index 374bfe394..682a83200 100644 --- a/.github/workflows/trivy-scheduled-master.yml +++ b/.github/workflows/trivy-scheduled-master.yml @@ -35,7 +35,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy scan results to master branch GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: "trivy-results-master.sarif" category: trivy-master From c60b5d703c191b3a72b1ecad0d7ccc4174890455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Fri, 25 Oct 2024 11:59:35 +0200 Subject: [PATCH 029/125] redo 1566 --- .github/workflows/codeql-analysis.yml | 6 +++--- SPRINTLOG.md | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6bd457ef8..099bfd758 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -55,7 +55,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -66,7 +66,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -80,4 +80,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/SPRINTLOG.md b/SPRINTLOG.md index ac07167e7..ce6a22536 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -447,4 +447,5 @@ _Nothing merged during this sprint_ # 2024-10-21 - 2024-11-01 -- Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) +- Workflow: Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) +- Workflow: CodeQL action version(s) bumped to v3 ([#1569](https://github.com/ScilifelabDataCentre/dds_web/pull/1569)) From e3d6b245d1ac7dc2de725c46ac631cc2c6b22e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Mon, 28 Oct 2024 11:21:50 +0100 Subject: [PATCH 030/125] setup node to v4 --- .github/workflows/prettier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 2cbb09232..99ad0661c 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier From f3e4cbf01a3d885a8d39260096d211c602a7e53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Mon, 28 Oct 2024 11:51:18 +0100 Subject: [PATCH 031/125] codecov to v4 --- .github/workflows/docker-compose-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-compose-tests.yml b/.github/workflows/docker-compose-tests.yml index 76ece1bb5..3bc8b81b1 100644 --- a/.github/workflows/docker-compose-tests.yml +++ b/.github/workflows/docker-compose-tests.yml @@ -31,7 +31,7 @@ jobs: ## If no one connects after 5 minutes, shut down server. wait-timeout-minutes: 5 - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage/report.xml From 936398379f0f50fc0c13ef7e54ccecd2439b0260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Mon, 28 Oct 2024 11:52:24 +0100 Subject: [PATCH 032/125] codeql upload-sarif to v3 --- .github/workflows/snyk-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/snyk-scan.yml b/.github/workflows/snyk-scan.yml index c6c9a48e7..0d1c905fe 100644 --- a/.github/workflows/snyk-scan.yml +++ b/.github/workflows/snyk-scan.yml @@ -30,7 +30,7 @@ jobs: command: code test args: --sarif-file-output=snyk.sarif - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: snyk.sarif category: snyk From ff2b577979e98dfc8f271b4d47a6119ef030b4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Mon, 28 Oct 2024 11:58:27 +0100 Subject: [PATCH 033/125] sprintlog --- SPRINTLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index ce6a22536..e5316de21 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -449,3 +449,4 @@ _Nothing merged during this sprint_ - Workflow: Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) - Workflow: CodeQL action version(s) bumped to v3 ([#1569](https://github.com/ScilifelabDataCentre/dds_web/pull/1569)) +- Workflow: Setup-node, codecov and upload-sarif action versions bumped to v4, v4 and v3, respectively ([#1570](https://github.com/ScilifelabDataCentre/dds_web/pull/1570)) From f7a9f2898398a0602d20312d6a59abf1fce46bf4 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 30 Oct 2024 15:48:44 +0100 Subject: [PATCH 034/125] catch error to return it manually --- dds_web/api/project.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dds_web/api/project.py b/dds_web/api/project.py index 0ce611cfe..07e403834 100644 --- a/dds_web/api/project.py +++ b/dds_web/api/project.py @@ -595,6 +595,14 @@ def get(self): flask.current_app.logger.debug("Getting the private key.") + try: + private_key = obtain_project_private_key( + user=auth.current_user(), + project=project, + token=dds_web.security.auth.obtain_current_encrypted_token(), + ) + except KeyNotFoundError as err: + return {"status": err.code, "message": err.message}, 500 return flask.jsonify( { "private": obtain_project_private_key( From 73ef0bd4d8306c561fc11dd4022ce80df73bb2cd Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 31 Oct 2024 17:05:52 +0100 Subject: [PATCH 035/125] add Autherization error --- dds_web/api/project.py | 10 +--------- dds_web/utils.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dds_web/api/project.py b/dds_web/api/project.py index 07e403834..d1072949f 100644 --- a/dds_web/api/project.py +++ b/dds_web/api/project.py @@ -592,17 +592,9 @@ def get(self): """Get private key from database.""" # Verify project ID and access project = project_schemas.ProjectRequiredSchema().load(flask.request.args) - + dds_web.utils.verify_project_access(project=project) flask.current_app.logger.debug("Getting the private key.") - try: - private_key = obtain_project_private_key( - user=auth.current_user(), - project=project, - token=dds_web.security.auth.obtain_current_encrypted_token(), - ) - except KeyNotFoundError as err: - return {"status": err.code, "message": err.message}, 500 return flask.jsonify( { "private": obtain_project_private_key( diff --git a/dds_web/utils.py b/dds_web/utils.py index f815df4bf..8b3c58d9a 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -83,6 +83,18 @@ def verify_project_access(project) -> None: username=auth.current_user().username, project=project.public_id, ) + project_key = models.ProjectUserKeys.query.filter_by( + project_id=project.id, user_id=auth.current_user().username + ).first() + if not project_key: + msg = ( + "Probably due to password reset. Please, ask a colleague to run dds project access fix" + ) + raise AccessDeniedError( + message=msg, + username=auth.current_user().username, + project=project.public_id, + ) def verify_cli_version(version_cli: str = None) -> None: From 00212cb3376c6d4a23979c364fcf009282023b12 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 31 Oct 2024 20:43:18 +0100 Subject: [PATCH 036/125] Added as a new function --- dds_web/api/project.py | 2 +- dds_web/utils.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dds_web/api/project.py b/dds_web/api/project.py index d1072949f..9d3530041 100644 --- a/dds_web/api/project.py +++ b/dds_web/api/project.py @@ -592,7 +592,7 @@ def get(self): """Get private key from database.""" # Verify project ID and access project = project_schemas.ProjectRequiredSchema().load(flask.request.args) - dds_web.utils.verify_project_access(project=project) + dds_web.utils.verify_project_user_key(project=project) flask.current_app.logger.debug("Getting the private key.") return flask.jsonify( diff --git a/dds_web/utils.py b/dds_web/utils.py index 8b3c58d9a..3459bb621 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -83,6 +83,10 @@ def verify_project_access(project) -> None: username=auth.current_user().username, project=project.public_id, ) + + +def verify_project_user_key(project) -> None: + """Verify that current authenticated user has a row in projectUserKeys.""" project_key = models.ProjectUserKeys.query.filter_by( project_id=project.id, user_id=auth.current_user().username ).first() From bb9fe2b1344d8efb51786be18385d0f98e9a41d5 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 1 Nov 2024 11:12:46 +0100 Subject: [PATCH 037/125] more explicative error --- dds_web/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dds_web/utils.py b/dds_web/utils.py index 3459bb621..18199236d 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -92,6 +92,7 @@ def verify_project_user_key(project) -> None: ).first() if not project_key: msg = ( + "There is no entry in the projectUserKeys table for the user and project. " "Probably due to password reset. Please, ask a colleague to run dds project access fix" ) raise AccessDeniedError( From 76dc080ad8fd418b0c7f6322cd23292be03ae81d Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 1 Nov 2024 11:14:09 +0100 Subject: [PATCH 038/125] sprintlog --- SPRINTLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index e5316de21..1d262dac5 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -450,3 +450,7 @@ _Nothing merged during this sprint_ - Workflow: Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) - Workflow: CodeQL action version(s) bumped to v3 ([#1569](https://github.com/ScilifelabDataCentre/dds_web/pull/1569)) - Workflow: Setup-node, codecov and upload-sarif action versions bumped to v4, v4 and v3, respectively ([#1570](https://github.com/ScilifelabDataCentre/dds_web/pull/1570)) + +# 2024-11-04 - 2024-11-15 + +- Change the errror when trying to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) From f0e55bf320b1a0ca3287160f0ba40a53e7ff121e Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 1 Nov 2024 11:17:40 +0100 Subject: [PATCH 039/125] prettier --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 9912ec164..0235c719c 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,4 +453,4 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) \ No newline at end of file +- Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From 0f66178fe00ea8e314cf5f6f6d7b02ffb9e4ee0f Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 4 Nov 2024 12:55:15 +0100 Subject: [PATCH 040/125] added testing --- tests/test_utils.py | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 7d70681b5..0e67141e6 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -136,6 +136,58 @@ def test_verify_project_access_ok(client: flask.testing.FlaskClient) -> None: utils.verify_project_access(project=project) +def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> None: + """A user must have an entry in projectUserKeys to access a project.""" + # User + user = models.UnitUser.query.filter_by(unit_id=1).first() + assert user + + # Get project + project = models.Project.query.filter_by(unit_id=1).first() + assert project + + # get projectUserKey + projectUserKey = models.ProjectUserKey.query.filter_by( + project_id=project.id, user_id=user.id + ).one_or_none() + assert projectUserKey + + # delete projectUserKey + db.session.delete(projectUserKey) + db.session.commit() + + # verify no projectUserKey + projectUserKey = models.ProjectUserKey.query.filter_by( + project_id=project.id, user_id=user.id + ).one_or_none() + assert not projectUserKey + + # Set auth.current_user + flask.g.flask_httpauth_user = user + + # Verify project access -- not ok + with pytest.raises(AccessDeniedError) as err: + utils.verify_project_user_key(project=project) + assert "Project access denied" in str(err.value) + + +def test_verify_project_access_ok(client: flask.testing.FlaskClient) -> None: + """A project must have access to the project, otherwise error.""" + # user + user = models.UnitUser.query.filter_by(unit_id=1).first() + assert user + + # Get project + project = models.Project.query.filter_by(unit_id=1).first() + assert project + + # Set auth.current_user + flask.g.flask_httpauth_user = user1 + + # Verify project access -- not ok + utils.verify_project_access(project=project) + + # verify_cli_version From f3700b28732830b2d393881ec6bcee45426f94cc Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 4 Nov 2024 12:59:19 +0100 Subject: [PATCH 041/125] fix typos --- tests/test_utils.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 0e67141e6..9a6ad8f5a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -147,8 +147,8 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No assert project # get projectUserKey - projectUserKey = models.ProjectUserKey.query.filter_by( - project_id=project.id, user_id=user.id + projectUserKey = models.ProjectUserKeys.query.filter_by( + project_id=project.id, user_id=user.username ).one_or_none() assert projectUserKey @@ -157,8 +157,8 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No db.session.commit() # verify no projectUserKey - projectUserKey = models.ProjectUserKey.query.filter_by( - project_id=project.id, user_id=user.id + projectUserKey = models.ProjectUserKeys.query.filter_by( + project_id=project.id, user_id=user.username ).one_or_none() assert not projectUserKey @@ -168,11 +168,13 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No # Verify project access -- not ok with pytest.raises(AccessDeniedError) as err: utils.verify_project_user_key(project=project) - assert "Project access denied" in str(err.value) + assert "There is no entry in the projectUserKeys table for the user and project" in str( + err.value + ) -def test_verify_project_access_ok(client: flask.testing.FlaskClient) -> None: - """A project must have access to the project, otherwise error.""" +def test_verify_project_user_key_ok(client: flask.testing.FlaskClient) -> None: + """A user must have an entry in projectUserKeys to access a project.""" # user user = models.UnitUser.query.filter_by(unit_id=1).first() assert user @@ -182,7 +184,7 @@ def test_verify_project_access_ok(client: flask.testing.FlaskClient) -> None: assert project # Set auth.current_user - flask.g.flask_httpauth_user = user1 + flask.g.flask_httpauth_user = user # Verify project access -- not ok utils.verify_project_access(project=project) From 738db8dfc04c75d7505d9897337c2a436c3a30bb Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 4 Nov 2024 13:00:20 +0100 Subject: [PATCH 042/125] refactor --- dds_web/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/utils.py b/dds_web/utils.py index 18199236d..992ed886b 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -89,7 +89,7 @@ def verify_project_user_key(project) -> None: """Verify that current authenticated user has a row in projectUserKeys.""" project_key = models.ProjectUserKeys.query.filter_by( project_id=project.id, user_id=auth.current_user().username - ).first() + ).one_or_none() if not project_key: msg = ( "There is no entry in the projectUserKeys table for the user and project. " From a778b3cbbca378a15c91a0ec4ac8f66ea0dac18f Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 4 Nov 2024 13:02:50 +0100 Subject: [PATCH 043/125] refactor --- tests/test_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 9a6ad8f5a..5a4264d7c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -183,6 +183,12 @@ def test_verify_project_user_key_ok(client: flask.testing.FlaskClient) -> None: project = models.Project.query.filter_by(unit_id=1).first() assert project + # get projectUserKey + projectUserKey = models.ProjectUserKeys.query.filter_by( + project_id=project.id, user_id=user.username + ).one_or_none() + assert projectUserKey + # Set auth.current_user flask.g.flask_httpauth_user = user From c359828381ee37ff46a6f6689e507c88c44113f1 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 5 Nov 2024 15:28:49 +0100 Subject: [PATCH 044/125] catched invalid token --- dds_web/security/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dds_web/security/auth.py b/dds_web/security/auth.py index 3d00023a6..40ada1d0d 100644 --- a/dds_web/security/auth.py +++ b/dds_web/security/auth.py @@ -14,6 +14,7 @@ import json import jwcrypto from jwcrypto import jwk, jwt +from jwcrypto.jwe import InvalidJWEData import structlog # Own modules @@ -370,7 +371,7 @@ def decrypt_token(token): # Decrypt token try: decrypted_token = jwt.JWT(key=key, jwt=token, expected_type="JWE") - except ValueError as exc: + except (ValueError, InvalidJWEData) as exc: # "Token format unrecognized" raise AuthenticationError(message="Invalid token") from exc From 274ff702a4d8967260267c48850c9bba81332376 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 5 Nov 2024 15:31:53 +0100 Subject: [PATCH 045/125] sprintlog --- SPRINTLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index e5316de21..1e57bff4a 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -450,3 +450,7 @@ _Nothing merged during this sprint_ - Workflow: Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) - Workflow: CodeQL action version(s) bumped to v3 ([#1569](https://github.com/ScilifelabDataCentre/dds_web/pull/1569)) - Workflow: Setup-node, codecov and upload-sarif action versions bumped to v4, v4 and v3, respectively ([#1570](https://github.com/ScilifelabDataCentre/dds_web/pull/1570)) + +# 2024-11-04 - 2024-11-15 + +- Catch error of invalid token to avoid logging an exception in the logs ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) From 2eacf8337a888d9a8c633e544a3910af35d0be4e Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 5 Nov 2024 15:41:39 +0100 Subject: [PATCH 046/125] general exception --- dds_web/security/auth.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dds_web/security/auth.py b/dds_web/security/auth.py index 40ada1d0d..19451e31d 100644 --- a/dds_web/security/auth.py +++ b/dds_web/security/auth.py @@ -371,8 +371,10 @@ def decrypt_token(token): # Decrypt token try: decrypted_token = jwt.JWT(key=key, jwt=token, expected_type="JWE") - except (ValueError, InvalidJWEData) as exc: - # "Token format unrecognized" + except (ValueError, jwcrypto.common.JWException) as exc: + # ValueError is raised when the token doesn't look right (for example no periods) + # jwcryopto.common.JWException is the base exception raised by jwcrypto, + # and is raised when the token is malformed or invalid. raise AuthenticationError(message="Invalid token") from exc return decrypted_token.claims From cf3981b7df067857168d800931d66960f3c8355e Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 5 Nov 2024 15:43:06 +0100 Subject: [PATCH 047/125] ununsed package --- dds_web/security/auth.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dds_web/security/auth.py b/dds_web/security/auth.py index 19451e31d..55af5b102 100644 --- a/dds_web/security/auth.py +++ b/dds_web/security/auth.py @@ -14,7 +14,6 @@ import json import jwcrypto from jwcrypto import jwk, jwt -from jwcrypto.jwe import InvalidJWEData import structlog # Own modules From 197f7ede746fa44d26c840b0af6801a607db77d0 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 5 Nov 2024 15:54:09 +0100 Subject: [PATCH 048/125] sprintlog --- SPRINTLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index e5316de21..434f7ecad 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -450,3 +450,7 @@ _Nothing merged during this sprint_ - Workflow: Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) - Workflow: CodeQL action version(s) bumped to v3 ([#1569](https://github.com/ScilifelabDataCentre/dds_web/pull/1569)) - Workflow: Setup-node, codecov and upload-sarif action versions bumped to v4, v4 and v3, respectively ([#1570](https://github.com/ScilifelabDataCentre/dds_web/pull/1570)) + +# 2024-11-04 - 2024-11-15 + +- TODO ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) From 386e6f08735e7e230c3893d587764286bbccf1e9 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 15:54:31 +0100 Subject: [PATCH 049/125] add filter to exception --- dds_web/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dds_web/__init__.py b/dds_web/__init__.py index fd87c63ca..b227321d8 100644 --- a/dds_web/__init__.py +++ b/dds_web/__init__.py @@ -19,6 +19,7 @@ from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth import flask_mail import flask_login +from flask.logging import logging as flask_logging import flask_migrate @@ -68,6 +69,14 @@ #################################################################################################### +class FilterMaintenanceExc(flask_logging.Filter): + from dds_web.errors import MaintenanceOngoingException + + def filter(record): + # Check if the log record does not have an exception or if the exception is not MaintenanceOngoingException + return record.exc_info is None or record.exc_info[0] != MaintenanceOngoingException + + def setup_logging(app): """Setup loggers""" @@ -164,6 +173,9 @@ def action_wrapper(_, __, event_dict): cache_logger_on_first_use=True, ) + # Add custom filter to the logger + logging.getLogger("general").addFilter(FilterMaintenanceExc) + def create_app(testing=False, database_uri=None): try: From c6e4aeb72c8d7f81e634ee7840e792f8a019c737 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 15:59:56 +0100 Subject: [PATCH 050/125] sprintlog --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 434f7ecad..e6a1f20c1 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,4 +453,4 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- TODO ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) +- Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) From f07b702c400891329f5abac47e85fc4f0a857b4b Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 16:37:35 +0100 Subject: [PATCH 051/125] correct syntax --- dds_web/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dds_web/__init__.py b/dds_web/__init__.py index b227321d8..a00f34ae7 100644 --- a/dds_web/__init__.py +++ b/dds_web/__init__.py @@ -70,9 +70,10 @@ class FilterMaintenanceExc(flask_logging.Filter): - from dds_web.errors import MaintenanceOngoingException def filter(record): + from dds_web.errors import MaintenanceOngoingException + # Check if the log record does not have an exception or if the exception is not MaintenanceOngoingException return record.exc_info is None or record.exc_info[0] != MaintenanceOngoingException From dbb724dae73fa87560ce1d276b461276f1f048e9 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 16:43:01 +0100 Subject: [PATCH 052/125] add documentation --- dds_web/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dds_web/__init__.py b/dds_web/__init__.py index a00f34ae7..76eead1c8 100644 --- a/dds_web/__init__.py +++ b/dds_web/__init__.py @@ -72,6 +72,11 @@ class FilterMaintenanceExc(flask_logging.Filter): def filter(record): + """ + Filters log records to exclude those with MaintenanceOngoingException. + Returns: + bool: True if the log record should be processed, False if it should be filtered out. + """ from dds_web.errors import MaintenanceOngoingException # Check if the log record does not have an exception or if the exception is not MaintenanceOngoingException From 53b65933f3ba70c4fd829e0f0a3f700539c60faa Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 16:54:05 +0100 Subject: [PATCH 053/125] simpler solution --- dds_web/security/auth.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dds_web/security/auth.py b/dds_web/security/auth.py index 55af5b102..44f55f91f 100644 --- a/dds_web/security/auth.py +++ b/dds_web/security/auth.py @@ -278,7 +278,6 @@ def __verify_general_token(token): # ValueError is raised when the token doesn't look right (for example no periods) # jwcryopto.common.JWException is the base exception raised by jwcrypto, # and is raised when the token is malformed or invalid. - flask.current_app.logger.exception(e) raise AuthenticationError(message="Invalid token") from e expiration_time = data.get("exp") @@ -370,10 +369,7 @@ def decrypt_token(token): # Decrypt token try: decrypted_token = jwt.JWT(key=key, jwt=token, expected_type="JWE") - except (ValueError, jwcrypto.common.JWException) as exc: - # ValueError is raised when the token doesn't look right (for example no periods) - # jwcryopto.common.JWException is the base exception raised by jwcrypto, - # and is raised when the token is malformed or invalid. + except ValueError as exc: raise AuthenticationError(message="Invalid token") from exc return decrypted_token.claims From 4a1cef09c2ae708edf6923b0d970d3571cdc31ee Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 17:06:45 +0100 Subject: [PATCH 054/125] log the exp as an error only printing the name for possible debug purposes --- SPRINTLOG.md | 2 +- dds_web/security/auth.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 1e57bff4a..7b7f070ea 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,4 +453,4 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Catch error of invalid token to avoid logging an exception in the logs ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) +- Remove logging of the exception of incorrect token ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) diff --git a/dds_web/security/auth.py b/dds_web/security/auth.py index 44f55f91f..03c4c9ca9 100644 --- a/dds_web/security/auth.py +++ b/dds_web/security/auth.py @@ -278,6 +278,7 @@ def __verify_general_token(token): # ValueError is raised when the token doesn't look right (for example no periods) # jwcryopto.common.JWException is the base exception raised by jwcrypto, # and is raised when the token is malformed or invalid. + flask.current_app.logger.warning(f"Exception Name: {type(e).__name__}") raise AuthenticationError(message="Invalid token") from e expiration_time = data.get("exp") From 1f391570058b5209575daaf9ee893d06b5daf3d3 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 17:07:47 +0100 Subject: [PATCH 055/125] typo --- SPRINTLOG.md | 2 +- dds_web/security/auth.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 7b7f070ea..b9667dd8b 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,4 +453,4 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Remove logging of the exception of incorrect token ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) +- Fix logging of the exception of incorrect token ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) diff --git a/dds_web/security/auth.py b/dds_web/security/auth.py index 03c4c9ca9..efa52bc07 100644 --- a/dds_web/security/auth.py +++ b/dds_web/security/auth.py @@ -371,6 +371,7 @@ def decrypt_token(token): try: decrypted_token = jwt.JWT(key=key, jwt=token, expected_type="JWE") except ValueError as exc: + # "Token format unrecognized" raise AuthenticationError(message="Invalid token") from exc return decrypted_token.claims From 8bd2ca96d682d0b9abe26034fbdb7537efd71c0a Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 7 Nov 2024 17:08:33 +0100 Subject: [PATCH 056/125] typo --- dds_web/security/auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/security/auth.py b/dds_web/security/auth.py index efa52bc07..99fbd32c9 100644 --- a/dds_web/security/auth.py +++ b/dds_web/security/auth.py @@ -278,7 +278,7 @@ def __verify_general_token(token): # ValueError is raised when the token doesn't look right (for example no periods) # jwcryopto.common.JWException is the base exception raised by jwcrypto, # and is raised when the token is malformed or invalid. - flask.current_app.logger.warning(f"Exception Name: {type(e).__name__}") + flask.current_app.logger.warning(f"Error with Token operation: {type(e).__name__}") raise AuthenticationError(message="Invalid token") from e expiration_time = data.get("exp") From 5b9a58bd999460178dfb2a67037500857db9ffee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:00:39 +0100 Subject: [PATCH 057/125] Update dds_web/__init__.py Co-authored-by: Valentin Georgiev --- dds_web/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/__init__.py b/dds_web/__init__.py index 76eead1c8..b4a830ae9 100644 --- a/dds_web/__init__.py +++ b/dds_web/__init__.py @@ -75,7 +75,7 @@ def filter(record): """ Filters log records to exclude those with MaintenanceOngoingException. Returns: - bool: True if the log record should be processed, False if it should be filtered out. + bool: True if the log record should be logged, False if it should be filtered out. """ from dds_web.errors import MaintenanceOngoingException From d60dab30f329ec8cf525aab4e93228b56aa194cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:06:40 +0100 Subject: [PATCH 058/125] Update SPRINTLOG.md Co-authored-by: Valentin Georgiev --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index b9667dd8b..968b1645c 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,4 +453,4 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Fix logging of the exception of incorrect token ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) +- Removed exception for invalid token to simplify logging and reduce unnecessary error entries ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) From 31702d04d30a539c5118911bf8f5f1b4dbdc3dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:08:02 +0100 Subject: [PATCH 059/125] Update dds_web/utils.py Co-authored-by: Valentin Georgiev --- dds_web/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dds_web/utils.py b/dds_web/utils.py index 992ed886b..688777c0d 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -92,8 +92,8 @@ def verify_project_user_key(project) -> None: ).one_or_none() if not project_key: msg = ( - "There is no entry in the projectUserKeys table for the user and project. " - "Probably due to password reset. Please, ask a colleague to run dds project access fix" + "Access to all active projects has been lost, probably due to password reset. " + "Please, ask the corresponding unit to run dds project access fix" ) raise AccessDeniedError( message=msg, From 924981e69de1bbdeb9257bfbe7d7fbb02c1becde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:49:38 +0100 Subject: [PATCH 060/125] Update SPRINTLOG.md Co-authored-by: Valentin Georgiev --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 1d262dac5..9c7d44567 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,4 +453,4 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Change the errror when trying to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) +- Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) From 438082a20e84603d6e300372e636464c265401d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:49:50 +0100 Subject: [PATCH 061/125] Update dds_web/api/project.py Co-authored-by: Valentin Georgiev --- dds_web/api/project.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dds_web/api/project.py b/dds_web/api/project.py index 9d3530041..95e46ea44 100644 --- a/dds_web/api/project.py +++ b/dds_web/api/project.py @@ -592,7 +592,6 @@ def get(self): """Get private key from database.""" # Verify project ID and access project = project_schemas.ProjectRequiredSchema().load(flask.request.args) - dds_web.utils.verify_project_user_key(project=project) flask.current_app.logger.debug("Getting the private key.") return flask.jsonify( From cf8d4f8bbf04041034afc14a4ca4e2fba75c5b8c Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 13 Nov 2024 15:54:28 +0100 Subject: [PATCH 062/125] fix tests --- dds_web/api/project.py | 1 + tests/test_utils.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dds_web/api/project.py b/dds_web/api/project.py index 95e46ea44..9d3530041 100644 --- a/dds_web/api/project.py +++ b/dds_web/api/project.py @@ -592,6 +592,7 @@ def get(self): """Get private key from database.""" # Verify project ID and access project = project_schemas.ProjectRequiredSchema().load(flask.request.args) + dds_web.utils.verify_project_user_key(project=project) flask.current_app.logger.debug("Getting the private key.") return flask.jsonify( diff --git a/tests/test_utils.py b/tests/test_utils.py index 5a4264d7c..abdb4a935 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -168,7 +168,7 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No # Verify project access -- not ok with pytest.raises(AccessDeniedError) as err: utils.verify_project_user_key(project=project) - assert "There is no entry in the projectUserKeys table for the user and project" in str( + assert "Access to all active projects has been lost, probably due to password reset" in str( err.value ) From 0129551b18a08db21b1c995dc6908ad95156f3f2 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Wed, 20 Nov 2024 13:22:07 +0100 Subject: [PATCH 063/125] [DDS-2178] Log which user reset password. --- dds_web/web/user.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dds_web/web/user.py b/dds_web/web/user.py index e7b4d58bb..7912136f2 100644 --- a/dds_web/web/user.py +++ b/dds_web/web/user.py @@ -16,6 +16,7 @@ import qrcode import qrcode.image.svg import sqlalchemy +import structlog # Own Modules import dds_web.utils @@ -549,7 +550,6 @@ def reset_password(token): @auth_blueprint.route("/password_reset_completed", methods=["GET"]) -@logging_bind_request def password_reset_completed(): """Landing page after password reset""" @@ -604,6 +604,8 @@ def password_reset_completed(): for unit_admin in unit_admins_to_contact: dds_web.utils.send_project_access_reset_email(unit_admin, email[0], token) + action_logger = structlog.getLogger("actions") + action_logger.info(f"{flask.request.endpoint}", user=user.name, resource=flask.request.path) return flask.render_template( "user/password_reset_completed.html", units_to_contact=units_to_contact ) From 47998dc8ddd514884da45e257ae214134cc39f65 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Wed, 20 Nov 2024 13:23:17 +0100 Subject: [PATCH 064/125] [DDS-2178] Updated sprintlog. --- SPRINTLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index e5316de21..c88ded8d9 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -450,3 +450,7 @@ _Nothing merged during this sprint_ - Workflow: Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) - Workflow: CodeQL action version(s) bumped to v3 ([#1569](https://github.com/ScilifelabDataCentre/dds_web/pull/1569)) - Workflow: Setup-node, codecov and upload-sarif action versions bumped to v4, v4 and v3, respectively ([#1570](https://github.com/ScilifelabDataCentre/dds_web/pull/1570)) + +# 2024-11-18 – 2024-11-29 + +- Logging: Add which user name reset password ([https://github.com/ScilifelabDataCentre/dds_web/pull/1574](https://github.com/ScilifelabDataCentre/dds_web/pull/1574)) From ae597d81f29c2f1bc47ace1d08a49848319c011c Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Mon, 25 Nov 2024 14:56:27 +0100 Subject: [PATCH 065/125] =?UTF-8?q?[DDS-2178]=20Log=20user=20name=20instea?= =?UTF-8?q?d=20of=20user=E2=80=99s=20actual=20name.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dds_web/web/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/web/user.py b/dds_web/web/user.py index 7912136f2..e3c1f88cf 100644 --- a/dds_web/web/user.py +++ b/dds_web/web/user.py @@ -605,7 +605,7 @@ def password_reset_completed(): dds_web.utils.send_project_access_reset_email(unit_admin, email[0], token) action_logger = structlog.getLogger("actions") - action_logger.info(f"{flask.request.endpoint}", user=user.name, resource=flask.request.path) + action_logger.info(f"{flask.request.endpoint}", username=user.username, resource=flask.request.path) return flask.render_template( "user/password_reset_completed.html", units_to_contact=units_to_contact ) From 35958658353948e5da4f3799c7286cfe08088ab0 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Tue, 26 Nov 2024 14:22:06 +0100 Subject: [PATCH 066/125] [DDS-2077] Quick and dirty fix for systematic 500 error on dds ls --tree. --- dds_web/api/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/api/files.py b/dds_web/api/files.py index 27ec6a6e7..58ab3cc66 100644 --- a/dds_web/api/files.py +++ b/dds_web/api/files.py @@ -324,7 +324,7 @@ def old_get(self, project): show_size = extra_args.get("show_size") # Check if to get from root or folder - subpath = extra_args.get("subpath", ".").rstrip(os.sep) + subpath = (extra_args.get("subpath", ".") or "").rstrip(os.sep) subpath = "." if subpath == "" else subpath return self.get_files_folders(project, subpath, show_size) From ce916f7ad4c24b79ab00c0c2bf08e0c2d07d24b1 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Tue, 26 Nov 2024 15:03:06 +0100 Subject: [PATCH 067/125] [DDS-2077] Updated sprint log. --- SPRINTLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index e5316de21..5e13b8399 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -450,3 +450,7 @@ _Nothing merged during this sprint_ - Workflow: Bump GitHub checkout action to v4 ([#1556](https://github.com/ScilifelabDataCentre/dds_web/pull/1556)) - Workflow: CodeQL action version(s) bumped to v3 ([#1569](https://github.com/ScilifelabDataCentre/dds_web/pull/1569)) - Workflow: Setup-node, codecov and upload-sarif action versions bumped to v4, v4 and v3, respectively ([#1570](https://github.com/ScilifelabDataCentre/dds_web/pull/1570)) + +# 2024-11-18 – 2024-11-29 + +- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically. From 8ed5653965e89fc289a2823e98492a117c785bd5 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Tue, 26 Nov 2024 15:59:53 +0100 Subject: [PATCH 068/125] [DDS-2178] Linting Python. --- dds_web/web/user.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dds_web/web/user.py b/dds_web/web/user.py index e3c1f88cf..d3ff105a5 100644 --- a/dds_web/web/user.py +++ b/dds_web/web/user.py @@ -605,7 +605,9 @@ def password_reset_completed(): dds_web.utils.send_project_access_reset_email(unit_admin, email[0], token) action_logger = structlog.getLogger("actions") - action_logger.info(f"{flask.request.endpoint}", username=user.username, resource=flask.request.path) + action_logger.info( + f"{flask.request.endpoint}", username=user.username, resource=flask.request.path + ) return flask.render_template( "user/password_reset_completed.html", units_to_contact=units_to_contact ) From 876e3561ff573d4139f95f0e7c4c06d583ccacfa Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Wed, 27 Nov 2024 09:32:45 +0100 Subject: [PATCH 069/125] [DDS-2077] Add link to pull request in sprint log. --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 5e13b8399..576b381c4 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,4 +453,4 @@ _Nothing merged during this sprint_ # 2024-11-18 – 2024-11-29 -- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically. +- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575). From f69862b8a04b59a7b940a12dea1d48dc16697afa Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 28 Nov 2024 16:28:05 +0100 Subject: [PATCH 070/125] add request change to code and test --- dds_web/utils.py | 7 +++---- tests/test_utils.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dds_web/utils.py b/dds_web/utils.py index 688777c0d..aa387d2a4 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -91,10 +91,9 @@ def verify_project_user_key(project) -> None: project_id=project.id, user_id=auth.current_user().username ).one_or_none() if not project_key: - msg = ( - "Access to all active projects has been lost, probably due to password reset. " - "Please, ask the corresponding unit to run dds project access fix" - ) + msg = "You have lost access to this project." + "This is likely due to a password reset, in which case you have lost access to all active projects." + f"In order to regain access to this project, please contact {project.responsible_unit.external_display_name} and ask them to run 'dds project access fix'." raise AccessDeniedError( message=msg, username=auth.current_user().username, diff --git a/tests/test_utils.py b/tests/test_utils.py index abdb4a935..cf9a604f7 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -168,7 +168,7 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No # Verify project access -- not ok with pytest.raises(AccessDeniedError) as err: utils.verify_project_user_key(project=project) - assert "Access to all active projects has been lost, probably due to password reset" in str( + assert "You have lost access to this project" in str( err.value ) From e18f5a87c234bb593beab0a4d8f504b3e37fcf09 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 28 Nov 2024 16:32:29 +0100 Subject: [PATCH 071/125] modified code and tests for feedback --- dds_web/utils.py | 8 +++++--- tests/test_utils.py | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dds_web/utils.py b/dds_web/utils.py index aa387d2a4..b705c22b6 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -91,9 +91,11 @@ def verify_project_user_key(project) -> None: project_id=project.id, user_id=auth.current_user().username ).one_or_none() if not project_key: - msg = "You have lost access to this project." - "This is likely due to a password reset, in which case you have lost access to all active projects." - f"In order to regain access to this project, please contact {project.responsible_unit.external_display_name} and ask them to run 'dds project access fix'." + msg = ( + "You have lost access to this project. " + "This is likely due to a password reset, in which case you have lost access to all active projects. " + f"In order to regain access to this project, please contact '{project.responsible_unit.external_display_name}' and ask them to run 'dds project access fix'." + ) raise AccessDeniedError( message=msg, username=auth.current_user().username, diff --git a/tests/test_utils.py b/tests/test_utils.py index cf9a604f7..d0d17b180 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -168,9 +168,7 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No # Verify project access -- not ok with pytest.raises(AccessDeniedError) as err: utils.verify_project_user_key(project=project) - assert "You have lost access to this project" in str( - err.value - ) + assert "You have lost access to this project" in str(err.value) def test_verify_project_user_key_ok(client: flask.testing.FlaskClient) -> None: From 63c37fb00ddd6cb28c063fa86636013dc1c874e6 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 28 Nov 2024 16:34:43 +0100 Subject: [PATCH 072/125] prettier --- SPRINTLOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index bd606c170..347b22b85 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -455,4 +455,3 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Removed exception for invalid token to simplify logging and reduce unnecessary error entries ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) - From bd2e7fdc0fb98841ba1922cd15d10f57726f6f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:39:45 +0100 Subject: [PATCH 073/125] Update dds_web/commands.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- dds_web/commands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dds_web/commands.py b/dds_web/commands.py index c247e832f..ddca483d0 100644 --- a/dds_web/commands.py +++ b/dds_web/commands.py @@ -1307,7 +1307,8 @@ def monitor_usage(): # Email settings unit_contact: str = unit.contact_email message: str = ( - "Your unit is approaching the allocated data quota.\n" + "Your unit is approaching the allocated data quota (see details below).\n\n" + f"NB! If you would like to increase or decrease the allocated quota ('Quota') or the level after which you receive this email ('Warning level'), the technical contact person for your unit must send a request to {dds_contact}.\n" f"Unit name: {unit.name}\n" f"{info_string}" ) From 3262057250326102acb396ec6addbad77b6dc3e9 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Fri, 29 Nov 2024 15:13:37 +0100 Subject: [PATCH 074/125] [DDS-2178] Added new line at end of sprint log. --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index c5f2e1837..e119744a2 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -457,4 +457,4 @@ _Nothing merged during this sprint_ # 2024-11-18 – 2024-11-29 -- Logging: Add which user name reset password ([https://github.com/ScilifelabDataCentre/dds_web/pull/1574](https://github.com/ScilifelabDataCentre/dds_web/pull/1574)) \ No newline at end of file +- Logging: Add which user name reset password ([https://github.com/ScilifelabDataCentre/dds_web/pull/1574](https://github.com/ScilifelabDataCentre/dds_web/pull/1574)) From af62efb64359e8d99a390a1ebc6f8df73e7aea91 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Fri, 29 Nov 2024 15:14:04 +0100 Subject: [PATCH 075/125] [DDS-2077] Added new line at end of sprint log. --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 971996869..3ecb8a14b 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -457,4 +457,4 @@ _Nothing merged during this sprint_ # 2024-11-18 – 2024-11-29 -- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575). \ No newline at end of file +- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575). From 65483923fd7a9b8c6c76788c94aca9b39e01d856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:14:18 +0100 Subject: [PATCH 076/125] Update dds_web/utils.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- dds_web/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/utils.py b/dds_web/utils.py index b705c22b6..46238db2c 100644 --- a/dds_web/utils.py +++ b/dds_web/utils.py @@ -94,7 +94,7 @@ def verify_project_user_key(project) -> None: msg = ( "You have lost access to this project. " "This is likely due to a password reset, in which case you have lost access to all active projects. " - f"In order to regain access to this project, please contact '{project.responsible_unit.external_display_name}' and ask them to run 'dds project access fix'." + f"In order to regain access to this project, please contact {project.responsible_unit.external_display_name} ({project.responsible_unit.contact_email}) and ask them to run 'dds project access fix'." ) raise AccessDeniedError( message=msg, From a46c39eef41d8082cf49e9d759c10e2f2a7964a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:15:17 +0100 Subject: [PATCH 077/125] Update dds_web/__init__.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- dds_web/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dds_web/__init__.py b/dds_web/__init__.py index b4a830ae9..0aca78338 100644 --- a/dds_web/__init__.py +++ b/dds_web/__init__.py @@ -19,7 +19,6 @@ from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth import flask_mail import flask_login -from flask.logging import logging as flask_logging import flask_migrate From 9b89eecc791cfffe0b03b39c4f1f2afb0833f13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:15:24 +0100 Subject: [PATCH 078/125] Update dds_web/__init__.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- dds_web/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/__init__.py b/dds_web/__init__.py index 0aca78338..55d7e51cb 100644 --- a/dds_web/__init__.py +++ b/dds_web/__init__.py @@ -68,7 +68,7 @@ #################################################################################################### -class FilterMaintenanceExc(flask_logging.Filter): +class FilterMaintenanceExc(logging.Filter): def filter(record): """ From a9817cfb73a64d839fdff4fdb21b168fd08b29f2 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Mon, 2 Dec 2024 11:25:18 +0100 Subject: [PATCH 079/125] Update dds_web/api/files.py as per discussion on PR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Álvaro Revuelta <46089290+rv0lt@users.noreply.github.com> --- dds_web/api/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dds_web/api/files.py b/dds_web/api/files.py index 58ab3cc66..11f773561 100644 --- a/dds_web/api/files.py +++ b/dds_web/api/files.py @@ -324,7 +324,7 @@ def old_get(self, project): show_size = extra_args.get("show_size") # Check if to get from root or folder - subpath = (extra_args.get("subpath", ".") or "").rstrip(os.sep) + subpath = (extra_args.get("subpath") or ".").rstrip(os.sep) subpath = "." if subpath == "" else subpath return self.get_files_folders(project, subpath, show_size) From e8b2ce8beb96a221da1a8b92a8bd268ae5738ef1 Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Mon, 2 Dec 2024 12:11:07 +0100 Subject: [PATCH 080/125] Update SPRINTLOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- SPRINTLOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 85f110e0c..4acc6ce8a 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -458,4 +458,6 @@ _Nothing merged during this sprint_ # 2024-11-18 – 2024-11-29 - Logging: Add which user name reset password ([https://github.com/ScilifelabDataCentre/dds_web/pull/1574](https://github.com/ScilifelabDataCentre/dds_web/pull/1574)) + +# 2024-12-02 - 2024-12-13 - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575). From 67cbf922435d7a4b50733139213055f3cb55885a Mon Sep 17 00:00:00 2001 From: Arthur Rosendahl Date: Mon, 2 Dec 2024 12:14:10 +0100 Subject: [PATCH 081/125] [DDS-2077] Made sprint log Prettier-compliant. --- SPRINTLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 4acc6ce8a..bdf60e3b7 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -460,4 +460,5 @@ _Nothing merged during this sprint_ - Logging: Add which user name reset password ([https://github.com/ScilifelabDataCentre/dds_web/pull/1574](https://github.com/ScilifelabDataCentre/dds_web/pull/1574)) # 2024-12-02 - 2024-12-13 + - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575). From 4c83932949d587303b440b99d08be63009aff59d Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 2 Dec 2024 12:34:06 +0100 Subject: [PATCH 082/125] move sprintlog --- SPRINTLOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 9810960e0..b3a05bea9 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,5 +453,8 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Removed exception for invalid token to simplify logging and reduce unnecessary error entries ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) + +# 2024-12-02 - 2024-12-13 + +- Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) From 30162c8fc877e5e613a1bcbb80600bfce88b803d Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 2 Dec 2024 12:48:34 +0100 Subject: [PATCH 083/125] move sprintlog --- SPRINTLOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index a2c1c063a..a2516acfe 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,9 +453,12 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Removed exception for invalid token to simplify logging and reduce unnecessary error entries ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) # 2024-11-18 – 2024-11-29 - Logging: Add which user name reset password ([https://github.com/ScilifelabDataCentre/dds_web/pull/1574](https://github.com/ScilifelabDataCentre/dds_web/pull/1574)) + +# 2024-12-02 – 2024-12-13 + +- Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) From 7275525b51b3f225f3d1d382d4dee22be96a90ae Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 2 Dec 2024 12:55:47 +0100 Subject: [PATCH 084/125] suggestion --- tests/test_utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index d0d17b180..0945f3a6f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -168,7 +168,13 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No # Verify project access -- not ok with pytest.raises(AccessDeniedError) as err: utils.verify_project_user_key(project=project) - assert "You have lost access to this project" in str(err.value) + + error_msg = ( + "You have lost access to this project. " + "This is likely due to a password reset, in which case you have lost access to all active projects. " + f"In order to regain access to this project, please contact {project.responsible_unit.external_display_name} ({project.responsible_unit.contact_email}) and ask them to run 'dds project access fix'." + ) + assert error_msg in str(err.value) def test_verify_project_user_key_ok(client: flask.testing.FlaskClient) -> None: @@ -190,10 +196,11 @@ def test_verify_project_user_key_ok(client: flask.testing.FlaskClient) -> None: # Set auth.current_user flask.g.flask_httpauth_user = user - # Verify project access -- not ok + # Verify project access -- ok utils.verify_project_access(project=project) + # verify_cli_version From 722adc9f6e1885abbbfd3903a96daa7be3659652 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 2 Dec 2024 12:57:13 +0100 Subject: [PATCH 085/125] black --- tests/test_utils.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 0945f3a6f..6a5dcfabd 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -168,12 +168,12 @@ def test_verify_project_user_key_denied(client: flask.testing.FlaskClient) -> No # Verify project access -- not ok with pytest.raises(AccessDeniedError) as err: utils.verify_project_user_key(project=project) - + error_msg = ( - "You have lost access to this project. " - "This is likely due to a password reset, in which case you have lost access to all active projects. " - f"In order to regain access to this project, please contact {project.responsible_unit.external_display_name} ({project.responsible_unit.contact_email}) and ask them to run 'dds project access fix'." - ) + "You have lost access to this project. " + "This is likely due to a password reset, in which case you have lost access to all active projects. " + f"In order to regain access to this project, please contact {project.responsible_unit.external_display_name} ({project.responsible_unit.contact_email}) and ask them to run 'dds project access fix'." + ) assert error_msg in str(err.value) @@ -200,7 +200,6 @@ def test_verify_project_user_key_ok(client: flask.testing.FlaskClient) -> None: utils.verify_project_access(project=project) - # verify_cli_version From 2259ac4b2b25ed2acfa73817e76e7a9aeda61841 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 2 Dec 2024 13:29:14 +0100 Subject: [PATCH 086/125] migration --- dds_web/database/models.py | 2 +- ...8fde71e_unit_contact_email_non_nullable.py | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py diff --git a/dds_web/database/models.py b/dds_web/database/models.py index eb992339f..ff0ef8f6f 100644 --- a/dds_web/database/models.py +++ b/dds_web/database/models.py @@ -187,7 +187,7 @@ class Unit(db.Model): public_id = db.Column(db.String(50), unique=True, nullable=False) name = db.Column(db.String(255), unique=True, nullable=False) external_display_name = db.Column(db.String(255), unique=False, nullable=False) - contact_email = db.Column(db.String(255), unique=False, nullable=True) + contact_email = db.Column(db.String(255), unique=False, nullable=False) internal_ref = db.Column(db.String(50), unique=True, nullable=False) # Safespring storage diff --git a/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py b/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py new file mode 100644 index 000000000..f544b652f --- /dev/null +++ b/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py @@ -0,0 +1,33 @@ +"""unit_contact_email_non_nullable + +Revision ID: e02fe8fde71e +Revises: +Create Date: 2024-12-02 13:08:43.073488 + +""" + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "e02fe8fde71e" +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade(): + op.alter_column( + table_name="units", + column_name="contact_email", + nullable=False, + ) + + +def downgrade(): + op.alter_column( + table_name="units", + column_name="contact_email", + nullable=False, + ) From 4b0a6ddf60bb309b39c16bebbc2c5cf7fe027df6 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Mon, 2 Dec 2024 13:34:25 +0100 Subject: [PATCH 087/125] fix tests --- tests/test_commands.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index 2e9b8053b..40855f1ef 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1444,10 +1444,8 @@ def test_monitor_usage_warning_sent(client, cli_runner, capfd: LogCaptureFixture # Verify email has been sent to the correct recipient assert outbox[i].recipients[0] == unit.contact_email assert outbox[i].recipients[1] == "delivery@scilifelab.se" - assert ( - f"Your unit is approaching the allocated data quota.\nUnit name: {unit.name}\n" - in err - ) + assert "Your unit is approaching the allocated data quota" in err + assert f"Unit name: {unit.name}" in err i += 1 From 17a11b404deff43da043176915218aea7f2f6525 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 3 Dec 2024 10:35:49 +0100 Subject: [PATCH 088/125] move sprintlog --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 880e7cf0a..706db7535 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -453,7 +453,6 @@ _Nothing merged during this sprint_ # 2024-11-04 - 2024-11-15 -- Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) - Removed exception for invalid token to simplify logging and reduce unnecessary error entries ([#1572](https://github.com/ScilifelabDataCentre/dds_web/pull/1572)) # 2024-11-18 – 2024-11-29 @@ -465,3 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) +- Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From e3e60866cf6386810b1e9c4600a38b3ae744ab4a Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 3 Dec 2024 11:18:18 +0100 Subject: [PATCH 089/125] fix migration --- .../e02fe8fde71e_unit_contact_email_non_nullable.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py b/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py index f544b652f..378045502 100644 --- a/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py +++ b/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py @@ -12,7 +12,7 @@ # revision identifiers, used by Alembic. revision = "e02fe8fde71e" -down_revision = None +down_revision = "3d610b382383" branch_labels = None depends_on = None @@ -21,6 +21,7 @@ def upgrade(): op.alter_column( table_name="units", column_name="contact_email", + existing_type=sa.String(length=255), nullable=False, ) @@ -29,5 +30,6 @@ def downgrade(): op.alter_column( table_name="units", column_name="contact_email", - nullable=False, + existing_type=sa.String(length=255), + nullable=True, ) From c3c871b3bb6115b05058ab382b0a8323ab8758cb Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 3 Dec 2024 11:25:54 +0100 Subject: [PATCH 090/125] set default --- .../versions/e02fe8fde71e_unit_contact_email_non_nullable.py | 1 + 1 file changed, 1 insertion(+) diff --git a/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py b/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py index 378045502..2b977369e 100644 --- a/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py +++ b/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py @@ -22,6 +22,7 @@ def upgrade(): table_name="units", column_name="contact_email", existing_type=sa.String(length=255), + server_default="delivery@scilifelab.se", nullable=False, ) From 557a693d3293fcd3173d1d8653f7e79e07ed28a3 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 3 Dec 2024 12:00:43 +0100 Subject: [PATCH 091/125] proper migration file --- ...3b251e0_unit_contact_email_non_nullable.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py diff --git a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py new file mode 100644 index 000000000..956f69a11 --- /dev/null +++ b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py @@ -0,0 +1,33 @@ +"""unit_contact_email_non_nullable + +Revision ID: 0cd0a3b251e0 +Revises: 3d610b382383 +Create Date: 2024-12-03 10:51:34.143028 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = '0cd0a3b251e0' +down_revision = '3d610b382383' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('units', 'contact_email', + existing_type=mysql.VARCHAR(length=255), + nullable=False, + server_default="delivery@scilifelab.se") + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('units', 'contact_email', + existing_type=mysql.VARCHAR(length=255), + nullable=True) + # ### end Alembic commands ### From a99aaf0abb3ab35e1ea26531b0d17e1ecb5e14b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:02:15 +0100 Subject: [PATCH 092/125] Delete migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py --- ...8fde71e_unit_contact_email_non_nullable.py | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py diff --git a/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py b/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py deleted file mode 100644 index 2b977369e..000000000 --- a/migrations/versions/e02fe8fde71e_unit_contact_email_non_nullable.py +++ /dev/null @@ -1,36 +0,0 @@ -"""unit_contact_email_non_nullable - -Revision ID: e02fe8fde71e -Revises: -Create Date: 2024-12-02 13:08:43.073488 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "e02fe8fde71e" -down_revision = "3d610b382383" -branch_labels = None -depends_on = None - - -def upgrade(): - op.alter_column( - table_name="units", - column_name="contact_email", - existing_type=sa.String(length=255), - server_default="delivery@scilifelab.se", - nullable=False, - ) - - -def downgrade(): - op.alter_column( - table_name="units", - column_name="contact_email", - existing_type=sa.String(length=255), - nullable=True, - ) From d3897288281a58f3ed15685208d1510b9f56bba5 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Tue, 3 Dec 2024 12:02:47 +0100 Subject: [PATCH 093/125] black --- ...3b251e0_unit_contact_email_non_nullable.py | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py index 956f69a11..045b18d37 100644 --- a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py +++ b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py @@ -5,29 +5,33 @@ Create Date: 2024-12-03 10:51:34.143028 """ + from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. -revision = '0cd0a3b251e0' -down_revision = '3d610b382383' +revision = "0cd0a3b251e0" +down_revision = "3d610b382383" branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.alter_column('units', 'contact_email', - existing_type=mysql.VARCHAR(length=255), - nullable=False, - server_default="delivery@scilifelab.se") + op.alter_column( + "units", + "contact_email", + existing_type=mysql.VARCHAR(length=255), + nullable=False, + server_default="delivery@scilifelab.se", + ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.alter_column('units', 'contact_email', - existing_type=mysql.VARCHAR(length=255), - nullable=True) + op.alter_column( + "units", "contact_email", existing_type=mysql.VARCHAR(length=255), nullable=True + ) # ### end Alembic commands ### From 736cd47d53f1cfa6acf6fcda40fc483aca101d81 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 4 Dec 2024 02:56:41 +0100 Subject: [PATCH 094/125] added a proper readme --- migrations/README | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/migrations/README b/migrations/README index 0e0484415..d630a353d 100644 --- a/migrations/README +++ b/migrations/README @@ -1 +1,39 @@ -Single-database configuration for Flask. +# Database Migration Guide + +This document explains how to perform database migrations for this project. In DDS we use Alembic leveraged through flask-migrate. + +## Steps for Running Migrations + +### 1. Start the Containers + +Before making any model changes, ensure the containers are running locally. + +### 2. Modify the Database Models + +Edit the `models.py` file to reflect the changes you need. This might include: + +- Adding new tables or columns +- Modifying existing fields +- Deleting tables or columns + +### 3. Access the Backend Container + +Connect a terminal into the backend container. + +### 4. Run the Migration Command + +Inside the container, execute the migration command: + +```bash +flask db migrate -m "Your migration message" +``` + +### 5. Review the Generated Migration File + +A new migration script will be generated in the `migrations/versions` directory. **Review this file carefully** to ensure it correctly represents your intended changes. + +For reference on available operations and customization options, check the [Alembic Documentation](https://alembic.sqlalchemy.org/en/latest/ops.html). + +### 6. Commit the Migration File + +Finally, commit the migration script to version control. From abb19f6d9efe48cfc38a8e13890a18765865cc55 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 4 Dec 2024 12:24:19 +0100 Subject: [PATCH 095/125] undo readme --- migrations/README | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/migrations/README b/migrations/README index d630a353d..0e0484415 100644 --- a/migrations/README +++ b/migrations/README @@ -1,39 +1 @@ -# Database Migration Guide - -This document explains how to perform database migrations for this project. In DDS we use Alembic leveraged through flask-migrate. - -## Steps for Running Migrations - -### 1. Start the Containers - -Before making any model changes, ensure the containers are running locally. - -### 2. Modify the Database Models - -Edit the `models.py` file to reflect the changes you need. This might include: - -- Adding new tables or columns -- Modifying existing fields -- Deleting tables or columns - -### 3. Access the Backend Container - -Connect a terminal into the backend container. - -### 4. Run the Migration Command - -Inside the container, execute the migration command: - -```bash -flask db migrate -m "Your migration message" -``` - -### 5. Review the Generated Migration File - -A new migration script will be generated in the `migrations/versions` directory. **Review this file carefully** to ensure it correctly represents your intended changes. - -For reference on available operations and customization options, check the [Alembic Documentation](https://alembic.sqlalchemy.org/en/latest/ops.html). - -### 6. Commit the Migration File - -Finally, commit the migration script to version control. +Single-database configuration for Flask. From 3c87648704bfdbeae19042fa7fa494da060e9f0f Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 4 Dec 2024 12:32:38 +0100 Subject: [PATCH 096/125] update node packages --- dds_web/static/package-lock.json | 197 ++++++++++++------------------- 1 file changed, 74 insertions(+), 123 deletions(-) diff --git a/dds_web/static/package-lock.json b/dds_web/static/package-lock.json index de7385ae2..75b44135f 100644 --- a/dds_web/static/package-lock.json +++ b/dds_web/static/package-lock.json @@ -308,10 +308,11 @@ "dev": true }, "node_modules/@zeit/schemas": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.29.0.tgz", - "integrity": "sha512-g5QiLIfbg3pLuYUJPlisNKY+epQJTcMDsOnVNkscrDP1oi7vmJnzOANYJI/1pZcVJ6umUkBv3aFtlg1UvUHGzA==", - "dev": true + "version": "2.36.0", + "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", + "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==", + "dev": true, + "license": "MIT" }, "node_modules/abbrev": { "version": "1.1.1", @@ -370,10 +371,11 @@ } }, "node_modules/ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -1148,6 +1150,7 @@ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1193,10 +1196,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1546,15 +1550,6 @@ "node": ">=8.6.0" } }, - "node_modules/fast-url-parser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", - "integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==", - "dev": true, - "dependencies": { - "punycode": "^1.3.2" - } - }, "node_modules/fastest-levenshtein": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", @@ -2880,12 +2875,13 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -3614,10 +3610,11 @@ "dev": true }, "node_modules/npm-run-all/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, + "license": "MIT", "dependencies": { "nice-try": "^1.0.4", "path-key": "^2.0.1", @@ -3880,7 +3877,8 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", "integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==", - "dev": true + "dev": true, + "license": "(WTFPL OR MIT)" }, "node_modules/path-key": { "version": "3.1.1", @@ -3898,10 +3896,11 @@ "dev": true }, "node_modules/path-to-regexp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz", - "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==", - "dev": true + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.3.0.tgz", + "integrity": "sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==", + "dev": true, + "license": "MIT" }, "node_modules/path-type": { "version": "4.0.0", @@ -4191,12 +4190,6 @@ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", "dev": true }, - "node_modules/punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", - "dev": true - }, "node_modules/purgecss": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.1.3.tgz", @@ -4246,6 +4239,7 @@ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", "integrity": "sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -4713,13 +4707,14 @@ } }, "node_modules/serve": { - "version": "14.2.1", - "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.1.tgz", - "integrity": "sha512-48er5fzHh7GCShLnNyPBRPEjs2I6QBozeGr02gaacROiyS/8ARADlj595j39iZXAqBbJHH/ivJJyPRWY9sQWZA==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.4.tgz", + "integrity": "sha512-qy1S34PJ/fcY8gjVGszDB3EXiPSk5FKhUa7tQe0UPRddxRidc2V6cNHPNewbE1D7MAkgLuWEt3Vw56vYy73tzQ==", "dev": true, + "license": "MIT", "dependencies": { - "@zeit/schemas": "2.29.0", - "ajv": "8.11.0", + "@zeit/schemas": "2.36.0", + "ajv": "8.12.0", "arg": "5.0.2", "boxen": "7.0.0", "chalk": "5.0.1", @@ -4727,7 +4722,7 @@ "clipboardy": "3.0.0", "compression": "1.7.4", "is-port-reachable": "4.0.0", - "serve-handler": "6.1.5", + "serve-handler": "6.1.6", "update-check": "1.5.4" }, "bin": { @@ -4738,18 +4733,18 @@ } }, "node_modules/serve-handler": { - "version": "6.1.5", - "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz", - "integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.6.tgz", + "integrity": "sha512-x5RL9Y2p5+Sh3D38Fh9i/iQ5ZK+e4xuXRd/pGbM4D13tgo/MGwbttUk8emytcr1YYzBYs+apnUngBDFYfpjPuQ==", "dev": true, + "license": "MIT", "dependencies": { "bytes": "3.0.0", "content-disposition": "0.5.2", - "fast-url-parser": "1.1.3", "mime-types": "2.1.18", "minimatch": "3.1.2", "path-is-inside": "1.0.2", - "path-to-regexp": "2.2.1", + "path-to-regexp": "3.3.0", "range-parser": "1.2.0" } }, @@ -4758,6 +4753,7 @@ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -4767,6 +4763,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, + "license": "MIT", "dependencies": { "mime-db": "~1.33.0" }, @@ -5471,22 +5468,6 @@ "node": ">=10.0.0" } }, - "node_modules/table/node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/tar": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", @@ -6229,9 +6210,9 @@ "dev": true }, "@zeit/schemas": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.29.0.tgz", - "integrity": "sha512-g5QiLIfbg3pLuYUJPlisNKY+epQJTcMDsOnVNkscrDP1oi7vmJnzOANYJI/1pZcVJ6umUkBv3aFtlg1UvUHGzA==", + "version": "2.36.0", + "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", + "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==", "dev": true }, "abbrev": { @@ -6279,9 +6260,9 @@ } }, "ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -6830,9 +6811,9 @@ } }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -7105,15 +7086,6 @@ "micromatch": "^4.0.4" } }, - "fast-url-parser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", - "integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==", - "dev": true, - "requires": { - "punycode": "^1.3.2" - } - }, "fastest-levenshtein": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", @@ -8094,12 +8066,12 @@ "dev": true }, "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "requires": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" } }, @@ -8653,9 +8625,9 @@ "dev": true }, "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, "requires": { "nice-try": "^1.0.4", @@ -8858,9 +8830,9 @@ "dev": true }, "path-to-regexp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz", - "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.3.0.tgz", + "integrity": "sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==", "dev": true }, "path-type": { @@ -9035,12 +9007,6 @@ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", "dev": true }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", - "dev": true - }, "purgecss": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.1.3.tgz", @@ -9406,13 +9372,13 @@ } }, "serve": { - "version": "14.2.1", - "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.1.tgz", - "integrity": "sha512-48er5fzHh7GCShLnNyPBRPEjs2I6QBozeGr02gaacROiyS/8ARADlj595j39iZXAqBbJHH/ivJJyPRWY9sQWZA==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.4.tgz", + "integrity": "sha512-qy1S34PJ/fcY8gjVGszDB3EXiPSk5FKhUa7tQe0UPRddxRidc2V6cNHPNewbE1D7MAkgLuWEt3Vw56vYy73tzQ==", "dev": true, "requires": { - "@zeit/schemas": "2.29.0", - "ajv": "8.11.0", + "@zeit/schemas": "2.36.0", + "ajv": "8.12.0", "arg": "5.0.2", "boxen": "7.0.0", "chalk": "5.0.1", @@ -9420,7 +9386,7 @@ "clipboardy": "3.0.0", "compression": "1.7.4", "is-port-reachable": "4.0.0", - "serve-handler": "6.1.5", + "serve-handler": "6.1.6", "update-check": "1.5.4" }, "dependencies": { @@ -9433,18 +9399,17 @@ } }, "serve-handler": { - "version": "6.1.5", - "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz", - "integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.6.tgz", + "integrity": "sha512-x5RL9Y2p5+Sh3D38Fh9i/iQ5ZK+e4xuXRd/pGbM4D13tgo/MGwbttUk8emytcr1YYzBYs+apnUngBDFYfpjPuQ==", "dev": true, "requires": { "bytes": "3.0.0", "content-disposition": "0.5.2", - "fast-url-parser": "1.1.3", "mime-types": "2.1.18", "minimatch": "3.1.2", "path-is-inside": "1.0.2", - "path-to-regexp": "2.2.1", + "path-to-regexp": "3.3.0", "range-parser": "1.2.0" }, "dependencies": { @@ -10003,20 +9968,6 @@ "slice-ansi": "^4.0.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - } } }, "tar": { From 0c94135d67b9627522295515af6287d502f539e2 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 5 Dec 2024 13:41:15 +0100 Subject: [PATCH 097/125] set default for null entries --- .../versions/0cd0a3b251e0_unit_contact_email_non_nullable.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py index 045b18d37..6002ffdfb 100644 --- a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py +++ b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py @@ -19,6 +19,9 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### + op.execute( + "UPDATE units SET contact_email = 'delivery@scilifelab.se' WHERE contact_email IS NULL" + ) op.alter_column( "units", "contact_email", From 4f0a0a01f3e80cfe7c2869e285054943d222f41a Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 5 Dec 2024 14:49:22 +0100 Subject: [PATCH 098/125] sprintlog --- SPRINTLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 05c86da58..60eabb3e6 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,3 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) +- run npm audit fix to solve node cve's ([#1577](https://github.com/ScilifelabDataCentre/dds_web/pull/1577) From a210696a7d0aeeddcd47471beba9d1ce9b1fc0ef Mon Sep 17 00:00:00 2001 From: valyo <582646+valyo@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:02:37 +0100 Subject: [PATCH 099/125] add documentation about upload/download and fix markdown --- doc/technical-overview.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/technical-overview.md b/doc/technical-overview.md index d37040fb7..606e6ad45 100644 --- a/doc/technical-overview.md +++ b/doc/technical-overview.md @@ -453,8 +453,8 @@ Personnel have the permissions to upload data. When starting an upload, a directory (“staging directory”) is created by the executing command. The default location of the staging directory is the current working directory, however the user can specify an existing directory in which the staging directory should be placed. Independent of the location -(specified or default), the staging directory is named _DataDelivery**_, -where is the date and time when the upload was started, and is the ID of +(specified or default), the staging directory is named _DataDelivery\_\\_\\_upload_, +where \ is the date and time when the upload was started, and \ is the ID of the project the user is attempting to upload data to. If there is no data to upload, this directory is deleted immediately. If not, the staging directory will contain three subdirectories: @@ -533,7 +533,7 @@ When downloading data, the Researchers can either choose to download specific fi folder(s), or the entire project contents. As with the upload ([Uploading data](#uploading-data)), a staging directory is created when downloading the data. This -directory is placed by default in the current working directory, and is named DataDelivery**. +directory is placed by default in the current working directory, and is named _DataDelivery\_\\_\\_download_. However unlike the upload command, downloading allows the user to choose the name of the directory - specifying a destination. The destination cannot be an existing directory[^22] - it must be a new directory. Since a new destination is required with every download, downloading the same file(s) multiple times is possible and is only limited by the amount From 7bbd09e68bbd25faeb177a9cb2d80c13a3a53134 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 11 Dec 2024 16:05:56 +0100 Subject: [PATCH 100/125] try to fix tests --- docker-compose.yml | 2 +- tests/conftest.py | 43 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7cda25b4a..1df613bfa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ version: "3.9" services: db: container_name: dds_database - image: mariadb:10.11.5 + image: mariadb:11.6.2 environment: - MYSQL_ROOT_PASSWORD=${DDS_MYSQL_ROOT_PASS} - MYSQL_USER=${DDS_MYSQL_USER} diff --git a/tests/conftest.py b/tests/conftest.py index a9d05709b..e7fa1eab2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -103,12 +103,49 @@ def fill_basic_db(db): def new_test_db(uri): dbname = uri[uri.rindex("/") + 1 :] dbname_base = DATABASE_URI_BASE[DATABASE_URI_BASE.rindex("/") + 1 :] - dump_args = ["mysqldump", "-h", "db", "-u", "root", f"-p{mysql_root_password}", dbname_base] - load_args = ["mysql", "-h", "db", "-u", "root", f"-p{mysql_root_password}", dbname] - proc1 = subprocess.run(dump_args, capture_output=True) + dump_args = [ + "mariadb-dump", + "-h", + "db", + "-u", + "root", + f"-p{mysql_root_password}", + "--skip_ssl", + dbname_base, + ] + load_args = [ + "mariadb", + "-h", + "db", + "-u", + "root", + f"-p{mysql_root_password}", + "--skip_ssl", + dbname, + ] + proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) + """ + # Dump the database + with open("/tmp/dump.sql", "wb") as f: + subprocess.run(dump_args, stdout=f) + + # This is necessary because the dump contains a line that is not supported by this mariadb client + # The line is M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 + with open("/tmp/dump.sql", "rb") as file: + lines = file.readlines() + with open("/tmp/dump.sql", "wb") as file: + for line in lines: + if b"NOTE_VERBOSITY" not in line: # Use binary strings to avoid encoding issues + file.write(line) + + # Load the database + with open("/tmp/dump.sql", "rb") as f: + subprocess.run(load_args, stdin=f) + """ + def demo_data(): from dds_web.utils import timestamp From 6ee3a5f8393b2aaf67db5b389bed51a7188f237a Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 11 Dec 2024 16:07:58 +0100 Subject: [PATCH 101/125] sprintlog --- SPRINTLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 05c86da58..93701528e 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,3 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) +- Tests failing due to mariadn client error ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) From 996eca65366470dd986827704a057ec0ccac3b05 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 11 Dec 2024 16:37:46 +0100 Subject: [PATCH 102/125] first solution to tests --- docker-compose.yml | 2 +- tests/conftest.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1df613bfa..7cda25b4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ version: "3.9" services: db: container_name: dds_database - image: mariadb:11.6.2 + image: mariadb:10.11.5 environment: - MYSQL_ROOT_PASSWORD=${DDS_MYSQL_ROOT_PASS} - MYSQL_USER=${DDS_MYSQL_USER} diff --git a/tests/conftest.py b/tests/conftest.py index e7fa1eab2..e6e343f01 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -124,10 +124,9 @@ def new_test_db(uri): dbname, ] - proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) - proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) + # proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) + # proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) - """ # Dump the database with open("/tmp/dump.sql", "wb") as f: subprocess.run(dump_args, stdout=f) @@ -144,7 +143,6 @@ def new_test_db(uri): # Load the database with open("/tmp/dump.sql", "rb") as f: subprocess.run(load_args, stdin=f) - """ def demo_data(): From 9c3253a8ddba582471d3f2236926fb6c2f0ea9ff Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 12 Dec 2024 09:51:31 +0100 Subject: [PATCH 103/125] fix tests --- Dockerfiles/backend.Dockerfile | 7 ++++++- tests/conftest.py | 23 ++--------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Dockerfiles/backend.Dockerfile b/Dockerfiles/backend.Dockerfile index a98474321..6b0d639b0 100644 --- a/Dockerfiles/backend.Dockerfile +++ b/Dockerfiles/backend.Dockerfile @@ -49,7 +49,12 @@ ENV PYTHONPATH /code ################### FROM base as test RUN pip3 install -r /code/tests/requirements-test.txt -RUN apk add mariadb-client + +# The version of mariadb-client should match the version of the mariadb server +# Because of how alpine works, this is how to pin a version. However, it can break if this branch is removed from alpine +# https://superuser.com/questions/1055060/how-to-install-a-specific-package-version-in-alpine +# https://pkgs.alpinelinux.org/packages?name=mariadb-client&branch=v3.19&repo=&arch=x86_64&origin=&flagged=&maintainer= +RUN apk add mariadb-client=~10.11 --repository https://dl-cdn.alpinelinux.org/alpine/v3.19/main/ # Switch to the user USER $USERNAME diff --git a/tests/conftest.py b/tests/conftest.py index e6e343f01..608c40032 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -110,7 +110,6 @@ def new_test_db(uri): "-u", "root", f"-p{mysql_root_password}", - "--skip_ssl", dbname_base, ] load_args = [ @@ -120,29 +119,11 @@ def new_test_db(uri): "-u", "root", f"-p{mysql_root_password}", - "--skip_ssl", dbname, ] - # proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) - # proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) - - # Dump the database - with open("/tmp/dump.sql", "wb") as f: - subprocess.run(dump_args, stdout=f) - - # This is necessary because the dump contains a line that is not supported by this mariadb client - # The line is M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 - with open("/tmp/dump.sql", "rb") as file: - lines = file.readlines() - with open("/tmp/dump.sql", "wb") as file: - for line in lines: - if b"NOTE_VERBOSITY" not in line: # Use binary strings to avoid encoding issues - file.write(line) - - # Load the database - with open("/tmp/dump.sql", "rb") as f: - subprocess.run(load_args, stdin=f) + proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) + proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) def demo_data(): From f29ba5bec316bebdb0f3eaeed5c61ba0f9117082 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 12 Dec 2024 09:52:27 +0100 Subject: [PATCH 104/125] sprintlog --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 93701528e..6290fbcc0 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,4 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) -- Tests failing due to mariadn client error ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) +- update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) From 85109dc3659e6ed578e4474237281cdc6ec03695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:06:05 +0100 Subject: [PATCH 105/125] Update SPRINTLOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 6290fbcc0..3fd3ce53f 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,4 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) -- update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) +- Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) From da6e45543cb879ba7a0e9e40e47664db15d07f8f Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 12 Dec 2024 13:29:46 +0100 Subject: [PATCH 106/125] prettier --- SPRINTLOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 2c6996b67..1c77d50d9 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -466,4 +466,3 @@ _Nothing merged during this sprint_ - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) - Run npm audit fix to solve node cve's ([#1577](https://github.com/ScilifelabDataCentre/dds_web/pull/1577) - Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) - From c7eb80d5dd916b1623b90aed155e2275ad0c891f Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 11 Dec 2024 16:05:56 +0100 Subject: [PATCH 107/125] try to fix tests --- docker-compose.yml | 2 +- tests/conftest.py | 43 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7cda25b4a..1df613bfa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ version: "3.9" services: db: container_name: dds_database - image: mariadb:10.11.5 + image: mariadb:11.6.2 environment: - MYSQL_ROOT_PASSWORD=${DDS_MYSQL_ROOT_PASS} - MYSQL_USER=${DDS_MYSQL_USER} diff --git a/tests/conftest.py b/tests/conftest.py index a9d05709b..e7fa1eab2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -103,12 +103,49 @@ def fill_basic_db(db): def new_test_db(uri): dbname = uri[uri.rindex("/") + 1 :] dbname_base = DATABASE_URI_BASE[DATABASE_URI_BASE.rindex("/") + 1 :] - dump_args = ["mysqldump", "-h", "db", "-u", "root", f"-p{mysql_root_password}", dbname_base] - load_args = ["mysql", "-h", "db", "-u", "root", f"-p{mysql_root_password}", dbname] - proc1 = subprocess.run(dump_args, capture_output=True) + dump_args = [ + "mariadb-dump", + "-h", + "db", + "-u", + "root", + f"-p{mysql_root_password}", + "--skip_ssl", + dbname_base, + ] + load_args = [ + "mariadb", + "-h", + "db", + "-u", + "root", + f"-p{mysql_root_password}", + "--skip_ssl", + dbname, + ] + proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) + """ + # Dump the database + with open("/tmp/dump.sql", "wb") as f: + subprocess.run(dump_args, stdout=f) + + # This is necessary because the dump contains a line that is not supported by this mariadb client + # The line is M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 + with open("/tmp/dump.sql", "rb") as file: + lines = file.readlines() + with open("/tmp/dump.sql", "wb") as file: + for line in lines: + if b"NOTE_VERBOSITY" not in line: # Use binary strings to avoid encoding issues + file.write(line) + + # Load the database + with open("/tmp/dump.sql", "rb") as f: + subprocess.run(load_args, stdin=f) + """ + def demo_data(): from dds_web.utils import timestamp From 0d5c80397235126a1123102c5c3d5029ef75b273 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 11 Dec 2024 16:07:58 +0100 Subject: [PATCH 108/125] sprintlog --- SPRINTLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 05c86da58..93701528e 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,3 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) +- Tests failing due to mariadn client error ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) From 82745cbe71797fe35a81a5b515652a6189861ef3 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Wed, 11 Dec 2024 16:37:46 +0100 Subject: [PATCH 109/125] first solution to tests --- docker-compose.yml | 2 +- tests/conftest.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1df613bfa..7cda25b4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ version: "3.9" services: db: container_name: dds_database - image: mariadb:11.6.2 + image: mariadb:10.11.5 environment: - MYSQL_ROOT_PASSWORD=${DDS_MYSQL_ROOT_PASS} - MYSQL_USER=${DDS_MYSQL_USER} diff --git a/tests/conftest.py b/tests/conftest.py index e7fa1eab2..e6e343f01 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -124,10 +124,9 @@ def new_test_db(uri): dbname, ] - proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) - proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) + # proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) + # proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) - """ # Dump the database with open("/tmp/dump.sql", "wb") as f: subprocess.run(dump_args, stdout=f) @@ -144,7 +143,6 @@ def new_test_db(uri): # Load the database with open("/tmp/dump.sql", "rb") as f: subprocess.run(load_args, stdin=f) - """ def demo_data(): From 681b300a4c6e5ee49a231285887a203749d966f7 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 12 Dec 2024 09:51:31 +0100 Subject: [PATCH 110/125] fix tests --- Dockerfiles/backend.Dockerfile | 7 ++++++- tests/conftest.py | 23 ++--------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Dockerfiles/backend.Dockerfile b/Dockerfiles/backend.Dockerfile index a98474321..6b0d639b0 100644 --- a/Dockerfiles/backend.Dockerfile +++ b/Dockerfiles/backend.Dockerfile @@ -49,7 +49,12 @@ ENV PYTHONPATH /code ################### FROM base as test RUN pip3 install -r /code/tests/requirements-test.txt -RUN apk add mariadb-client + +# The version of mariadb-client should match the version of the mariadb server +# Because of how alpine works, this is how to pin a version. However, it can break if this branch is removed from alpine +# https://superuser.com/questions/1055060/how-to-install-a-specific-package-version-in-alpine +# https://pkgs.alpinelinux.org/packages?name=mariadb-client&branch=v3.19&repo=&arch=x86_64&origin=&flagged=&maintainer= +RUN apk add mariadb-client=~10.11 --repository https://dl-cdn.alpinelinux.org/alpine/v3.19/main/ # Switch to the user USER $USERNAME diff --git a/tests/conftest.py b/tests/conftest.py index e6e343f01..608c40032 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -110,7 +110,6 @@ def new_test_db(uri): "-u", "root", f"-p{mysql_root_password}", - "--skip_ssl", dbname_base, ] load_args = [ @@ -120,29 +119,11 @@ def new_test_db(uri): "-u", "root", f"-p{mysql_root_password}", - "--skip_ssl", dbname, ] - # proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) - # proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) - - # Dump the database - with open("/tmp/dump.sql", "wb") as f: - subprocess.run(dump_args, stdout=f) - - # This is necessary because the dump contains a line that is not supported by this mariadb client - # The line is M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 - with open("/tmp/dump.sql", "rb") as file: - lines = file.readlines() - with open("/tmp/dump.sql", "wb") as file: - for line in lines: - if b"NOTE_VERBOSITY" not in line: # Use binary strings to avoid encoding issues - file.write(line) - - # Load the database - with open("/tmp/dump.sql", "rb") as f: - subprocess.run(load_args, stdin=f) + proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) + proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True) def demo_data(): From e178477ecce289bc449ccc0102e9e9b258753ea3 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 12 Dec 2024 09:52:27 +0100 Subject: [PATCH 111/125] sprintlog --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 93701528e..6290fbcc0 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,4 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) -- Tests failing due to mariadn client error ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) +- update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) From 1208a0f39da70b123bcca6d36008be101942ab69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:06:05 +0100 Subject: [PATCH 112/125] Update SPRINTLOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- SPRINTLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 6290fbcc0..3fd3ce53f 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,4 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) -- update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) +- Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) From bf449a0c47605fa0f2d43f8b85a8bc3a3d2b837c Mon Sep 17 00:00:00 2001 From: valyo <582646+valyo@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:23:25 +0100 Subject: [PATCH 113/125] sprintlog - added entry and fixed missing ) --- SPRINTLOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 3fd3ce53f..75724dd06 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -463,5 +463,6 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) -- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) -- Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) +- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575)) +- Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581)) +- Update documentation regarding 'Upload' or 'Download' added to end of delivery directory name depending on command ([#1580](https://github.com/ScilifelabDataCentre/dds_web/pull/1580)) From 8357a8ac76103dbf80f93f53edd8581dc9c010e9 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 12 Dec 2024 14:59:51 +0100 Subject: [PATCH 114/125] merge --- SPRINTLOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index fc2d49ec0..c41783b96 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,5 +464,6 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) -- Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) - Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) +- Update documentation regarding 'Upload' or 'Download' added to end of delivery directory name depending on command ([#1580](https://github.com/ScilifelabDataCentre/dds_web/pull/1580)) +- Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From 346424abd74563bfe5b95e44aafe91042d0698a1 Mon Sep 17 00:00:00 2001 From: rv0lt Date: Thu, 12 Dec 2024 15:01:10 +0100 Subject: [PATCH 115/125] merge --- SPRINTLOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index c41783b96..fc1d90ec1 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -463,7 +463,7 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) -- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) -- Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) +- Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575)) +- Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581)) - Update documentation regarding 'Upload' or 'Download' added to end of delivery directory name depending on command ([#1580](https://github.com/ScilifelabDataCentre/dds_web/pull/1580)) - Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) From 13bc6dea0921d6cb177f5c665733853c0f78fa80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Revuelta?= <46089290+rv0lt@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:22:45 +0100 Subject: [PATCH 116/125] Update migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ina Odén Österbo <35953392+i-oden@users.noreply.github.com> --- .../versions/0cd0a3b251e0_unit_contact_email_non_nullable.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py index 6002ffdfb..04b997f24 100644 --- a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py +++ b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py @@ -19,9 +19,8 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.execute( - "UPDATE units SET contact_email = 'delivery@scilifelab.se' WHERE contact_email IS NULL" - ) + unit_table = sa.sql.table("units", sa.sql.column("contact_email", mysql.TINYINT(display_width=1))) + op.execute(unit_table.update().where(unit_table.c.contact_email == None).values(contact_email="delivery@scilifelab.se")) op.alter_column( "units", "contact_email", From 260b2e9fca04a8f80dd52bd5474126725596508a Mon Sep 17 00:00:00 2001 From: rv0lt Date: Fri, 13 Dec 2024 09:26:42 +0100 Subject: [PATCH 117/125] black --- .../0cd0a3b251e0_unit_contact_email_non_nullable.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py index 04b997f24..4e12d8772 100644 --- a/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py +++ b/migrations/versions/0cd0a3b251e0_unit_contact_email_non_nullable.py @@ -19,8 +19,14 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - unit_table = sa.sql.table("units", sa.sql.column("contact_email", mysql.TINYINT(display_width=1))) - op.execute(unit_table.update().where(unit_table.c.contact_email == None).values(contact_email="delivery@scilifelab.se")) + unit_table = sa.sql.table( + "units", sa.sql.column("contact_email", mysql.TINYINT(display_width=1)) + ) + op.execute( + unit_table.update() + .where(unit_table.c.contact_email == None) + .values(contact_email="delivery@scilifelab.se") + ) op.alter_column( "units", "contact_email", From 75cf1b3e922b1b2b224ba622a973827898d9fc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 09:10:13 +0100 Subject: [PATCH 118/125] changelog --- CHANGELOG.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 62c932f5c..b5a87b0fb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,24 @@ Changelog ========== +.. _2.9.0: + +2.9.0 - 2024-12-18 +~~~~~~~~~~~~~~~~~~ + +- New features: + - Delivery directory names now include 'Upload' or 'Download' for clarity. + - Monitor usage now sends warnings to the affected unit and Data Centre when approaching the allocated quota. +- Bugs fixed: + - Improved error message for downloads after a password reset. + - Fixed the dds ls --tree command. + - Pinned mariadb-client version in backend Dockerfile for stability. + - Resolved Node.js vulnerabilities with npm audit fix. +- Logging: + - Removed invalid token exceptions from logs. + - Logged usernames for password resets. + - Filtered out MaintenanceModeException from logs. + .. _2.8.1: 2.8.1 - 2024-10-23 From 2c910e2f9089ef5590fac49849ffff35fbcf994d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 09:11:32 +0100 Subject: [PATCH 119/125] sprintlog --- SPRINTLOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index bbc4640ca..75562b52b 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -468,3 +468,7 @@ _Nothing merged during this sprint_ - Update documentation regarding 'Upload' or 'Download' added to end of delivery directory name depending on command ([#1580](https://github.com/ScilifelabDataCentre/dds_web/pull/1580)) - Modify the monitor usage command to send warning to the affected unit as well as Data Centre([#1562](https://github.com/ScilifelabDataCentre/dds_web/pull/1562)) - Run npm audit fix to solve node cve's ([#1577](https://github.com/ScilifelabDataCentre/dds_web/pull/1577) + +# 2024-12-16 - 2024-12-20 + +- New version: 2.9.0 ([#1584](https://github.com/ScilifelabDataCentre/dds_web/pull/1584)) From 1ba90a2fadb6b7e1897453a68a0fd884aa9b1012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 09:12:25 +0100 Subject: [PATCH 120/125] version --- dds_web/version.py | 2 +- tests/test_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dds_web/version.py b/dds_web/version.py index dcd4a7562..2f21ab781 100644 --- a/dds_web/version.py +++ b/dds_web/version.py @@ -1,3 +1,3 @@ # Do not do major version upgrade during 2024. # If mid or minor version reaches 9, continue with 10, 11 etc etc. -__version__ = "2.8.1" +__version__ = "2.9.0" diff --git a/tests/test_version.py b/tests/test_version.py index 2ef1533b8..dd0c9e26f 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -2,4 +2,4 @@ def test_version(): - assert version.__version__ == "2.8.1" + assert version.__version__ == "2.9.0" From 2ebdff539708c46c8c75e1d27c3944c1d83814d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 09:33:29 +0100 Subject: [PATCH 121/125] runs on ubuntu 22.04 --- .github/workflows/docker-compose-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-compose-tests.yml b/.github/workflows/docker-compose-tests.yml index 3bc8b81b1..6dd39ffc6 100644 --- a/.github/workflows/docker-compose-tests.yml +++ b/.github/workflows/docker-compose-tests.yml @@ -15,7 +15,7 @@ jobs: concurrency: group: ${{ github.ref }}-pytest cancel-in-progress: true - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout From 64bdc6d36183f07eca6603cbe8dc77b1be2c69fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 09:38:45 +0100 Subject: [PATCH 122/125] try ubuntu-24.04 --- .github/workflows/docker-compose-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-compose-tests.yml b/.github/workflows/docker-compose-tests.yml index 6dd39ffc6..424538aaa 100644 --- a/.github/workflows/docker-compose-tests.yml +++ b/.github/workflows/docker-compose-tests.yml @@ -15,7 +15,7 @@ jobs: concurrency: group: ${{ github.ref }}-pytest cancel-in-progress: true - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout From b03635583a650b2b86ff2f0680889c4d2996911a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 09:43:37 +0100 Subject: [PATCH 123/125] change in npm --- Dockerfiles/backend.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/backend.Dockerfile b/Dockerfiles/backend.Dockerfile index 6b0d639b0..609d16536 100644 --- a/Dockerfiles/backend.Dockerfile +++ b/Dockerfiles/backend.Dockerfile @@ -65,7 +65,7 @@ USER $USERNAME FROM node:18 as nodebuilder COPY ./dds_web/static /build WORKDIR /build -RUN npm install -g npm@latest --quiet +RUN npm install -g npm@10.9.2 --quiet RUN npm install --quiet RUN npm run css From 9ea634b0152f065b595de243b150ccf41c7a50d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 09:45:05 +0100 Subject: [PATCH 124/125] change npm in nodebuilder --- Dockerfiles/nodebuilder.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/nodebuilder.Dockerfile b/Dockerfiles/nodebuilder.Dockerfile index cd8b8e97f..831330789 100644 --- a/Dockerfiles/nodebuilder.Dockerfile +++ b/Dockerfiles/nodebuilder.Dockerfile @@ -1,6 +1,6 @@ FROM node:18 RUN mkdir /build WORKDIR /build -RUN npm install -g npm@latest --quiet +RUN npm install -g npm@10.9.2 --quiet RUN echo "npm install --quiet && npm run watch" > /runner.sh CMD ["sh", "/runner.sh"] From fe177c660e8c496a39894498918d2364de913601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ina=20Od=C3=A9n=20=C3=96sterbo?= Date: Tue, 17 Dec 2024 10:12:37 +0100 Subject: [PATCH 125/125] undo --- .github/workflows/docker-compose-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-compose-tests.yml b/.github/workflows/docker-compose-tests.yml index 424538aaa..3bc8b81b1 100644 --- a/.github/workflows/docker-compose-tests.yml +++ b/.github/workflows/docker-compose-tests.yml @@ -15,7 +15,7 @@ jobs: concurrency: group: ${{ github.ref }}-pytest cancel-in-progress: true - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: Checkout