File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed
arc-ws/src/main/java/fr/insee/arc/ws/services/restServices Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 11
11
import org .springframework .security .oauth2 .client .registration .InMemoryClientRegistrationRepository ;
12
12
import org .springframework .security .oauth2 .core .ClientAuthenticationMethod ;
13
13
import org .springframework .security .web .SecurityFilterChain ;
14
+ import org .springframework .security .web .header .writers .XXssProtectionHeaderWriter ;
14
15
15
16
import fr .insee .arc .core .util .StaticLoggerDispatcher ;
16
17
import fr .insee .arc .utils .ressourceUtils .PropertiesHandler ;
@@ -42,7 +43,14 @@ public ClientRegistrationRepository clientRegistrationRepository(PropertiesHandl
42
43
43
44
@ Bean
44
45
SecurityFilterChain clientSecurityFilterChain (HttpSecurity http , PropertiesHandler properties ) throws Exception {
45
-
46
+
47
+ http .headers (
48
+ headers -> headers
49
+ .xssProtection (xXssConfig -> xXssConfig .headerValue (XXssProtectionHeaderWriter .HeaderValue .ENABLED ))
50
+ .contentSecurityPolicy (
51
+ csp ->
52
+ csp .policyDirectives ("img-src 'self' data:; style-src-elem 'self' data:; script-src-elem 'self' data:; style-src 'unsafe-inline'; default-src 'self'; script-src 'unsafe-inline'; form-action 'self'; object-src 'none';" )));
53
+
46
54
// oath2 keycloak
47
55
if (WebAttributesName .isKeycloakActive (properties .getKeycloakRealm ())) {
48
56
Original file line number Diff line number Diff line change @@ -7,13 +7,8 @@ var configJS = "Render:FixedHeader;"
7
7
+ "Render:AlertBox;" ;
8
8
9
9
function alimenterPhase ( t ) {
10
- console . log ( "savePhaseChoice :" + $ ( "#savePhaseChoice" ) . attr ( "value" ) ) ;
11
- console . log ( "$(t) :" + $ ( t ) . attr ( "value" ) ) ;
12
10
$ ( "#savePhaseChoice" ) . attr ( "value" , $ ( t ) . attr ( "value" ) ) ;
13
11
$ ( "#savePhaseChoice" ) . attr ( "m" , "js" ) ;
14
- console . log ( "savePhaseChoice :" + $ ( "#savePhaseChoice" ) . attr ( "value" ) ) ;
15
- console . log ( "savePhaseChoice :" + $ ( "#savePhaseChoice" ) . attr ( "m" ) ) ;
16
-
17
12
return true ;
18
13
}
19
14
Original file line number Diff line number Diff line change 20
20
import org .springframework .security .oauth2 .jwt .JwtDecoders ;
21
21
import org .springframework .security .oauth2 .server .resource .authentication .JwtAuthenticationConverter ;
22
22
import org .springframework .security .web .SecurityFilterChain ;
23
+ import org .springframework .security .web .header .writers .XXssProtectionHeaderWriter ;
23
24
import org .springframework .security .web .servlet .util .matcher .PathPatternRequestMatcher ;
24
25
25
26
import fr .insee .arc .core .util .StaticLoggerDispatcher ;
@@ -50,6 +51,18 @@ public JwtAuthenticationConverter jwtAuthenticationConverterForKeycloak() {
50
51
@ Bean
51
52
SecurityFilterChain securityFilterChain (HttpSecurity http , PropertiesHandler properties ) throws Exception {
52
53
54
+ http .headers (
55
+ headers -> headers
56
+ .xssProtection (xXssConfig -> xXssConfig .headerValue (XXssProtectionHeaderWriter .HeaderValue .ENABLED_MODE_BLOCK ))
57
+ .httpStrictTransportSecurity (hsts -> hsts
58
+ .includeSubDomains (true )
59
+ .preload (true )
60
+ .maxAgeInSeconds (31536000 )
61
+ )
62
+ .contentSecurityPolicy (
63
+ csp ->
64
+ csp .policyDirectives ("style-src 'none'; default-src 'none'; script-src 'none'; form-action 'none'; object-src 'none';" )));
65
+
53
66
54
67
if (WebAttributesName .isKeycloakActive (properties .getKeycloakRealm ())) {
55
68
http .oauth2ResourceServer (resourceServer -> resourceServer .jwt (jwtResourceServer -> jwtResourceServer
You can’t perform that action at this time.
0 commit comments