Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b637229886 |
|||
|
21d9295635 |
|||
|
bdd301c699 |
|||
|
295147b451 |
|||
|
36e1101a15 |
|||
|
b806d49ccb |
|||
|
ed58cd2c2b |
|||
|
f728cc6002 |
|||
|
7999246d73 |
6 changed files with 95 additions and 33 deletions
23
CHANGELOG
23
CHANGELOG
|
|
@ -1,3 +1,26 @@
|
|||
##################
|
||||
# Version 19.0.9 #
|
||||
##################
|
||||
|
||||
SECURITY:
|
||||
|
||||
* Fixed an issue that allowed arbitrary code execution when using non-raw mode
|
||||
in `pythonic` question type.
|
||||
|
||||
|
||||
##################
|
||||
# Version 19.0.7 #
|
||||
##################
|
||||
|
||||
SECURITY:
|
||||
|
||||
* Fixed issue that allowed access to `list_users` API endpoint in some cases
|
||||
when it should not have been allowed
|
||||
|
||||
* Added option to prevent impersonations that increase permissions, via
|
||||
`cs_impersonation_allowed`
|
||||
|
||||
|
||||
##################
|
||||
# Version 19.0.6 #
|
||||
##################
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ def handle_submission(submissions, **info):
|
|||
}
|
||||
sub = test_result_sub["info"]["result"]
|
||||
if info["csq_mode"] != "raw":
|
||||
sub = eval(sub, info)
|
||||
sub = ast.literal_eval(sub)
|
||||
except Exception as err:
|
||||
msg = ""
|
||||
mfunc = info["csq_msg_function"]
|
||||
|
|
|
|||
|
|
@ -37,9 +37,14 @@ if error is None:
|
|||
uinfo = output["user_info"]
|
||||
if "admin" not in uinfo["permissions"]:
|
||||
error = "Permission Denied"
|
||||
else:
|
||||
error = "Invalid API Token"
|
||||
|
||||
if error is None:
|
||||
output = {"ok": True, "result": csm_user.list_all_users(globals(), course)}
|
||||
try:
|
||||
output = {"ok": True, "result": csm_user.list_all_users(globals(), course)}
|
||||
except FileNotFoundError:
|
||||
output = {"ok": False, "error": "Invalid Course"}
|
||||
else:
|
||||
output = {"ok": False, "error": error}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import pkg_resources
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
from .base_context import cs_version, cs_version_codename
|
||||
|
||||
|
|
|
|||
|
|
@ -174,17 +174,6 @@ def _get_user_information(context, into, course, username, do_preload=False):
|
|||
plist = context.get("cs_permissions", {})
|
||||
defaults = context.get("cs_default_permissions", {"view"})
|
||||
into["permissions"] = set(plist.get(into["role"], defaults))
|
||||
spoofed_role = context.get("cs_form", {}).get("as_role", None)
|
||||
if spoofed_role is not None and "impersonate" in into["permissions"]:
|
||||
into["role"] = spoofed_role
|
||||
orig_p = into["permissions"]
|
||||
spoofed_p = plist.get(spoofed_role, defaults)
|
||||
new_p = set(spoofed_p).intersection(set(orig_p))
|
||||
for i in ("submit_all", "view_all"):
|
||||
lesser = i.split("_")[0]
|
||||
if i in orig_p and i not in new_p and lesser in spoofed_p:
|
||||
new_p.add(lesser)
|
||||
into["permissions"] = new_p
|
||||
|
||||
# impersonation
|
||||
if ("as" in context.get("cs_form", {})) and ("real_user" not in into):
|
||||
|
|
@ -201,6 +190,31 @@ def _get_user_information(context, into, course, username, do_preload=False):
|
|||
into["role"] = None
|
||||
del into["permissions"]
|
||||
into = get_user_information(context)
|
||||
|
||||
check_impersonate = context.get(
|
||||
"cs_impersonation_allowed", lambda old, new: True
|
||||
)
|
||||
if not check_impersonate(old, into):
|
||||
# this impersonation is not allowed; reset everything
|
||||
into = old
|
||||
context["cs_username"] = into["username"]
|
||||
del into["p"]
|
||||
del into["preserve_permissions"]
|
||||
|
||||
# handle spoofed permissions
|
||||
spoofed_role = context.get("cs_form", {}).get("as_role", None)
|
||||
if spoofed_role is not None and "impersonate" in into["permissions"]:
|
||||
orig_p = into["permissions"]
|
||||
spoofed_p = plist.get(spoofed_role, defaults)
|
||||
new_p = set(spoofed_p).intersection(set(orig_p))
|
||||
for i in ("submit_all", "view_all"):
|
||||
lesser = i.split("_")[0]
|
||||
if i in orig_p and i not in new_p and lesser in spoofed_p:
|
||||
new_p.add(lesser)
|
||||
into["permissions"] = new_p
|
||||
if new_p != orig_p:
|
||||
into["role"] = spoofed_role
|
||||
|
||||
cslog = context["csm_cslog"]
|
||||
if "username" in into:
|
||||
logininfo = cslog.most_recent(
|
||||
|
|
|
|||
|
|
@ -1,17 +1,40 @@
|
|||
bs4
|
||||
cheroot
|
||||
filelock
|
||||
python-jose
|
||||
mistletoe
|
||||
mpmath
|
||||
ply
|
||||
pynacl
|
||||
websockets
|
||||
lxml
|
||||
pylti
|
||||
oauthlib
|
||||
unidecode
|
||||
ldap3
|
||||
black
|
||||
pytest
|
||||
setuptools
|
||||
beautifulsoup4==4.13.5
|
||||
black==25.9.0
|
||||
bs4==0.0.2
|
||||
cffi==2.0.0
|
||||
cheroot==11.0.0
|
||||
click==8.3.0
|
||||
ecdsa==0.19.1
|
||||
filelock==3.19.1
|
||||
httplib2==0.31.0
|
||||
iniconfig==2.1.0
|
||||
jaraco.functools==4.3.0
|
||||
ldap3==2.9.1
|
||||
lxml==6.0.2
|
||||
mistletoe==1.4.0
|
||||
more-itertools==10.8.0
|
||||
mpmath==1.3.0
|
||||
mypy_extensions==1.1.0
|
||||
oauth2==1.9.0.post1
|
||||
oauthlib==3.3.1
|
||||
packaging==25.0
|
||||
pathspec==0.12.1
|
||||
platformdirs==4.4.0
|
||||
pluggy==1.6.0
|
||||
ply==3.11
|
||||
pyasn1==0.6.1
|
||||
pycparser==2.23
|
||||
Pygments==2.19.2
|
||||
PyLTI==0.7.0
|
||||
PyNaCl==1.6.0
|
||||
pyparsing==3.2.5
|
||||
pytest==8.4.2
|
||||
python-jose==3.5.0
|
||||
pytokens==0.1.10
|
||||
rsa==4.9.1
|
||||
setuptools==80.9.0
|
||||
six==1.17.0
|
||||
soupsieve==2.8
|
||||
typing_extensions==4.15.0
|
||||
Unidecode==1.4.0
|
||||
websockets==12.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue