XSS 방지 처리
xss-rule.yml
# XSS Rule setting ###########################################
xss:
direction: response #request(요청시에만), response(응답시에만), both(요청,응답 모두) XSS필터링이 적용됨
allowElements: -> 허용할 Element 작성
- a
- img
- div
- ul
- li
- link
- input
allowAttributes: -> 허용할 Element의 허용할 Attribute 작성
img:
- alt
- align
- title
- img
div:
- class
- id
- style
allowUrls: -> 허용할 URL 목록과 각 URL에 허용할 Attribute 작성 (allowElements와 allowAttributes도 포함하여 적용됨)
- url: /api/display/samples/xss2
allowElements:
- button
allowAttributes:
- url: /api/display/**/url -> ** 패턴 사용가능
allowElements:
- a
allowAttributes:
img:
- alt
- align
- title
- imgXssSanitizer 커스텀 어노테이션

비즈니스 로직에서 XssProtectUtils 함수 사용

마지막 업데이트