Skip to content

Commit

Permalink
Merge pull request spinnaker#231 from OpsMx/bugfix/OP-16541-4-0-csp
Browse files Browse the repository at this point in the history
  • Loading branch information
sriharshakancharla authored Aug 8, 2022
2 parents c77a81d + c214856 commit a62667a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class AuthConfig {
@Value('${allowUnauthenticatedAccess.webhooks:false}')
boolean isSpinnakerWebhooksUnauthenticatedAccessEnabled

@Value('${security.contentSecurityPolicy:\'object-src \'none\'; script-src \'unsafe-eval\' \'unsafe-inline\' https: http:;\'}')
String contentSecurityPolicy

void configure(HttpSecurity http) throws Exception {
// @formatter:off
if(isAgentAPIUnauthenticatedAccessEnabled && isSpinnakerWebhooksUnauthenticatedAccessEnabled){
Expand Down Expand Up @@ -330,6 +333,8 @@ class AuthConfig {
http.authorizeRequests().antMatchers(HttpMethod.POST, '/webhooks/**').authenticated()
}

http.headers().contentSecurityPolicy(contentSecurityPolicy)

http.logout()
.logoutUrl("/auth/logout")
.logoutSuccessHandler(permissionRevokingLogoutSuccessHandler)
Expand Down
1 change: 1 addition & 0 deletions gate-web/config/gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ spring:
profiles: googleOAuth

security:
contentSecurityPolicy: "object-src 'none'; script-src 'unsafe-eval' 'unsafe-inline' https: http:;"
oauth2:
client:
# Set these values in your own config file (e.g. spinnaker-local.yml or gate-googleOAuth.yml).
Expand Down

0 comments on commit a62667a

Please sign in to comment.