Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔖 release 0.8.1 #78

Merged
merged 1 commit into from
Sep 26, 2024
Merged

🔖 release 0.8.1 #78

merged 1 commit into from
Sep 26, 2024

Conversation

annashamray
Copy link
Contributor

No description provided.

Copy link
Collaborator

@stevenbal stevenbal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@annashamray @Coperh I'm trying out the CSP changes to fix the redoc schema (with Objects API). But it doesn't seem to work?

Content-Security-Policy: The page’s settings blocked a script (script-src-elem) at https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js from being executed because it violates the following directive: “script-src 'self' 'unsafe-inline'”

Also it's kind of unfortunate we need 'unsafe-inline' for both script-src and style-src, because having those enabled kind of defeats the purpose of using CSP, but if there's not other way to get redoc to work, than that will have to be like that I guess

EDIT: thought this was also part of the release/0.8.1 branch (which it isn't yet), though with main it doesn't seem to work either

@Coperh
Copy link
Contributor

Coperh commented Sep 26, 2024

@stevenbal Did you add the sidecar to the spectacular settings?

SPECTACULAR_SETTINGS = {
    'SWAGGER_UI_DIST': 'SIDECAR',
    'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
    'REDOC_DIST': 'SIDECAR',
    ...
}

https://drf-spectacular.readthedocs.io/en/latest/faq.html#my-swagger-ui-and-or-redoc-page-is-blank

@annashamray
Copy link
Contributor Author

@stevenbal I agree with you about 'unsafe-inline', drf-spectacular suggest using SpectacularSwaggerSplitView as a workaround for Swagger UI, but we use redoc and I haven't seen any solution for it

@annashamray
Copy link
Contributor Author

I see a number of issues related to csp in drf-spectacular github (I think this issue is quite promising tfranzel/drf-spectacular#1241 ) but it's unclear if they actually plan to implement it

@annashamray
Copy link
Contributor Author

@stevenbal I've checked it with Objects API, it works for me (after you add 'REDOC_DIST': 'SIDECAR' to spectacular settings)

@stevenbal
Copy link
Collaborator

@annashamray ah I didn't check that, in that case all good 👍

@annashamray annashamray merged commit 026f44b into main Sep 26, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants