-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Preview does not work #73
Comments
Verify the Do you have any protection software running that would block local connections to After the browser opens (and is still open), verify that |
I have installed "Pandoc" and "Miktex-console" via brew. The Pandoc path is configured in the settings panel. The browser opens with URL: http://127.0.0.1:9025/index-0067.html. There is no special content in the numbered index.html - file. It's just a copy of the original index.html. The difference to the README: I use a very newer eclipse version and also a newer Jetty version!? |
Fluentmark runs an embedded Jetty (11.0.15) server on Is the browser is giving a custom If the browser is showing a default In any event, try diagnosing the browser operation: |
The embedded Jetty server is set up correctly - works well for others. There is something on your machine/in your environment that is blocking correct operation. Shut down any antivirus, VPN, or other software that could constrain, alter, or redirect local web transactions or access to the local file system until the conflict is isolated. |
@grosenberg This is still an issue, and always reproducible on modern MacOS. The reason is MacOS's System Integrity Protection (SIP), which prevent access to So, please look again at the screenshot given in one of the previous comments. It proves that the Browser can access jetty, as 404 is from jetty. It also proves that jetty's attempt to access I tested the following two work-arounds, which both are really not recommendable for production:
In both cases the live preview works. But changing Therefore I'd recommend to use a different folder as document-root, at least on MacOS - maybe something in the current Eclipse workspace? Or we make this document-root configurable? |
Don't have MacOS to test. |
The public documentation found is sparse, but suggests SIP should not be the blocking factor:
Can find no publicly reported problems for Jetty serving content from a file stored in the system temporary directory, i.e. Are you running any software that might be implementing firewall protections on network connections? Has Are any of the files/directories |
@grosenberg First of all - thanks for reopening and your feedback. Before I did my test, with the overridden temporary directory, I removed anything (like my custom firewall) that could interfere with this setup. (Because I didn't want to waste you're time.) Today I reproduced this issue on a freshly installed prestine Mac. On thing I can remember about jetty - there was at least one CVE related to jetty, that was about severing data from temporary directory might reveal sensitive information. Due to lack of time, I could not search for it yet. I'll take more time this weekend to investigate this issue. I'll build your plugin from source, attaching some more debug statements to jetty's resource-handler implementation. I already ran eclipse with trace logging enabled, but that did not reveal anything new. |
Not sure adding debug statements would be illuminating. Might first try using Java's built-in Simple Web Server to serve static content from a subdirectory of Also, did you inspect the extracted file to see if they or their directories were marked |
Just for protocol here are the filesystem rights - so it's not a matter of user rights or SIP per se. ❯ ls -lOd /var/folders/…/liveview/ /var/folders/…/liveview/* /var/folders/…/liveview/*/*
drwxr-xr-x@ 4 MY_USER_NAME staff - 128 27 Jan 12:26 liveview/
drwxr-xr-x@ 8 MY_USER_NAME staff - 256 27 Jan 12:26 liveview/app
-rw-r--r--@ 1 MY_USER_NAME staff - 2423373 27 Jan 12:26 liveview/client.zip
-rw-r--r--@ 1 MY_USER_NAME staff - 153 27 Jan 12:26 liveview/app/app-config.json
drwxr-xr-x@ 22 MY_USER_NAME staff - 704 27 Jan 12:26 liveview/app/assets
-rw-r--r--@ 1 MY_USER_NAME staff - 1150 27 Jan 12:26 liveview/app/fluentmark_doc.ico
drwxr-xr-x@ 5 MY_USER_NAME staff - 160 27 Jan 12:26 liveview/app/images
-rw-r--r--@ 1 MY_USER_NAME staff - 1186 27 Jan 12:26 liveview/app/index-0916.html
-rw-r--r--@ 1 MY_USER_NAME staff - 1186 27 Jan 12:26 liveview/app/index.html My current guess (which I'll try to prove) is a combination of missing or wrong entitlements of the Eclipse.app or the OpenJDK.bundle (https://developer.apple.com/documentation/bundleresources/entitlements). This could lead the MacOS gatekeeper to instruct MacOS launchd to run Eclipse in a Sandbox (https://developer.apple.com/documentation/security/app_sandbox/). But on the other hand - I just ran eclipse via Terminal, so not via launchd (≠ Double Click the App, but execute Running the ❯ /opt/…/bin/jwebserver -o verbose -b 127.0.0.1 -p 8081 -d /var/folders/…/liveview/app/
Serving /var/folders/…/liveview/app and subdirectories on 127.0.0.1 (all interfaces) port 8081
URL http://127.0.0.1:8081/
127.0.0.1 - - [27/Jan/2024:12:51:33 +0100] "GET /index-0916.html HTTP/1.1" 200 -
Resource requested: /var/folders/…/liveview/app/index-0916.html
> Accept-encoding: gzip, deflate
> Sec-fetch-dest: document
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Connection: keep-alive
> Sec-fetch-site: none
> Host: 127.0.0.1:8081
> Sec-fetch-mode: navigate
> User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15
> Accept-language: de-DE,de;q=0.9
> Upgrade-insecure-requests: 1
> If-modified-since: Sat, 27 Jan 2024 11:26:24 GMT
>
< Date: Sat, 27 Jan 2024 11:51:33 GMT
< Last-modified: Sat, 27 Jan 2024 11:26:24 GMT
< Content-type: text/html
< Content-length: 1186
<
… Hope, I'll find some new insights (and not wasting our time). |
This fix allows serving from iMacOS's symlinked temporary directory. MacOS symlinks /var to /private/var. The default temporary directory on MacOS is “/var/folders/…”, so fluentmark-rendered files can not be served on MacOS, due to jetty's AllowedResourceAliasChecker which prevents serving files from outside the resource-base. Using the resource-bases realpath solves this issue. Resolves: grosenberg#73
This fix allows serving from MacOS's symlinked temporary directory. MacOS symlinks /var to /private/var. The default temporary directory on MacOS is “/var/folders/…”, so fluentmark-rendered files can not be served on MacOS, due to jetty's AllowedResourceAliasChecker which prevents serving files from outside the resource-base. Using the resource-bases realpath solves this issue. Resolves: grosenberg#73
This fix allows serving from MacOS's symlinked temporary directory. MacOS symlinks `/var` to `/private/var`. The default temporary directory on MacOS is `/var/folders/…`, so fluentmark-rendered files can not be served on MacOS, due to jetty's AllowedResourceAliasChecker which prevents serving files from outside the resource-base. Using the resource-bases realpath solves this issue. Resolves: grosenberg#73
This fix allows serving from MacOS's symlinked temporary directory. MacOS symlinks `/var` to `/private/var`. The default temporary directory on MacOS is `/var/folders/…`, so fluentmark-rendered files can not be served on MacOS, due to jetty's `AllowedResourceAliasChecker` which prevents serving files from outside the resource-base. Using the resource-bases realpath solves this issue. Resolves: grosenberg#73
@grosenberg Got it. And I was on a completely wrong path. It has nothing to do with SIP, Gatekeeper, Entitlements or the like, so sorry for my initial “overexcitement”. As already stated in my PR (#78) on MacOS After debugging the server-implementation for 2 hours without any new insights, I started digging through some similar/related issues, like …
This brought me back on the right track. Let's just use the realpath in the resource-handler's base-resource. My tiny PR (#78) has been tested successfully on MacOS. |
Btw - disabling SIP removes the symlink from |
Very much appreciate your digging in to find a fix. Please run and report the actual results (sans any personally identifying information) of the following:
Thanks. |
Path path = Path.of(System.getProperty("java.io.tmpdir"), "test");
Path real = path.toRealPath();
On my system: Seems to expect an existing file!? |
Again
|
If you still have your test build of Fluentmark, please test by:
Thanks |
Path is '/var/folders/_v/bq1zqdzn0w5f4fzh7k7zdk5m0000gn/T/test' |
@grosenberg Hmmm - jetty docs state: By default, the context is created with the AllowedResourceAliasChecker which is configured to allow symlinks. If this alias checker is not required, then clearAliasChecks() And AllowedResourceAliasChecker: This will approve any alias to anything inside of the ContextHandlers resource base, which is not protected by a protected target as defined by ContextHandler.getProtectedTargets() at start. Aliases approved by this may still be able to bypass SecurityConstraints, so this class would need to be extended to enforce any additional security constraints that are required. I do not (yet) know what exactly alias means here. And I'm not that sure, that serving content from outside the “DocumentRoot” is a good idea - if removing But I'll test removing |
@sjorek - thanks for checking. IIUC, the only effect of removing Moving from overly-strict to a default level of security should be acceptable if it fixes the bug. |
content from a symlinked resource-base This fix allows serving from MacOS's symlinked temporary directory. MacOS symlinks `/var` to `/private/var`. The default temporary directory on MacOS is `/var/folders/…`, so fluentmark-rendered files can not be served on MacOS, due to jetty's `AllowedResourceAliasChecker` which prevents serving files from outside the resource-base. Using the canonical-path (which includes the realpath) of the live-server's root solves this issue. Resolves: grosenberg#73 Signed-off-by: Stephan Jorek <stephan.jorek@gmail.com>
@grosenberg Good Morning! I just rebuild and tested your plugin¹ with removed So I followed the documentation about jetty's alias-checks again: From AllowedResourceAliasChecker: Adding the slightly more relaxed alternative SymlinkAllowedResourceAliasChecker, also does not solve the problem: So my conclusions are:
Then it works:
I updated my PR #78 and its description accordingly.
diff --git a/net.certiv.fluent.dt.vis/META-INF/MANIFEST.MF b/net.certiv.fluent.dt.vis/META-INF/MANIFEST.MF
index b3b6d66..563b5bf 100644
--- a/net.certiv.fluent.dt.vis/META-INF/MANIFEST.MF
+++ b/net.certiv.fluent.dt.vis/META-INF/MANIFEST.MF
@@ -8,9 +8,9 @@ Bundle-Name: Fluent Vis
Bundle-SymbolicName: net.certiv.fluent.dt.vis;singleton:=true
Bundle-Version: 1.9.0.qualifier
Bundle-Activator: net.certiv.fluent.dt.vis.FluentVis
-Require-Bundle: net.certiv.dsl.core;bundle-version="0.32.0",
- net.certiv.dsl.lib;bundle-version="0.32.0",
- net.certiv.dsl.ui;bundle-version="0.32.0",
+Require-Bundle: net.certiv.dsl.core;bundle-version="0.31.0",
+ net.certiv.dsl.lib;bundle-version="0.31.0",
+ net.certiv.dsl.ui;bundle-version="0.31.0",
net.certiv.fluent.dt.core;bundle-version="1.9.0",
net.certiv.fluent.dt.ui;bundle-version="1.9.0",
org.eclipse.core.resources;bundle-version="3.18.100",
diff --git a/net.certiv.fluent.dt.vis/src/main/java/net/certiv/fluent/dt/vis/server/LiveServer.java b/net.certiv.fluent.dt.vis/src/main/java/net/certiv/fluent/dt/vis/server/LiveServer.java
index b97f7e5..24c7e5c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,9 +37,9 @@
<certiv.root>${local.root}/Tools/Certiv</certiv.root>
<dsl.root>${local.root}/Tools/Dsl</dsl.root>
- <tools.repo>${certiv.root}/net.certiv.tools.parent/net.certiv.tools.site/target/repository</tools.repo>
- <dsl.repo>${dsl.root}/net.certiv.dsl/net.certiv.dsl.site/target/repository</dsl.repo>
- <spell.repo>${dsl.root}/net.certiv.spellchecker/site/target/repository</spell.repo>
+ <tools.repo>https://www.certiv.net/updates/net.certiv.tools.site/</tools.repo>
+ <dsl.repo>https://www.certiv.net/updates/net.certiv.dsl.site/</dsl.repo>
+ <spell.repo>https://www.certiv.net/updates/</spell.repo>
<jetty.version>11.0.15</jetty.version>
<log4j.ver>2.20.0</log4j.ver>
|
@sjorek - excellent analysis. Thanks.
The fix will be rolled into the next release, due very shortly. |
New release is now live. |
I get an error:
URI: /index-0384.html
STATUS: 404
MESSAGE: Not Found
SERVLET: org.eclipse.jetty.servlet.ServletHandler$Default404Servlet-5d2a9b26
Powered by Jetty:// 11.0.15
trying to open the preview from eclipse ice:
OS: MacOS Ventura 13.4
Java Temurin 17.0.7
Eclipse: 2023-03 (4.27.0)
Plugin: FluentMark Editor 1.8.0.20230519-1831
May be I need special items in my environment?
The text was updated successfully, but these errors were encountered: