Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@
**Vulnerability:** ์‚ฌ์šฉ์ž ์ž…๋ ฅ๊ฐ’(`lang`)์„ ๊ฒ€์ฆ ์—†์ด `console.warn`๊ณผ ๊ฐ™์€ ๋กœ๊ทธ ํ•จ์ˆ˜์— ๊ทธ๋Œ€๋กœ ๋ณด๊ฐ„ํ•˜์—ฌ ์ถœ๋ ฅํ•  ๊ฒฝ์šฐ, ๋กœ๊ทธ ์ธ์ ์…˜(Log Forging) ๊ณต๊ฒฉ์— ๋…ธ์ถœ๋  ์ˆ˜ ์žˆ์Œ.
**Learning:** ์‚ฌ์šฉ์ž ์ž…๋ ฅ์ด ํฌํ•จ๋œ ๋ฌธ์ž์—ด์„ ์ง์ ‘ ๋ณด๊ฐ„ํ•˜๋ฉด ์•…์˜์ ์ธ ํŽ˜์ด๋กœ๋“œ๊ฐ€ ๋กœ๊ทธ ํŒŒ์ผ์— ์ฃผ์ž…๋˜์–ด ๋กœ๊ทธ ๋ถ„์„ ์‹œ์Šคํ…œ์„ ๋ฐฉํ•ดํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์ทจ์•ฝ์ ์„ ์—ฐ๊ณ„ํ•  ์ˆ˜ ์žˆ์Œ.
**Prevention:** ๋กœ๊ทธ๋ฅผ ๋‚จ๊ธธ ๋•Œ๋Š” ๊ฒ€์ฆ๋˜์ง€ ์•Š์€ ์™ธ๋ถ€ ์ž…๋ ฅ๊ฐ’์„ ๋™์ ์œผ๋กœ ๋ฌธ์ž์—ด์— ์ฃผ์ž…(Interpolation)ํ•˜๋Š” ๋Œ€์‹ , ์‚ฌ์ „์— ์ •์˜๋œ ์ •์ ์ด๊ณ  ์•ˆ์ „ํ•œ ๋ฉ”์‹œ์ง€๋กœ ๋Œ€์ฒดํ•ด์•ผ ํ•จ.
## 2026-08-27 - DOM ์กฐ์ž‘ ์‹œ ๋ฐฉ์–ด์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ ์šฉ
**Vulnerability:** ๋ˆ„๋ฝ๋œ DOM ์š”์†Œ์— ์ ‘๊ทผํ•  ๋•Œ null ์ฐธ์กฐ๋กœ ์ธํ•œ unhandled `TypeError` ๋ฐœ์ƒ ์œ„ํ—˜ (์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰ ์ค‘๋‹จ ์ดˆ๋ž˜).
**Learning:** ์ •์  ์‚ฌ์ดํŠธ์—์„œ ๋ฐ”๋‹๋ผ JavaScript๋ฅผ ์ž‘์„ฑํ•  ๋•Œ DOM ์š”์†Œ๋ฅผ ์กฐํšŒํ•œ ๋’ค ๊ฒฐ๊ณผ๊ฐ€ null์ธ์ง€ ํ™•์ธํ•˜์ง€ ์•Š์œผ๋ฉด, ํŠน์ • ์š”์†Œ๊ฐ€ ์—†๊ฑฐ๋‚˜ ๋ Œ๋”๋ง๋˜์ง€ ์•Š์•˜์„ ๋•Œ ์ „์ฒด ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰์ด ์ค‘๋‹จ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ทจ์•ฝ์ ์ด๋ผ๊ธฐ๋ณด๋‹ค๋Š” ๊ฐ€์šฉ์„ฑ๊ณผ ๊ฒฌ๊ณ ์„ฑ(Fail securely) ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค.
**Prevention:** `document.getElementById`๋‚˜ `closest`์™€ ๊ฐ™์€ DOM ์กฐํšŒ API๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ํ•ญ์ƒ ๋ฐ˜ํ™˜๋œ ์š”์†Œ๊ฐ€ ์กด์žฌํ•˜๋Š”์ง€ null ์ฒดํฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” ๋ฐฉ์–ด์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ(Defensive Programming) ํŒจํ„ด์„ ์ ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
15 changes: 13 additions & 2 deletions components/krds-gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@
tabList.forEach((t) => {
const sel = t === tab;
t.setAttribute("aria-selected", sel);
document.getElementById(t.getAttribute("aria-controls")).hidden = !sel;
const panelId = t.getAttribute("aria-controls");
if (panelId) {
const panel = document.getElementById(panelId);
if (panel) {
panel.hidden = !sel;
}
}
});
});
});
});
// Tag remove
document.querySelectorAll(".krds-tag__remove").forEach((btn) =>
btn.addEventListener("click", () => btn.closest(".krds-tag").remove())
btn.addEventListener("click", () => {
const tag = btn.closest(".krds-tag");
if (tag) {
tag.remove();
}
})
);
8 changes: 8 additions & 0 deletions tests/test_component_gallery_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ def test_component_gallery_inputs_have_length_limits() -> None:
if 'type="checkbox"' in inp or 'type="radio"' in inp:
continue
assert 'maxlength=' in inp, f"Input missing maxlength: {inp}"

def test_component_gallery_script_has_null_checks() -> None:
"""Ensure DOM operations practice defensive programming by checking for null."""
script_path = ROOT / "components" / "krds-gallery.js"
script = script_path.read_text(encoding="utf-8")
assert "if (panelId)" in script
assert "if (panel)" in script
assert "if (tag)" in script
Loading