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

bugfix(#2152): Docs not support "http" markdown image #2171

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

busy-panda
Copy link

@busy-panda busy-panda commented Apr 25, 2024

resolves: #2152

Description

The error message was:

Refused to load the image 'http://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png' because it violates the following Content Security Policy directive: "img-src 'self' blob: data: https:".

Electron was not allowing to load images over "http", only "https" was allowed.

I think it's reasonable to allow it (for images only).

images.mp4

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

@busy-panda busy-panda marked this pull request as ready for review April 25, 2024 13:26
Comment on lines 24 to 29
"font-src 'self' https:",
// this has been commented out to make oauth2 work
// "form-action 'none'",
"img-src 'self' blob: data: https:",
"img-src 'self' blob: data: http: https:",
"media-src 'self' blob: data: https:",
"style-src 'self' 'unsafe-inline' https:"

Choose a reason for hiding this comment

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

Looking at this, I wonder why HTTP would be fine for images but at the same time not for fonts, styles or other media.

I think, if the content security policy is changed, the change should be consistently applied to all kinds.

Copy link
Member

Choose a reason for hiding this comment

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

In this case the user can embed an Image from an HTTP-Server in the Docs. But users can't link any fonts etc. And I think we should use the most strict rules if possible.

Copy link
Author

Choose a reason for hiding this comment

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

Yes I also thought about it but i didn't want to open security breaches without a need for it. It seems unlikely someone will include a font in the markdown editor, i don't think it's even possible. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry i didn't see @Its-treason response before so i agree to only allow images because they can be linked in the markdown editor

Choose a reason for hiding this comment

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

Makes perfect sense. 👍
Maybe it's worth adding the reasoning to the code as an inline comment. 🙂

Copy link
Author

Choose a reason for hiding this comment

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

Ok i can't now but i will later unless you can do it before.
Thanks

Choose a reason for hiding this comment

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

I suggested a change because I can't directly edit the file.

Copy link
Author

Choose a reason for hiding this comment

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

The comment is added now.
Thanks.

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.

Docs not support "http" markdown image
3 participants