Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341294 - [Help] Regression in org.eclipse.help.toc extension: AbstractTocProvider cannot specify local file URI
Summary: [Help] Regression in org.eclipse.help.toc extension: AbstractTocProvider cann...
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Chris Goldthorpe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-29 18:57 EDT by Jeff Johnston CLA
Modified: 2011-03-31 13:30 EDT (History)
1 user (show)

See Also:


Attachments
zip of helpProblem plug-in (7.61 KB, application/zip)
2011-03-29 18:57 EDT, Jeff Johnston CLA
no flags Details
test html file to show as topic (262 bytes, text/html)
2011-03-29 18:58 EDT, Jeff Johnston CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Johnston CLA 2011-03-29 18:57:58 EDT
Created attachment 192146 [details]
zip of helpProblem plug-in

I have attached a plug-in which uses the org.eclipse.help.toc extension and specifies a toc provider class.

The toc provider class specifies a topic which has an href that points to a local system file (note: not a plug-in file, but a file on the local system).  In this case, it is /home/xxxxx/my.html.  Place the accompanying my.html file in your home directory before testing.

Launch a child Eclipse application with the helpProblem plug-in added.  Go to Help Contents and open Help Documents and click on the one Help Topic provided.

Under 3.6.0, this works and the my.html is shown.  In the case of 3.6.1 and higher, an error is posted and the my.html file is not shown.
Comment 1 Jeff Johnston CLA 2011-03-29 18:58:47 EDT
Created attachment 192147 [details]
test html file to show as topic
Comment 2 Chris Goldthorpe CLA 2011-03-30 14:40:17 EDT
The cause of the regression was a security fix and has nothing to do with the toc provider extension point. Up until Eclipse 3.6.1 the workbench help server would allow references which used the file: protocol, from a security perspective this was problematic. In Eclipse 3.6.1 a number of security issues were fixed which ended up severely restricting the use of the file: protocol. 

There is a preference in Eclipse, org.eclipse.help.base/restrictTopicParameter which allows the file: protocol to be still used, unfortunately this still does not allow your example to work.

For Eclipse 3.7 I can add a fix so that org.eclipse.help.base/restrictTopicParameter will allow the file: protocol to be used. In general however I recommend that users do not use this preference as allowing the file: protocol does reduce security. Instead I would suggest that if you need to access local files that you use a content producer.
Comment 3 Chris Goldthorpe CLA 2011-03-30 17:43:37 EDT
I need to correct one thing I said in my previous comment. org.eclipse.help.base/restrictTopicParameter does not have the effect of permitting use of the file: protocol.
Comment 4 Jeff Johnston CLA 2011-03-31 11:20:24 EDT
(In reply to comment #2)
> The cause of the regression was a security fix and has nothing to do with the
> toc provider extension point. Up until Eclipse 3.6.1 the workbench help server
> would allow references which used the file: protocol, from a security
> perspective this was problematic. In Eclipse 3.6.1 a number of security issues
> were fixed which ended up severely restricting the use of the file: protocol. 
> 
> There is a preference in Eclipse, org.eclipse.help.base/restrictTopicParameter
> which allows the file: protocol to be still used, unfortunately this still does
> not allow your example to work.
> 
> For Eclipse 3.7 I can add a fix so that
> org.eclipse.help.base/restrictTopicParameter will allow the file: protocol to
> be used. In general however I recommend that users do not use this preference
> as allowing the file: protocol does reduce security. Instead I would suggest
> that if you need to access local files that you use a content producer.

So, I would create an IHelpContentProducer for my plug-in and then code the hrefs in my dynamic toc provider to be something like MYPLUGINID/some_file_name.html at which my IHelpContentProducer would get called and open the some_file_name.html locally on the system (e.g. /usr/share/docs/some_file_name.html) and then pass back the input stream.  I think that is a reasonable solution.  Please correct me if I have interpreted this incorrectly.
Comment 5 Chris Goldthorpe CLA 2011-03-31 13:30:16 EDT
Your description is 100% accurate. Also I need to correct one thing I wrote in my previous comment - restrictTopicParameter turns on and off an anti-phishing check and is unrelated to the use of the file: protocol. Closing this bug report.