0

I migrated a jhipster application generated with jhipster version 6.3.0.

Everything is right except swagger. I don't want for now to migrate to springdoc. I just kept springfox.

I get this exception when go to /admin/docs:

Refused to frame 'http://swagger.io/' because it violates the following Content Security Policy directive: "frame-src 'self' data:".

Should I change the CSP or something else ?

Right now I have this line in SecurityConfiguration

 .contentSecurityPolicy("default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com; style-src 'self' https://fonts.googleapis.com 'unsafe-inline'; img-src 'self' www.googletagmanager.com https://www.google-analytics.com data:; font-src 'self' https://fonts.gstatic.com data:")

2 Answers 2

1

Yes. It should work when adding http://swagger.io/ to frame-src in the CSP configuration. E.g.

...; frame-src 'self' http://swagger.io/ data:; ...

1

I solved the problem of CSP by using: .and().frameOptions().sameOrigin(). But finally I had no choices. I was obliged to migrate to springdoc instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.