File tree 1 file changed +20
-2
lines changed
src/main/java/ru/mystamps/web/support/spring/security
1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -116,8 +116,26 @@ protected void configure(HttpSecurity http) throws Exception {
116
116
// TODO: GH #27
117
117
.disable ()
118
118
.headers ()
119
- // TODO
120
- .disable ();
119
+ .defaultsDisabled () // TODO
120
+ .contentSecurityPolicy (
121
+ // default policy prevents loading resources from any source
122
+ "default-src 'none'; " +
123
+ // 'self' is required for: our own CSS files
124
+ // 'https://cdn.rawgit.com' is required for: languages.min.css (TODO: GH #246)
125
+ "style-src 'self' https://cdn.rawgit.com; " +
126
+ // 'self' is required for: our own JS files
127
+ // 'unsafe-inline' is required for: jquery.min.js (that is using code inside of event handlers.
128
+ // We can't use hashing algorithms because they aren't supported for handlers. In future,
129
+ // we should get rid of jQuery or use 'unsafe-hashed-attributes' from CSP3. Details:
130
+ // https://github.com/jquery/jquery/blob/d71f6a53927ad02d728503385d15539b73d21ac8/jquery.js#L1441-L1447
131
+ // and https://w3c.github.io/webappsec-csp/#unsafe-hashed-attributes-usage)
132
+ "script-src 'self' 'unsafe-inline'; " +
133
+ // 'https://cdn.rawgit.com' is required for: languages.png (TODO: GH #246)
134
+ // 'https://raw.githubusercontent.com' is required for: languages.png (TODO: GH #246)
135
+ "img-src https://cdn.rawgit.com https://raw.githubusercontent.com; " +
136
+ // 'self' is required for: glyphicons-halflings-regular.woff2 from bootstrap
137
+ "font-src 'self'"
138
+ ).reportOnly ();
121
139
}
122
140
123
141
// Used in ServicesConfig.getUserService()
You can’t perform that action at this time.
0 commit comments