Re: Freemarker Sandboxing

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On 2008.06.16., at 17:20, Alan Gutierrez wrote:

> I'm developing a Web 2.0 application and I'd like to give people the
> ability to upload templates for particular web pages. Blogspot
> provides this sort of customization. It uses a special XML template
> language.
>
> I'd like to use Freemarker. I've not looked at it thoroughly, but it
> appears to only permit you to use objects that have been exposed to
> it's context.
>
> I'm wondering if Freemarker can call arbitrary static functions

No.

> or
> create arbitrary objects.

It does have a ?new built-in, but it can only create objects that  
implement the TemplateModel interface.

> Or maybe, has anyone tried to run
> Freemarker in a sandbox?

At least in 2.4 (and I might end up backporting this to 2.3 if there's  
a need) most stock template loaders assign a java.security.CodeSource  
to templates and make sure templates are run with Java security  
permissions for that particular code source, so you should be able to  
control them using the standard implementation of Java security policy  
by running the JVM with a security manager.

Attila.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.