Close medium exposure on reports, registration, uploads, and exercise HTML.
Deploy Development / deploy (push) Successful in 59s
Test Suite / pytest-backend (push) Failing after 47s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 17s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Failing after 7m48s
Deploy Development / deploy (push) Successful in 59s
Test Suite / pytest-backend (push) Failing after 47s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 17s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Failing after 7m48s
A superadmin can also turn off another account''s two-factor when the authenticator is lost. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
5ea225ec6b
commit
f10c28e5cd
20 files changed
+480
-247
No files matched your search
@@ -10,11 +10,31 @@ from exercise_rich_text import (
|
||||
assert_no_inline_media_references_on_create,
|
||||
collect_inline_exercise_media_ids,
|
||||
normalize_inline_exercise_media_markup,
|
||||
sanitize_exercise_rich_html,
|
||||
validate_inline_exercise_media_ids_for_exercise,
|
||||
)
|
||||
|
||||
|
||||
def test_normalize_curly_to_span() -> None:
|
||||
def test_normalize_strips_script_and_handlers() -> None:
|
||||
raw = '<p onclick="alert(1)">Hallo <script>alert(1)</script></p><a href="javascript:alert(1)">Link</a>'
|
||||
out = normalize_inline_exercise_media_markup(raw)
|
||||
assert out is not None
|
||||
lowered = out.lower()
|
||||
assert "script" not in lowered
|
||||
assert "onclick" not in lowered
|
||||
assert "javascript:" not in lowered
|
||||
assert "Hallo" in out
|
||||
assert "Link" in out
|
||||
|
||||
|
||||
def test_normalize_keeps_inline_media_span() -> None:
|
||||
raw = '<span class="shinkan-inline-media evil" data-shinkan-exercise-media="7" data-shinkan-exercise-media-size="full">x</span>'
|
||||
out = sanitize_exercise_rich_html(raw)
|
||||
assert out is not None
|
||||
assert 'data-shinkan-exercise-media="7"' in out
|
||||
assert 'data-shinkan-exercise-media-size="full"' in out
|
||||
assert "shinkan-inline-media" in out
|
||||
assert "evil" not in out
|
||||
s = '<p>Vor {{exerciseMedia: 42 }} nach</p>'
|
||||
out = normalize_inline_exercise_media_markup(s)
|
||||
assert 'data-shinkan-exercise-media="42"' in out
|
||||
|
||||
Reference in new issue
Block a user