Skip to content

Commit

Permalink
OTR:AKR(Backend): Security audit fixes. Added cache no-store and CSP …
Browse files Browse the repository at this point in the history
…policy
  • Loading branch information
jrkkp committed Jan 31, 2025
1 parent ca6cd98 commit e256106
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void getEmailStatisticsByYear(final HttpServletResponse response) throws
private static void writeHeaders(final HttpServletResponse response, final String filename) {
response.setContentType(MEDIA_TYPE_XLSX);
response.addHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", filename));
response.setHeader("Cache-Control", "no-cache, no-store, private, max-age=0, must-revalidate");
}

private void writeContactRequestStatisticsExcel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public static HttpSecurity commonConfig(final HttpSecurity httpSecurity) throws
.permitAll()
.anyRequest()
.authenticated()
)
.headers(httpSecurityHeadersConfigurer ->
httpSecurityHeadersConfigurer.contentSecurityPolicy(contentSecurityPolicyConfig ->
contentSecurityPolicyConfig.policyDirectives("style-src 'self'; script-src 'self'; form-action 'self'")
)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public static HttpSecurity commonConfig(final HttpSecurity httpSecurity) throws
.permitAll()
.anyRequest()
.authenticated()
)
.headers(httpSecurityHeadersConfigurer ->
httpSecurityHeadersConfigurer.contentSecurityPolicy(contentSecurityPolicyConfig ->
contentSecurityPolicyConfig.policyDirectives("style-src 'self'; script-src 'self'; form-action 'self'")
)
);
}

Expand Down

0 comments on commit e256106

Please sign in to comment.