{"id":10043,"date":"2025-11-11T02:47:00","date_gmt":"2025-11-10T17:47:00","guid":{"rendered":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/?p=10043"},"modified":"2025-11-16T07:25:25","modified_gmt":"2025-11-15T22:25:25","slug":"spring-security%e3%81%a7csp%ef%bc%88content-security-policy%ef%bc%89%e5%af%be%e7%ad%96%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f%e8%a9%b1","status":"publish","type":"post","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043","title":{"rendered":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71"},"content":{"rendered":"<div class=\"veu_autoEyeCatchBox\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"648\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg\" class=\"attachment-large size-large wp-post-image\" alt=\"\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg 800w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca-300x259.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca-768x663.jpg 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/div>\n<p>\u3053\u3093\u306b\u3061\u306f\u3001\u732b\u597d\u304d\u30ea\u30fc\u30de\u30f3\u306e\u307b\u3052PG\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3042\u308b\u65e5\u3001\u3044\u3064\u3082\u306e\u3088\u3046\u306bOWASP ZAP\u3067\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30c1\u30a7\u30c3\u30af\u3092\u3057\u3066\u3044\u305f\u3089\u3001\u3053\u3093\u306a\u8b66\u544a\u304c\u51fa\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u300cContent-Security-Policy\u30d8\u30c3\u30c0\u30fc\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\uff01\u300d<\/p>\n\n\n\n<p>\u2026\u2026\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u4eca\u56de\u306f <strong>CSP<\/strong><strong>\uff08Content-Security-Policy<\/strong><strong>\uff09\u5bfe\u7b56<\/strong> \u3092Spring Security\u3067\u3069\u3046\u5b9f\u88c5\u3059\u308b\u304b\u3001\u5b9f\u969b\u306b\u3084\u3063\u3066\u307f\u305f\u5185\u5bb9\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u305d\u3082\u305d\u3082CSP<\/strong><strong>\u3063\u3066\uff1f<\/strong><\/p>\n\n\n\n<p>CSP\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u304c\u8aad\u307f\u8fbc\u3080\u30ea\u30bd\u30fc\u30b9\u306e\u7a2e\u985e\u3084\u51fa\u6240\u3092\u5236\u9650\u3059\u308b\u3053\u3068\u3067\u3001XSS\uff08\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\uff09\u306a\u3069\u306e\u653b\u6483\u3092\u9632\u3050\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4e2d\u3067\u3082\u7279\u306b\u53b3\u3057\u3044\u306e\u304c script-src \u3068 style-src \u306e\u5236\u9650\u3002\u3053\u308c\u3089\u3092\u9069\u5207\u306b\u8a2d\u5b9a\u3057\u306a\u3044\u3068\u3001ZAP\u5148\u751f\u306b\u6012\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u6012\u3089\u308c\u305f\u30b3\u30fc\u30c9\u305f\u3061<\/strong><\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u304cCSP\u7684\u306b\u306fNG\u3068\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u6012\u3089\u308c\u308b\u30b3\u30fc\u30c9\u2460<\/strong><strong>\uff1aonclick <\/strong><strong>\u306b\u76f4\u63a5JavaScript<\/strong><strong>\u3092\u66f8\u304f<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#ededed\"><code>&lt;form name=\"logoutForm\" action=\"\/logout\" method=\"POST\">\n\u00a0\u00a0\u00a0 &lt;a onclick=\"logoutForm.submit();\">Logout&lt;\/a>\n&lt;\/form>\u00a0<\/code><\/pre>\n\n\n\n<p><strong>\u6012\u3089\u308c\u308b\u30b3\u30fc\u30c9\u2461<\/strong><strong>\uff1a&lt;script&gt; <\/strong><strong>\u30bf\u30b0\u5185\u306b\u76f4\u63a5JavaScript<\/strong><strong>\u3092\u66f8\u304f<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#ededed\"><code>&lt;script>\n$(window).on(\"load\", <strong>function<\/strong>() {\n\u00a0\u00a0\u00a0\u00a0\u00a0 \u2026\n});\n&lt;\/script>\u00a0\u00a0<\/code><\/pre>\n\n\n\n<p><strong>\u6012\u3089\u308c\u308b\u30b3\u30fc\u30c9\u2462<\/strong><strong>\uff1astyle <\/strong><strong>\u5c5e\u6027\u306b\u76f4\u63a5CSS<\/strong><strong>\u3092\u66f8\u304f<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#ededed\"><code>&lt;div style=\"background: green;\">\n&lt;h3>\u30c8\u30c3\u30d7&lt;\/h3>\n&lt;\/div>\u00a0<\/code><\/pre>\n\n\n\n<p><strong>\u6012\u3089\u308c\u308b\u30b3\u30fc\u30c9\u2463<\/strong><strong>\uff1a&lt;style&gt; <\/strong><strong>\u30bf\u30b0\u5185\u306b\u76f4\u63a5CSS<\/strong><strong>\u3092\u66f8\u304f<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#ededed\"><code>&lt;style>\n\u00a0\u00a0\u00a0 .cusor-pointer {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cursor : pointer;\n\u00a0\u00a0\u00a0 }\n&lt;\/style>\u00a0\u00a0<\/code><\/pre>\n\n\n\n<p>\u3064\u307e\u308a\u3001<strong>\u30a4\u30f3\u30e9\u30a4\u30f3\u306e<\/strong><strong>JavaScript<\/strong><strong>\u3084CSS<\/strong><strong>\u306f\u5168\u90e8\u30a2\u30a6\u30c8<\/strong>\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p><strong>\u5bfe\u7b56\u65b9\u6cd5\uff1a\u30a4\u30f3\u30e9\u30a4\u30f3\u30b3\u30fc\u30c9\u3092\u5916\u306b\u51fa\u3059<\/strong><\/p>\n\n\n\n<p>\u57fa\u672c\u7684\u306a\u5bfe\u7b56\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3001<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>JavaScript \u2192 .js \u30d5\u30a1\u30a4\u30eb\u306b\u5206\u96e2<\/li>\n\n\n\n<li>CSS \u2192 .css \u30d5\u30a1\u30a4\u30eb\u306b\u5206\u96e2<\/li>\n<\/ul>\n\n\n\n<p>\u3068\u3044\u3046\u5f62\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3057\u3001\u65e2\u5b58\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3053\u308c\u3092\u3084\u308b\u306e\u306f\u6b63\u76f4\u3057\u3093\u3069\u3044\u2026\u2026\u3002\u30d5\u30a1\u30a4\u30eb\u5206\u3051\u3001ID\u306e\u6574\u7406\u3001\u5171\u901a\u5316\u306a\u3069\u3001\u8003\u3048\u308b\u3053\u3068\u304c\u5c71\u7a4d\u307f\u3067\u3059\u3002<\/p>\n\n\n\n<p><strong>\u73fe\u5b9f\u7684\u306a\u5bfe\u5fdc\uff1anonce <\/strong><strong>\u3092\u4f7f\u3046<\/strong><\/p>\n\n\n\n<p>\u305d\u3053\u3067\u767b\u5834\u3059\u308b\u306e\u304c nonce\uff08\u30ca\u30f3\u30b9\uff09\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3002<\/p>\n\n\n\n<p>CSP\u30d8\u30c3\u30c0\u30fc\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#e7e7e7\"><code>Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-xxxx'; style-src 'self' 'nonce-xxxx';<\/code><\/pre>\n\n\n\n<p>\u203b xxxx \u306f\u30e9\u30f3\u30c0\u30e0\u306a\u6587\u5b57\u5217\uff08\u6bce\u56de\u5909\u308f\u308b\uff09<\/p>\n\n\n\n<p>HTML\u5074\u3067\u306f\u3001&lt;script&gt; \u3084 &lt;style&gt; \u30bf\u30b0\u306b nonce \u5c5e\u6027\u3092\u4ed8\u3051\u308b\u3053\u3068\u3067\u3001\u30a4\u30f3\u30e9\u30a4\u30f3\u30b3\u30fc\u30c9\u3067\u3082\u8a31\u53ef\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#eeeeee\"><code>&lt;script nonce=\"xxxx\"\n>\u2026\n&lt;\/script><\/code><\/pre>\n\n\n\n<p><strong>Spring Boot<\/strong><strong>\u3067\u306e\u5b9f\u88c5\u4f8b<\/strong><\/p>\n\n\n\n<p>Spring Security\u3067CSP\u30d8\u30c3\u30c0\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>WebSecurityConfig.java<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#ebebeb\"><code>@Configuration\n@EnableWebSecurity\npublic class WebSecurityConfig {\n\t\n    @Bean\n    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {\n        http\n                \u2026\n                .headers(headers -> headers\n                        .contentSecurityPolicy(csp -> csp\n                                .policyDirectives(\"default-src 'self' 'nonce-{nonce}';\"\n                                        + \" frame-ancestors 'none'; form-action 'self';\")\n                                ))\n                .addFilterBefore(new CspNonceFilter(), HeaderWriterFilter.class)\n                .addFilterBefore(new LoginUserFilter(), UsernamePasswordAuthenticationFilter.class)\n                \u2026\n        return http.build();\n    }\n\n    public static class CspNonceFilter implements Filter {\n        private static final SecureRandom secureRandom = new SecureRandom();\n        @Override\n        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)\n                throws IOException, ServletException {\n            HttpServletRequest httpRequest = (HttpServletRequest) request;\n            String uri = httpRequest.getServletPath();\n            if (!checkStaticPath(uri)) {\n                byte&#091;] nonceBytes = new byte&#091;16];\n                secureRandom.nextBytes(nonceBytes);\n                String nonce = Base64Utils.encodeToString(nonceBytes);\n                request.setAttribute(\"cspNonce\", nonce);\n                chain.doFilter(request, new CspNonceResponseWrapper((HttpServletResponse) response, nonce));\n            } else {\n                chain.doFilter(request, response);\n            }\n        }\n        private boolean checkStaticPath(String path) {\n            return path.startsWith(\"\/static\/\");\n        }\n    }\n    \n    public static class CspNonceResponseWrapper extends HttpServletResponseWrapper {\n        private final String nonce;\n        public CspNonceResponseWrapper(HttpServletResponse response, String nonce) {\n            super(response);\n            this.nonce = nonce;\n        }\n        private String getHeaderValue(String name, String value) {\n            if (name.equals(\"Content-Security-Policy\") &amp;&amp; StringUtils.hasText(value)) {\n                return value.replace(\"{nonce}\", nonce);\n            } else {\n                return value;\n            }\n        }\n        @Override\n        public void setHeader(String name, String value) {\n            super.setHeader(name, getHeaderValue(name, value));\n        }\n        @Override\n        public void addHeader(String name, String value) {\n            super.addHeader(name, getHeaderValue(name, value));\n        }\n    }\n    \n    @ControllerAdvice\n    public static class CspNonceControllerAdvice {\n        @ModelAttribute\n        public void addAttributes(Model model, HttpServletRequest request) {\n            model.addAttribute(\"nonce\", request.getAttribute(\"cspNonce\"));\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p><strong>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5074\u306e\u5bfe\u5fdc\uff08Thymeleaf<\/strong><strong>\uff09<\/strong><\/p>\n\n\n\n<p>Thymeleaf\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b th:nonce=&#8221;${nonce}&#8221; \u3092\u66f8\u304f\u3060\u3051\u3067OK\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#eaeaea\"><code>\u2026\n        &lt;form name=\"logoutForm\" th:action=\"@{\/logout}\" method=\"post\" class=\"ms-auto link-light\">\n          &lt;a id=\"logout\" th:text=\"#{auth.logout}\">Logout&lt;\/a>\n        &lt;\/form>\n\u2026\n      &lt;script th:nonce=\"${nonce}\">\n      $(window).on(\"load\", function() {\n        $(\"#logout\").on('click', function(e) {\n          document.logoutForm.submit();\n        });\n      });\n      &lt;\/script>\n\u2026<\/code><\/pre>\n\n\n\n<p>\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u3084\u30af\u30e9\u30b9\u306e\u5207\u308a\u66ff\u3048\u306a\u3069\u3001\u591a\u5c11\u306e\u5de5\u592b\u306f\u5fc5\u8981\u3067\u3059\u304c\u3001\u69cb\u6210\u3092\u5927\u304d\u304f\u5909\u3048\u305a\u306b\u6e08\u3080\u306e\u304c\u5b09\u3057\u3044\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002<\/p>\n\n\n\n<p><strong>\u307e\u3068\u3081<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CSP\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u3068\u3057\u3066\u91cd\u8981<\/li>\n\n\n\n<li>\u30a4\u30f3\u30e9\u30a4\u30f3\u30b3\u30fc\u30c9\u306f\u57fa\u672cNG<\/li>\n\n\n\n<li>nonce \u3092\u4f7f\u3048\u3070\u3001\u65e2\u5b58\u69cb\u6210\u3092\u5927\u304d\u304f\u5909\u3048\u305a\u306b\u5bfe\u5fdc\u53ef\u80fd<\/li>\n\n\n\n<li>Spring Security + Thymeleaf\u306a\u3089\u6bd4\u8f03\u7684\u30b9\u30e0\u30fc\u30ba\u306b\u5c0e\u5165\u3067\u304d\u308b<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4e00\u5f0f\u3082\u7528\u610f\u3057\u3066\u3042\u308b\u306e\u3067\u3001\u8208\u5473\u3042\u308b\u65b9\u306f\u305c\u3072\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/file\/hoge-springsecurity.zip\">\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a><\/div>\n<\/div>\n\n\n\n<p>\u203b\u5143\u6587\u66f8\u3092\u9069\u5f53\u306b\u4f5c\u6210\u3057Copilot\u3067\u751f\u6210<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u732b\u597d\u304d\u30ea\u30fc\u30de\u30f3\u306e\u307b\u3052PG\u3067\u3059\u3002 \u3042\u308b\u65e5\u3001\u3044\u3064\u3082\u306e\u3088\u3046\u306bOWASP ZAP\u3067\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30c1\u30a7\u30c3\u30af\u3092\u3057\u3066\u3044\u305f\u3089\u3001\u3053\u3093\u306a\u8b66\u544a\u304c\u51fa\u307e\u3057\u305f\u3002 \u300cContent-Security-Policy\u30d8\u30c3\u30c0\u30fc\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10108,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","vkExUnit_EyeCatch_disable":"","_veu_custom_css":"","veu_display_promotion_alert":"common","vkexunit_cta_each_option":"","footnotes":""},"categories":[6],"tags":[1174,1175,28,1177,1166,1165],"class_list":["post-10043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineer","tag-content-security-policy","tag-csp","tag-hoge","tag-nonce","tag-spring-security-5","tag-springboot-2-7"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"akiyama\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"ja_JP\" \/>\n\t\t<meta property=\"og:site_name\" content=\"OIS\u30d6\u30ed\u30b0 | OIS\u306e\u30d6\u30ed\u30b0\u7d39\u4ecb\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71 | OIS\u30d6\u30ed\u30b0\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t\t<meta property=\"og:image:height\" content=\"691\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2025-11-10T17:47:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2025-11-15T22:25:25+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/orientalinformationservice\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@ois_yokohama\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71 | OIS\u30d6\u30ed\u30b0\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@ois_yokohama\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#article\",\"name\":\"Spring Security\\u3067CSP\\uff08Content-Security-Policy\\uff09\\u5bfe\\u7b56\\u3057\\u3066\\u307f\\u305f\\u8a71 | OIS\\u30d6\\u30ed\\u30b0\",\"headline\":\"Spring Security\\u3067CSP\\uff08Content-Security-Policy\\uff09\\u5bfe\\u7b56\\u3057\\u3066\\u307f\\u305f\\u8a71\",\"author\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/author\\\/akiyama#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/\\u83ca.jpg\",\"width\":800,\"height\":691},\"datePublished\":\"2025-11-11T02:47:00+09:00\",\"dateModified\":\"2025-11-16T07:25:25+09:00\",\"inLanguage\":\"ja\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#webpage\"},\"articleSection\":\"\\u6280\\u8853\\u8b1b\\u7fd2, Content-Security-Policy, csp, hoge, nonce, spring security 5, springboot 2.7\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/category\\\/engineer#listItem\",\"name\":\"\\u6280\\u8853\\u8b1b\\u7fd2\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/category\\\/engineer#listItem\",\"position\":2,\"name\":\"\\u6280\\u8853\\u8b1b\\u7fd2\",\"item\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/category\\\/engineer\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#listItem\",\"name\":\"Spring Security\\u3067CSP\\uff08Content-Security-Policy\\uff09\\u5bfe\\u7b56\\u3057\\u3066\\u307f\\u305f\\u8a71\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#listItem\",\"position\":3,\"name\":\"Spring Security\\u3067CSP\\uff08Content-Security-Policy\\uff09\\u5bfe\\u7b56\\u3057\\u3066\\u307f\\u305f\\u8a71\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/category\\\/engineer#listItem\",\"name\":\"\\u6280\\u8853\\u8b1b\\u7fd2\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/#organization\",\"name\":\"OIS\\u30d6\\u30ed\\u30b0\",\"description\":\"OIS\\u306e\\u30d6\\u30ed\\u30b0\\u7d39\\u4ecb\",\"url\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/OIS\\u30ed\\u30b4-\\u6587\\u5b57\\u306a\\u3057.png\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043\\\/#organizationLogo\",\"width\":128,\"height\":128},\"image\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/orientalinformationservice\",\"https:\\\/\\\/x.com\\\/ois_yokohama\",\"https:\\\/\\\/www.instagram.com\\\/ois_yokohama1978\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/author\\\/akiyama#author\",\"url\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/author\\\/akiyama\",\"name\":\"akiyama\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff5bd4b5c6242b44911d761454b7fa2ee660c3e49a42278fda2507916d9816d2?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"akiyama\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#webpage\",\"url\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043\",\"name\":\"Spring Security\\u3067CSP\\uff08Content-Security-Policy\\uff09\\u5bfe\\u7b56\\u3057\\u3066\\u307f\\u305f\\u8a71 | OIS\\u30d6\\u30ed\\u30b0\",\"inLanguage\":\"ja\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/author\\\/akiyama#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/author\\\/akiyama#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/\\u83ca.jpg\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043\\\/#mainImage\",\"width\":800,\"height\":691},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/archives\\\/10043#mainImage\"},\"datePublished\":\"2025-11-11T02:47:00+09:00\",\"dateModified\":\"2025-11-16T07:25:25+09:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/#website\",\"url\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/\",\"name\":\"OIS\\u30d6\\u30ed\\u30b0\",\"description\":\"OIS\\u306e\\u30d6\\u30ed\\u30b0\\u7d39\\u4ecb\",\"inLanguage\":\"ja\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.ois-yokohama.co.jp\\\/oisblog2018\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71 | OIS\u30d6\u30ed\u30b0","description":"","canonical_url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#article","name":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71 | OIS\u30d6\u30ed\u30b0","headline":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71","author":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/author\/akiyama#author"},"publisher":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg","width":800,"height":691},"datePublished":"2025-11-11T02:47:00+09:00","dateModified":"2025-11-16T07:25:25+09:00","inLanguage":"ja","mainEntityOfPage":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#webpage"},"isPartOf":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#webpage"},"articleSection":"\u6280\u8853\u8b1b\u7fd2, Content-Security-Policy, csp, hoge, nonce, spring security 5, springboot 2.7"},{"@type":"BreadcrumbList","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018#listItem","position":1,"name":"Home","item":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018","nextItem":{"@type":"ListItem","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/category\/engineer#listItem","name":"\u6280\u8853\u8b1b\u7fd2"}},{"@type":"ListItem","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/category\/engineer#listItem","position":2,"name":"\u6280\u8853\u8b1b\u7fd2","item":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/category\/engineer","nextItem":{"@type":"ListItem","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#listItem","name":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#listItem","position":3,"name":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71","previousItem":{"@type":"ListItem","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/category\/engineer#listItem","name":"\u6280\u8853\u8b1b\u7fd2"}}]},{"@type":"Organization","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/#organization","name":"OIS\u30d6\u30ed\u30b0","description":"OIS\u306e\u30d6\u30ed\u30b0\u7d39\u4ecb","url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/","logo":{"@type":"ImageObject","url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/09\/OIS\u30ed\u30b4-\u6587\u5b57\u306a\u3057.png","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043\/#organizationLogo","width":128,"height":128},"image":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/orientalinformationservice","https:\/\/x.com\/ois_yokohama","https:\/\/www.instagram.com\/ois_yokohama1978\/"]},{"@type":"Person","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/author\/akiyama#author","url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/author\/akiyama","name":"akiyama","image":{"@type":"ImageObject","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/ff5bd4b5c6242b44911d761454b7fa2ee660c3e49a42278fda2507916d9816d2?s=96&d=mm&r=g","width":96,"height":96,"caption":"akiyama"}},{"@type":"WebPage","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#webpage","url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043","name":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71 | OIS\u30d6\u30ed\u30b0","inLanguage":"ja","isPartOf":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/#website"},"breadcrumb":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#breadcrumblist"},"author":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/author\/akiyama#author"},"creator":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/author\/akiyama#author"},"image":{"@type":"ImageObject","url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043\/#mainImage","width":800,"height":691},"primaryImageOfPage":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043#mainImage"},"datePublished":"2025-11-11T02:47:00+09:00","dateModified":"2025-11-16T07:25:25+09:00"},{"@type":"WebSite","@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/#website","url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/","name":"OIS\u30d6\u30ed\u30b0","description":"OIS\u306e\u30d6\u30ed\u30b0\u7d39\u4ecb","inLanguage":"ja","publisher":{"@id":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/#organization"}}]},"og:locale":"ja_JP","og:site_name":"OIS\u30d6\u30ed\u30b0 | OIS\u306e\u30d6\u30ed\u30b0\u7d39\u4ecb","og:type":"article","og:title":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71 | OIS\u30d6\u30ed\u30b0","og:url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043","og:image":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg","og:image:secure_url":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg","og:image:width":800,"og:image:height":691,"article:published_time":"2025-11-10T17:47:00+00:00","article:modified_time":"2025-11-15T22:25:25+00:00","article:publisher":"https:\/\/www.facebook.com\/orientalinformationservice","twitter:card":"summary","twitter:site":"@ois_yokohama","twitter:title":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71 | OIS\u30d6\u30ed\u30b0","twitter:creator":"@ois_yokohama","twitter:image":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2025\/11\/\u83ca.jpg"},"aioseo_meta_data":{"post_id":"10043","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"titles":[],"descriptions":[],"socialPosts":{"email":[],"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2025-11-11 00:46:11","updated":"2025-11-15 22:32:34","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/category\/engineer\" title=\"\u6280\u8853\u8b1b\u7fd2\">\u6280\u8853\u8b1b\u7fd2<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSpring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018"},{"label":"\u6280\u8853\u8b1b\u7fd2","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/category\/engineer"},{"label":"Spring Security\u3067CSP\uff08Content-Security-Policy\uff09\u5bfe\u7b56\u3057\u3066\u307f\u305f\u8a71","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/10043"}],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/10043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/comments?post=10043"}],"version-history":[{"count":7,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/10043\/revisions"}],"predecessor-version":[{"id":10127,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/10043\/revisions\/10127"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media\/10108"}],"wp:attachment":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media?parent=10043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/categories?post=10043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/tags?post=10043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}