[P0][security] frontend SSR JSON 삽입 경로 XSS 방어 escaping 적용 #22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
문제
crates/portal-relay/src/api/frontend.rs에서 public leases를serde_json::to_string()후<script type="application/json">내부에 그대로 삽입합니다.serde_json::to_string()은 HTML script context escaping을 보장하지 않습니다.위험
lease metadata 등에
</script><script>...</script>형태의 문자열이 들어가면 script tag가 조기 종료되어 XSS가 가능합니다. landing card HTML은escape_html()을 쓰더라도 SSR JSON 삽입 경로는 별도 방어가 필요합니다.제안
<,>,&, U+2028, U+2029예시:
완료 기준
</script>가 포함된 lease metadata가 HTML에서 script tag를 닫지 않음검토 기준: 업로드된 Rust
portal-relay코드 정적 리뷰. 리뷰 환경에서는cargo check/test/clippy를 실행하지 못했습니다.수용했습니다. PR #62에서 SSR JSON을 script context용으로 <, >, &, U+2028, U+2029 escape하도록 변경하고 breakout 회귀 테스트를 추가했습니다. 검증: cargo test --locked, cargo clippy --locked --all-targets -- -D warnings.