11e9803965
- Project edit modal: color palette 12 columns; icon tabs [기본 아이콘] / [아사나 아이콘] (33 filled icons, value "asana:<name>", 6KB subset font material-symbols-asana.woff2) - Section names bold (board column, list group, rename input) - Inbox: clicking the left inbox area closes the task side panel - Replace top-right scope toggle with admin-only sidebar "전체 보기" (?scope=all, switches in place on project pages) - Description editor: text color and size; server keeps only validated color / font-size on plain spans (desc_inline_style) - Fix goals_meeting_ui [2e] for manual monthly target; bump asset versions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
2.2 KiB
Python
45 lines
2.2 KiB
Python
"""아사나 아이콘 값 검증 · 설명란 글자 색/크기 sanitize (2026-10-08)."""
|
|
import importlib
|
|
import unittest
|
|
|
|
store = importlib.import_module("app.modules.project.store")
|
|
|
|
|
|
class ProjectIconTests(unittest.TestCase):
|
|
def test_basic_and_asana_icons_accepted(self):
|
|
self.assertEqual(store.validate_project_icon("rocket_launch"), "rocket_launch")
|
|
self.assertEqual(store.validate_project_icon("asana:rocket_launch"), "asana:rocket_launch")
|
|
|
|
def test_unknown_or_malformed_rejected(self):
|
|
for v in ("asana:", "asana:nope", "asana:asana:rocket_launch", "nope", "Asana:rocket_launch", ""):
|
|
self.assertIsNone(store.validate_project_icon(v), v)
|
|
|
|
|
|
class DescStyleTests(unittest.TestCase):
|
|
def clean(self, html):
|
|
return store.sanitize_description_html(html)
|
|
|
|
def test_color_and_allowed_size_kept(self):
|
|
out = self.clean('<span style="color: rgb(224, 62, 62); font-size: 22px">a</span><span style="color:#ABC">b</span>')
|
|
self.assertEqual(out, '<span style="color: rgb(224, 62, 62); font-size: 22px">a</span><span style="color: #abc">b</span>')
|
|
|
|
def test_other_declarations_and_sizes_dropped(self):
|
|
out = self.clean('<span style="background:url(javascript:x); font-size: 99px; color: red; position:fixed">a</span>')
|
|
self.assertEqual(out, "<span>a</span>")
|
|
|
|
def test_style_injection_attempts_dropped(self):
|
|
out = self.clean('<span style="color: #fff;}body{display:none">a</span>'
|
|
'<span style="color: expression(alert(1))">b</span>')
|
|
# 선언을 다시 조립하므로 "}body{…" 같은 나머지는 사라지고 검증된 색만 남는다
|
|
self.assertEqual(out, '<span style="color: #fff">a</span><span>b</span>')
|
|
|
|
def test_style_only_on_plain_span(self):
|
|
self.assertEqual(self.clean('<p style="color:#fff">a</p>'), "<p>a</p>")
|
|
self.assertEqual(self.clean('<span class="pj-mention" data-email="a@b.c" style="color:#fff">@a</span>'),
|
|
'<span class="pj-mention" data-email="a@b.c">@a</span>')
|
|
self.assertEqual(self.clean('<font color="#ff0000">a</font>'), "a")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|