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

Bug: the obsidian v1.5.0 iframe not support local source ? #142

Open
MarkMindCkm opened this issue Nov 21, 2023 · 20 comments
Open

Bug: the obsidian v1.5.0 iframe not support local source ? #142

MarkMindCkm opened this issue Nov 21, 2023 · 20 comments

Comments

@MarkMindCkm
Copy link

Steps to reproduce:

  • when plugin use iframe , but iframe not support load local source ,for example css , js and images
  • 11111
@MarkMindCkm MarkMindCkm changed the title Bug: the v1.5.0 iframe not support local source ? Bug: the obsidian v1.5.0 iframe not support local source ? Nov 21, 2023
@lishid
Copy link
Collaborator

lishid commented Nov 21, 2023

Yeah, we had to block these because they were a security vulnerability. What URL/origin is your iframe using?

@MarkMindCkm
Copy link
Author

MarkMindCkm commented Nov 21, 2023

Yeah, we had to block these because they were a security vulnerability. What URL/origin is your iframe using?

I put local source to .obsidian of vault ,
then use this.app.vault.adapter.getResourcePath('.obsidian/web/viewer.html'); to create a iframe url ,
Css and js are referenced in the iframe

@lishid
Copy link
Collaborator

lishid commented Nov 22, 2023

Let me think about it - unfortunately the vulnerability involves loading a local html file into an iframe using which it would be able to read arbitrary local files through the app:// URIs.

@lishid
Copy link
Collaborator

lishid commented Nov 22, 2023

Hmm one workaround for now I can think of is to read the files and send them directly to the iframe. Alternatively you could embed them into the HTML. Both approaches are kinda tedious though.

@MarkMindCkm
Copy link
Author

MarkMindCkm commented Nov 23, 2023

Hmm one workaround for now I can think of is to read the files and send them directly to the iframe. Alternatively you could embed them into the HTML. Both approaches are kinda tedious though.

Indeed, but resources such as fonts and images still cannot be processed .

Additionally, I think that there are potential issues ( plugin can access system resources ) with using plugins , Just block iframe doesn't seem to make much sense .

( My English is not very good, it's machine translation )

@MarkMindCkm
Copy link
Author

Can it be blocked in safe mode and allowed to load resources when the plugin is enabled ?

@jiangnanqw12
Copy link

Hmm one workaround for now I can think of is to read the files and send them directly to the iframe. Alternatively you could embed them into the HTML. Both approaches are kinda tedious though.

Hello! The creator of Markmind has developed a remarkable product. They have implemented a feature that allows specific PDF annotations to link and jump to an Obsidian markdown page. I believe Markmind excellently complements Obsidian's functionality with PDFs. It would be unfortunate if, due to certain security updates, this product could no longer function fully.

@lishid
Copy link
Collaborator

lishid commented Dec 11, 2023

I think given most people are using some form of plugins it will offer zero protection for most people. I do have a potential solution, assuming you can load your iframe resources from the same folder as the frame html.

@MarkMindCkm
Copy link
Author

I think given most people are using some form of plugins it will offer zero protection for most people. I do have a potential solution, assuming you can load your iframe resources from the same folder as the frame html.

That's great, how can i do it ?

@lishid
Copy link
Collaborator

lishid commented Jan 2, 2024

Unfortunately I tried a few things and they all turned out to have vulnerabilities or various ways that can be used to bypass. That means you'll need to find a way to embed your javascript and css files into the html directly... Sorry about that.

@MarkMindCkm
Copy link
Author

Unfortunately I tried a few things and they all turned out to have vulnerabilities or various ways that can be used to bypass. That means you'll need to find a way to embed your javascript and css files into the html directly... Sorry about that.

ok

@cirida
Copy link

cirida commented Jan 8, 2024

I have this issue as well! How do you work around this? I have a bunch of plotly graphs I've been displaying this way...

@MarkMindCkm
Copy link
Author

I have this issue as well! How do you work around this? I have a bunch of plotly graphs I've been displaying this way...

I have no idea , If users can choose whether to enable this feature, that would be great

@vskorjanc
Copy link

I have this issue as well! How do you work around this? I have a bunch of plotly graphs I've been displaying this way...

Same here ✌

@calandradas
Copy link

calandradas commented Feb 18, 2024

the same issue, have any solution?
i've tried to wirte a local http server to load the iframe resources, but my case is a rich client application, the performance is too poor, and the local http server security risk still remains.
Will obsidian future versions open 'iframe load local resource' ?
Thanks !

@lishid
Copy link
Collaborator

lishid commented Feb 21, 2024

For now, the only solution seems to be bundling all of your CSS and JS into the HTML file that you are trying to distribute.

Until we can find a better way in Electron to make sure that pages can't access resources out of their folders I don't think we can safely allow this to happen.

@idewindy
Copy link

idewindy commented Mar 14, 2024

I'm using the singleFile browser plugin to crop it into an html how do I embed it and how do I tag this html file

@zfyangc
Copy link

zfyangc commented Mar 22, 2024

Yeah, we had to block these because they were a security vulnerability. What URL/origin is your iframe using?

ok, can you tell me which obsidian version still supports iframe? I'm looking forward to your reply.

@vskorjanc
Copy link

ok, can you tell me which obsidian version still supports iframe? I'm looking forward to your reply.

I believe that the last release that supported iframes was 1.4.16. I downgraded to this version and it works fine for me. You can download old releases here.

@justarmadillo
Copy link

For now, the only solution seems to be bundling all of your CSS and JS into the HTML file that you are trying to distribute.

Until we can find a better way in Electron to make sure that pages can't access resources out of their folders I don't think we can safely allow this to happen.

MarkMind plugin is a revolutionary plugin for obsidian, you are killing it ...

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

No branches or pull requests

9 participants