Commit Graph

5589 Commits

Author SHA1 Message Date
Jawayria
310da0d6a7 BOM-2351: Removed unused imports from common/djangoapps/third_party_auth 2021-02-22 14:05:40 +05:00
Jawayria
caebb910f0 BOM-2351: Removed unused imports from common/djangoapps/student 2021-02-22 13:59:32 +05:00
mariagrimaldi
acc9eaed8c feat: Changed username max_length to get it from setting and set default to 30 chars 2021-02-19 15:29:14 -04:00
Aarif
a1406cddf2 replaced unittest assertions pytest assertions (#26528) 2021-02-18 18:09:45 +05:00
Aarif
802ae6343b replaced unittest assertions pytest assertions (#26527) 2021-02-18 18:08:52 +05:00
Aarif
7dfd6edd23 replaced unittest assertions pytest assertions (#26524) 2021-02-18 18:08:23 +05:00
Zainab Amir
c260f72c2e VAN-311: Add multiple enterprise support for Authn MFE (#26526) 2021-02-18 17:24:44 +05:00
Aarif
e6a0d35009 replaced unittest assertions pytest assertions (#26240) 2021-02-12 12:31:37 +05:00
Manjinder Singh
cd60646926 fix: Switch anonymous user ID hash from md5 to shake (#26198)
Now that we always return an existing value from the DB rather than trusting that ID generation is deterministic and constant over time, we're free to change the generation algorithm.

Our long term goal is to switch to random IDs, but we need to first investigate the uses of save=False. In the meantime, this is a good opportunity to move away from MD5, which has a number of cryptographic weaknesses. None of the known vulnerabilities are considered exploitable in this location, given the limited ability to control the input to the hash, but we should generally be moving away from it everywhere for consistency.

This change should not be breaking even for save=False callers, since those calls are extremely rare (1 in 100,000) and should only occur after a save=True call, at which point they'll use the stored value. Even if this were not true, for a save=False/True pair of calls to result in a mismatch in output, the first of the calls would have to occur around the time of the deploy of this code.

Co-authored-by: Tim McCormack <tmccormack@edx.org>
 
Co-authored-by: Tim McCormack <tmccormack@edx.org>
2021-02-10 07:37:27 -05:00
Tim McCormack
80a4437f33 fix: Always save generated anonymous user ID in DB; ignore save=False (#26399)
This deprecates `save=False` for several functions and removes all known
usages of the parameter but does not actually remove the parameter.
Instead, it will emit a deprecation warning if the parameter is used.
We can remove the parameter as soon as we feel sure nothing is using it.

Now that we have refactored `anonymous_id_for_user` to always prefer
retrieving an existing ID from the database -- and observed that only a
small fraction of calls pass save=False -- we can stop respecting
save=False. This opens the door for future improvements, such as generating
random IDs or switching to the external user ID system.

Metrics: I observe that 1 in 16 requests for new, non-request-cached
anon user IDs are made with save=False. But 71% of all calls are served
from the request cache, and 99.7% of the misses are served from the DB.
save=False only appear to come from intermittent spikes as reports are
generated and are low in absolute number.

Also document usage/risk/rotation of secret in anonymous user ID
generation as indicated by `docs/decisions/0008-secret-key-usage.rst`
ADR on `SECRET_KEY` usage.

ref: ARCHBOM-1683
2021-02-08 19:16:05 +00:00
Tim McCormack
ac7a9f405b refactor: Remove old version of anonymous user ID generation (#26398)
In commit 2723e0e2/PR #26162, we created a new version of the
`anonymous_id_for_user` method that would make it safe to rotate the
`SECRET_KEY` setting (without changing existing anonymous IDs). This
included a toggle to allow fast reversion to the old code if needed.

This commit removes the old code and the toggle as we are satisfied with
the correctness and performance of the new code.

ref: ARCHBOM-1645
2021-02-05 15:35:16 +00:00
Bianca Severino
e5cc220d96 Merge pull request #26357 from edx/bseverino/proctored-exam-email
[MST-636] Add additional check for proctoring requirements
2021-02-04 09:09:12 -05:00
Waheed Ahmed
38187de0f9 Authn MFE: Toggle for microfrontend redirect.
VAN-308
2021-02-04 18:58:58 +05:00
usamasadiq
e1ed3211c1 Applied pylint-amnesty to common/djangoapps/entitlements 2021-02-04 15:33:25 +05:00
Jawayria
b6b6489b96 Merge pull request #26313 from edx/amnesty-util
Applied pylint-amnesty to util
2021-02-04 14:44:50 +05:00
Zaman Afzal
fa98f0837e ENT-4034 Third party auth waffle switch annotation (#26304) 2021-02-04 13:21:39 +05:00
Bianca Severino
3f5cbcfc6a Check for an existing proctored exam before sending proctoring requirements email 2021-02-03 15:54:52 -05:00
Kyle McCormick
3185dda123 fix: Rename send_activation_email task (step 3/3) (#26329)
The old name was
`student.send_activation_email`.

The new name is now
`common.djangoapps.student.tasks.send_activation_email`.

We no longer user the old task name,
so we can safely stop registering it with Celery
workers, without fear of dropping any lingering
tasks under the old name.
2021-02-03 11:10:01 -05:00
Kyle McCormick
1d2d59f8bd Merge pull request #26328 from edx/kdmccormick/send-activation-email-2
fix: rename send_activation_email task (step 2/3)
2021-02-03 09:09:31 -05:00
Jawayria
200b318892 Resolved pylint error 2021-02-03 18:59:09 +05:00
Usama Sadiq
c304f6d0d0 Merge pull request #26317 from edx/usamasadiq/bom-2308-pylint-amnesty
Applied pylint-amnesty
2021-02-03 18:23:51 +05:00
Jawayria
ec24dfaec8 Merge pull request #26310 from edx/py-amnesty-student
Applied pylint-amnesty to student
2021-02-03 18:07:24 +05:00
Jawayria
2468698ea1 Merge pull request #26312 from edx/amnesty-track
Applied pylint-amnesty to track
2021-02-03 18:06:55 +05:00
Jawayria
dd99f8e02d Resolved quality errors 2021-02-03 17:05:12 +05:00
Jawayria
fbd60f1814 REsolved quality error 2021-02-03 17:01:52 +05:00
Jawayria
633b9f7060 resolved errors 2021-02-03 15:47:18 +05:00
Jawayria
45e5cbb599 Applied pylint-amnesty to student 2021-02-03 15:30:47 +05:00
Jawayria
0cdfdb7e9b Resolved issues 2021-02-03 15:29:53 +05:00
Jawayria
8086ca75f2 Applied pylint-amnesty to student 2021-02-03 15:29:53 +05:00
Jawayria
c958cf9920 Resolved quality failures 2021-02-03 13:43:56 +05:00
Jawayria
7be5a683aa Applied pylint-amnesty to third_party_auth 2021-02-03 13:37:05 +05:00
Jawayria
6be60b2fcc Resolved quality failures 2021-02-03 13:13:00 +05:00
Jawayria
62bc555817 Applied pylint-amnesty to track 2021-02-03 13:10:42 +05:00
Kyle McCormick
21adbc4b87 fix: Rename send_activation_email task (step 2/3)
The old name is
`student.send_activation_email`.

The new name is
`common.djangoapps.student.tasks.send_activation_email`.

We currently register both the old and the new task names,
such that Celery workers recognize the task by both names.
This commit switches us from the old name to the new name.
2021-02-02 10:31:38 -05:00
Kyle McCormick
b626a43fa1 fix: Rename some tasks to match new import paths (#26236)
Several tasks are explicitly named as (or like)
their old, deprecated import path.

The issue here is that django-user-tasks listens for task
invocations, and attempts to import the task based on its name.
If the task name is completely wrong, user-tasks will catch
the ImportError and move on.
If the task is a valid *deprecated* import, though, then
user-tasks will choke on the raised `DeprecatedEdxPlatformImportError`.

Thus, we must rename three tasks to their new full path:
1. entitlements.expire_old_enrollments
2. third_party_auth.fetch_saml_metadata
3. student.send_activation_email

The first two are run daily, and so are safe to be
renamed in place.

The third task must be renamed using an expand-contract
pattern; otherwise, we would drop hundreds of tasks
during the App vs. Worker out-of-sync version window
that happens at deployments.
This commit is the expand phase.
2021-02-02 10:26:08 -05:00
Usama Sadiq
29d715d82d Merge pull request #26301 from edx/test
Applied pylint-amnesty to pipeline_mako
2021-02-02 20:19:11 +05:00
Jawayria
edfced071d Resolved quality errors 2021-02-02 19:19:33 +05:00
Jawayria
4dad2ab406 Applied pylint-amnesty to static_replace 2021-02-02 19:19:33 +05:00
Jawayria
3f1fd27534 Resolved quality error 2021-02-02 18:36:41 +05:00
usamasadiq
240a8c2e1a Fix pep8 errors 2021-02-02 18:36:39 +05:00
Jawayria
9059dee397 Applied pylint-amnesty to util 2021-02-02 18:36:39 +05:00
Jawayria
6f06cc5e05 Applied pylint-amnesty to pipeline_mako 2021-02-02 18:32:11 +05:00
usamasadiq
de99865eb6 Fix pep8 errors 2021-02-02 17:59:20 +05:00
usamasadiq
515458b9dc Applied pylint-amnesty 2021-02-02 17:59:20 +05:00
Usama Sadiq
84deed7ad8 Merge pull request #26314 from edx/amnesty-xblockdjango
Applied pylint-amnesty to xblock_django
2021-02-02 16:51:12 +05:00
Usama Sadiq
390429f8fb Merge pull request #26306 from edx/amnesty-terrain
Applied pylint-amnesty to terrain
2021-02-02 16:51:01 +05:00
Usama Sadiq
8f919bdbe1 Merge pull request #26303 from edx/amnesty-status
Applied pylint-amnesty to status
2021-02-02 16:50:46 +05:00
Jawayria
f3846144a5 Applied pylint-amnesty to xblock_django 2021-02-02 15:09:08 +05:00
Jawayria
fb6a62b753 Applied pylint-amnesty to terrain 2021-02-02 14:37:08 +05:00
Zaman Afzal
712a6bcc0c ENT-4034 Added more detail in exception (#26299) 2021-02-02 13:54:20 +05:00