Skip to content

Commit

Permalink
MST-637 Update the secret reference to obscure user_id to send to pro…
Browse files Browse the repository at this point in the history
…ctoring provider (#776)

* MST-637 Update the secret reference to obscure user_id to send to proctoring provider so we can go back to a controlled secret
This resulted in a major version upgrade for breaking change.
  • Loading branch information
schenedx authored Feb 5, 2021
1 parent 897449d commit 3cf23c1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Change Log
Unreleased
~~~~~~~~~~


[3.0.0] - 2021-02-05
~~~~~~~~~~~~~~~~~~~~~
* Update the secret key to the proctoring specific one so we are fixing for the learners being impacted by rotated django secret.

[2.6.7] - 2021-02-04
~~~~~~~~~~~~~~~~~~~~~
* Bug fix for onboarding info panel showing for all proctoring backends, independent of support for onboardin exams
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"""

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '2.6.7'
__version__ = '3.0.0'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
13 changes: 12 additions & 1 deletion edx_proctoring/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
from freezegun import freeze_time

from edx_proctoring.statuses import ProctoredExamStudentAttemptStatus
from edx_proctoring.utils import _emit_event, get_time_remaining_for_attempt, humanized_time, is_reattempting_exam
from edx_proctoring.utils import (
_emit_event,
get_time_remaining_for_attempt,
humanized_time,
is_reattempting_exam,
obscured_user_id
)


class TestGetTimeRemainingForAttempt(unittest.TestCase):
Expand Down Expand Up @@ -144,3 +150,8 @@ def test_is_reattempting_exam_from_other_status(self, from_status):
self.assertFalse(
is_reattempting_exam(from_status, 'foo')
)

def test_obscured_user_id(self):
user_id = 32432455
expected_obscured_user_id = '9b82efd5d28f1a170b23b8f648c3093e75a0a0ca'
self.assertEqual(expected_obscured_user_id, obscured_user_id(user_id))
2 changes: 1 addition & 1 deletion edx_proctoring/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def obscured_user_id(user_id, *extra):
Obscures the user id, returning a sha1 hash
Any extra information can be added to the hash
"""
obs_hash = hmac.new(settings.SECRET_KEY.encode('ascii'), digestmod=hashlib.sha1)
obs_hash = hmac.new(settings.PROCTORING_USER_OBFUSCATION_KEY.encode('ascii'), digestmod=hashlib.sha1)
obs_hash.update(str(user_id).encode('utf-8'))
obs_hash.update(b''.join(str(ext).encode('utf-8') for ext in extra))
return obs_hash.hexdigest()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@edx/edx-proctoring",
"//": "Be sure to update the version number in edx_proctoring/__init__.py",
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.",
"version": "2.6.7",
"version": "3.0.0",
"main": "edx_proctoring/static/index.js",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
TRANSACTIONS_MANAGED = {}
USE_TZ = True
TIME_ZONE = 'UTC'
SECRET_KEY='SHHHHHH'
PROCTORING_USER_OBFUSCATION_KEY='SHHHHHH'
SECRET_KEY='HASHED_SECRET_KEY'
PLATFORM_NAME='Open edX'
FEATURES = {}
HTTPS = 'off'
Expand Down

0 comments on commit 3cf23c1

Please sign in to comment.