1:1 Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-4Su6mBWzEIFnH4pAGMOuaeBrstwJN4Z3pq/s1Kn4/KQ='), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
http.headers(
headersConfigurer ->
headersConfigurer
.frameOptions(
//프레임 내의 로딩을 제한하고 공격자 페이지로 리다이렉션등을 방지하여 클릭재킹 공격 방지한다.
HeadersConfigurer.FrameOptionsConfig::sameOrigin
)
.contentSecurityPolicy(policyConfig ->//스크립트, 이미지, 폰트, 기본, 프레임소스를 제한하여 xss공격제한
policyConfig.policyDirectives(//default(모든컨텐츠적용)만 해도 동작은 함
"script-src 'self'; " + "img-src 'self'; " +
"font-src 'self' data:; " + "default-src 'self'; " +
"frame-src 'self'; " + "style-src 'self' 'unsafe-inline';"
)
)
);
securityConfig에 추가한다.
'트러블 슈팅' 카테고리의 다른 글
options.allowedHosts[0] should be a non-empty string (0) | 2024.02.15 |
---|---|
리액트 셋팅에 관련된 것 (0) | 2024.02.01 |
@QueryProjection의 Q객체 인식못함오류 (0) | 2024.01.23 |
MapStruct 맵핑 못하는 문제 (0) | 2024.01.04 |
ids for this class must be manually assigned before calling save(): (0) | 2024.01.03 |