Commit Graph

6256 Commits

Author SHA1 Message Date
Ali Akbar
7fe43a3cbf Merge pull request #29519 from edx/aakbar/PROD-2590
feat: allow get account info on lms user id
2021-12-10 12:50:13 +05:00
Tim McCormack
9f9e0acc55 feat: Destroy session and send back an error if user identity changes (#28456)
A new feature toggle, default off, causes the session to be deleted when
the user identity on the response does not match the session or request.

There are a small number of requests that cause the user present on the
session at the time of the request to be a different user by the time of
the response. As far as I can tell, these are all cases where a user's
browser somehow ends up with a mix of cookies from multiple legitimate
login sessions on different accounts on the same device.

Because there no longer seems to be any case where this mismatch occurs
and where the response should be allowed through, this commit introduces
a feature toggle `ENFORCE_SAFE_SESSIONS` which will destroy the active
session and overwrite the response.

The plan is to make this behavior available in the next named release and
permanent in the one after.

Also:

- Use less fragile method of checking mocked set_attribute calls in tests
2021-12-09 19:23:22 +00:00
AliAkbar
c07c5bc0dd feat: allow get account info on lms user id 2021-12-09 20:27:18 +05:00
Michael Terry
e2e37154ce fix: add a couple guards for anonymous users
This fixes a couple places (LastSeenCoursewareTimezone and
UserCourseTag) where we were saving an entry for a user, but not
making sure we ignored anonymous users.
2021-12-09 10:26:51 -05:00
AsadAzam
3f06445389 feat: added pii params for program discussions (#29532)
* feat: added pii params for program discussions

* refactor: added conditions
2021-12-09 18:39:34 +05:00
Jawayria
472ccdabe0 Merge pull request #29431 from edx/jawayria/bom-2606-35
chore: Applied lint-amnesty on openedx/core/djangoapps
2021-12-09 18:20:46 +05:00
Jawayria
584c5daf16 Merge pull request #29432 from edx/jawayria/bom-2606-34
chore: Applied lint-amnesty on openedx/core/djangoapps
2021-12-09 18:20:23 +05:00
Jawayria
95eb23cc07 Merge pull request #29433 from edx/jawayria/bom-2606-33
chore: Applied lint-amnesty on openedx/core/djangoapps
2021-12-09 18:19:56 +05:00
Jawayria
29127830ff Merge pull request #29434 from edx/jawayria/bom-2606-32
chore: Applied lint-amnesty on openedx/core/djangoapps
2021-12-09 18:19:18 +05:00
Kshitij Sobti
00e3affa90 fix: Include all blocks and skip access checks for get_divided_discussions (#29539) 2021-12-09 16:20:31 +05:00
Jawayria
e48031cd86 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-09 13:39:45 +05:00
Jawayria
7663592aa6 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-09 13:37:27 +05:00
Jawayria
67b44d3b45 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-09 13:35:36 +05:00
Jawayria
8ccb8b0608 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-09 13:32:06 +05:00
Dillon Dumesnil
40964045e4 Merge pull request #29526 from edx/mikix/preserve-params-on-redirect
fix: when redirecting to the MFE, preserve query flags
2021-12-08 05:46:17 -08:00
edX requirements bot
bb20b17428 Python Requirements Update (#29516)
* chore: Updating Python Requirements

* fix: fix pylint issues

Co-authored-by: Mohammad Ahtasham ul Hassan <mohammad.ahtasham@arbisoft.com>
2021-12-08 14:13:27 +05:00
Uzair Rasheed
971dc175f6 Merge pull request #29522 from edx/add-prop-to-mark-users
refactor: add a property to distinguish old and new users
2021-12-08 01:42:29 +05:00
Michael Terry
bf2c2ce3c3 fix: when redirecting to the MFE, preserve query flags
This can potentially fix analytics based on query params like
utm_campaign and the like. And generally seems like the correct
thing to do.

AA-1128
2021-12-07 14:10:32 -05:00
Mohammad Ahtasham ul Hassan
8320dcb0e8 build: update stylint and eslint thresholds (#29471)
* build: update stylint and eslint thresholds

* Removed stylint threshold

* Update test_stylelint.py

* fix: fix eslint issues
2021-12-07 20:09:13 +05:00
uzairr
443034ed55 refactor: add a property to distinguish old and new users
Add a new prop in existing props to differentiate users either
a particular one is newly registered or not.

VAN-665
2021-12-07 17:59:31 +05:00
Zainab Amir
acf5add774 feat: add marketing email option on registration (#29397) 2021-12-07 17:16:28 +05:00
Kshitij Sobti
9f4bc9900b feat: add discussions context to course blocks API (#29300)
Add a new course blocks transformer that adds discussion context for units.
2021-12-07 11:10:48 +05:00
Dillon Dumesnil
f1cc288189 Merge pull request #29510 from edx/ddumesnil/override-freq-cap-aa-1127
feat: AA-1127: Overrides Braze Frequency Cap for dynamic pacing emails
2021-12-06 07:44:55 -08:00
Dillon Dumesnil
709290544d feat: AA-1127: Overrides Braze Frequency Cap for dynamic pacing emails
edx-ace version 1.4.1 introduces the ability to override braze
email frequency caps.
2021-12-06 07:56:28 -07:00
Jawayria
87c2a59d2b Merge pull request #29439 from edx/jawayria/bom-2606-39
chore: Applied lint-amnesty on openedx/features
2021-12-06 17:23:30 +05:00
Jawayria
a1c4b82cd5 Merge pull request #29435 from edx/jawayria/bom-2606-31
chore: Applied lint-amnesty on openedx/core/djangoapps
2021-12-06 15:23:46 +05:00
Jawayria
86d7cce373 Merge pull request #29436 from edx/jawayria/bom-2606-30
chore: Applied lint-amnesty on openedx/core/djangoapps/content
2021-12-06 15:23:25 +05:00
Jawayria
9cd4f96955 Merge pull request #29437 from edx/jawayria/bom-2606-29
chore: Applied lint-amnesty on openedx/core/djangoapps
2021-12-06 15:23:13 +05:00
Jawayria
61f3ef0724 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-06 14:06:57 +05:00
Jawayria
959b6cef6c chore: Applied lint-amnesty on openedx/core/djangoapps/content 2021-12-06 14:06:13 +05:00
Jawayria
3adfe1de97 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-06 14:05:13 +05:00
Jawayria
4347c35072 chore: Applied lint-amnesty on openedx/tests 2021-12-06 14:01:53 +05:00
Jawayria
328c181a38 chore: Applied lint-amnesty on openedx/features 2021-12-06 13:58:45 +05:00
Shafqat Farhan
84cba23c0b feat: VAN-666 - Reject new password that is detected as vulnerable on password reset 2021-12-03 19:19:21 +05:00
Régis Behmo
13342835b0 feat: theme-agnostic view to fetch theme assets (#29461)
It is possible to set custom logos in microfrontends, for instance with the
LOGO_URL setting. Ideally, we would like that MFEs share the same logos as the
LMS. But this is made difficult when comprehensive theming is enabled, and the
logo is overridden by a custom theme. In that scenario, the logo url becomes
/static/mytheme/images/logo.png. But the MFEs do no know that the "mytheme"
theme is enabled. To resolve this issue, we introduce here a view, at the
"/theming/asset/<path>" url, that redirects to the corresponding asset in the
theme that is currently enabled. Thus, MFEs only have to set
`LOGO_URL=http://lmshost/theming/asset/images/logo.png` to point to the themed
logo.

Related issue: https://github.com/overhangio/tutor-mfe/issues/25
2021-12-02 16:38:12 -05:00
Tim McCormack
02b9e059a2 feat: Remove monitoring for now-concluded verify-all work (#29495)
The removed attributes were needed in order to inform the move of the
`_verify_user` function call up out of the try/except block. That work has
concluded (https://github.com/edx/edx-platform/pull/29324) so the
monitoring can be removed.

Also:

- Bring a comment on some other monitoring up to date
- Make long-needed corrections to an existing docstring
- Remove malformed-cookie logging, since we haven't been using it
2021-12-02 18:45:48 +00:00
Usama Sadiq
780a6f3c2d Revert "chore: install codejail from pypi (#29481)" (#29501)
This reverts commit 21551095ac.
2021-12-02 22:19:15 +05:00
Jawayria
3a78775662 Merge pull request #29441 from edx/jawayria/bom-2606-37
chore: Applied lint-amnesty on openedx/core/lib
2021-12-02 19:13:06 +05:00
Jawayria
e83da77008 Merge pull request #29440 from edx/jawayria/bom-2606-40
chore: Applied lint-amnesty on openedx/features
2021-12-02 19:06:22 +05:00
Mohammad Ahtasham ul Hassan
21551095ac chore: install codejail from pypi (#29481)
* chore: install codejail from pypi

* chore: Updating Python Requirements

* chore: Updating Python Requirements

* fix: fixed failing tests

* fix: fixed pytest failures

* fix: fixed failing test bug

* Update mocks.py

Co-authored-by: edX requirements bot <testeng+edx-requirements-bot@edx.org>
2021-12-02 17:07:29 +05:00
Jawayria
dba7d78c74 chore: Applied lint-amnesty on openedx/core/lib 2021-12-02 15:11:13 +05:00
Jawayria
c227712f03 chore: Applied lint-amnesty on openedx/features 2021-12-02 15:02:24 +05:00
Tim McCormack
89699ed6a4 feat: Remove VERIFY_USER_CHANGE_UNCONDITIONAL toggle (now always enabled) (#29324)
We didn't see any errors after enabling this feature toggle, so remove it
in favor of the "True" setting.

Compare to PR #29306, which created the toggle.

ref: ARCHBOM-1952
2021-12-01 17:02:47 +00:00
Simon Chen
d1904bd99b fix: Ensure edX staff user can also see Honor Code modal dialog (#29479)
Co-authored-by: Simon Chen <schen@dhcp-10-31-112-124.dyn.mit.edu>
2021-12-01 10:13:27 -05:00
Syed Muhammad Dawoud Sheraz Ali
2325150cf8 feat: add referrer url when submitting Zendesk support ticket (#29474)
* feat: add referrer url as a custom field when submitting zendesk support ticket
2021-12-01 13:52:57 +05:00
Jawayria
2ce75cbfa7 chore: Applied lint-amnesty on openedx/core/djangoapps (#29442) 2021-11-30 15:08:25 +05:00
Jillian Vogel
ad5ad72273 [BD-13] Deprecate ModuleSystem.render_template (fixed) (#29354)
* refactor: deprecates ModuleSystem.render_template

in favor of the added MakoSystem render_template method.

Related changes:
* Adds the MakoService to the StudioEditModuleRuntime,
  PreviewModuleSystem, LmsModuleSystem, and XBlockRuntime
* MakoService constructor takes a `namespace_prefix` string, so that the
  CMS PreviewModuleSystem can render to LMS templates, without needing
  the special render_from_lms helper method.
* ModuleSystem.render_template becomes a read-only property, so the
  constructor calls and test module systems are updated accordingly.
* Adds tests for the MakoService and module system shims.

(cherry picked from commit 457f959356)

* refactor: use MakoService.render_template to remove deprecation warnings

from block code.

(cherry picked from commit 8d62d337f5)

* refactor: use MakoService.render_template to remove deprecation warnings

from test code.

(cherry picked from commit 26b43465a4)

* test: Adds a test to verify the bug introduced by the previous changes

The AuthoringMixin is automatically added to all XBlocks (see
settings.XBLOCK_MIXINS), and AuthoringMixin.visibility_view expects the
"mako" service.

This test verifies the bug by testing the PureXBlock, which does not
require the "mako" service, and so fails when the visibility_view is
rendered.

* fix: AuthoringMixin needs mako service

which fixes the visibility_view for XBlocks which don't explicitly
require the mako service.

Also removes the unneeded class property _services_requested from
AuthoringMixin and StudioEditableBlock. This property is better provided
by the XBlockMixin class.
2021-11-29 14:42:52 -05:00
Awais Jibran
72ec00cbb7 fix: include pii sharing values in the API (#29385) 2021-11-24 17:44:28 +05:00
Kshitij Sobti
c8bd924e23 feat: Add support for using the discussions MFE UI instead of existing UI [BD-38] [TNL-9228] (#29285)
* feat: Add support for using the discussions MFE UI instead of existing UI

Adds a new course waffle flag that when set along with the discussions MFE URL shows the discussions MFE UI instead of the regular UI.

* test: add tests

* squash!: more consistent url name
2021-11-23 14:56:25 +05:00
Tim McCormack
4efd2d161a fix: Correctly create origin from URL in CORS CSRF middleware (#29366)
Deleting all instances of the path from the URL meant that referers like
`https://learning.edx.org/` were turned into `https:learning.edx.org`. The
solution here is to use `urlunparse` to put the URL back together, but only
with the desired components (scheme and authority/netloc).

This relates to our previous upgrade to django-cors-headers 3.x, which
changed to use origins instead of domains in its whitelist setting:

36df86d829 (diff-811d60a3e1d60ff694eace0242e77d6b810d8e9c63c36d7b3c2591a08ebbb94bR58)

Added regression test (fails on master, passes on branch.)

Also:

- Replace word "domain" with "origin" in few places to use the correct
  term. (We should probably change this more broadly in names and comments
  in this module as some point.)
- Simplify logging to just output what we know, and not try to recapitulate
  the logic too much.

ref: BOM-2961
2021-11-22 17:49:57 +00:00